菜单删除 删除缓存

This commit is contained in:
zegezy 2023-12-28 20:58:43 +08:00
parent 0b38771d30
commit f1af10d727

View File

@ -130,12 +130,18 @@
}
}
================================
import '@get:/system/menu/cache/delete' as cacheDelete;
import org.ssssssss.magicapi.modules.db.cache.SqlCache
var userIds = db.select("""
select user_id from sys_user_role where role_id in (
select role_id from sys_role_menu where menu_id = #{id}
) and user_id is not null
""")
for(item in userIds){
SqlCache.delete(`permissions:${item.userId}`)
}
SqlCache.delete('permissions:1')
db.table('sys_role_menu').where().eq("menu_id",id).delete();
var result = db.table("sys_menu").logic().where().eq("id",id).delete();
var menuId = id
cacheDelete();
return result