diff --git a/data/magic-api/api/系统管理/菜单管理/删除.ms b/data/magic-api/api/系统管理/菜单管理/删除.ms index 66a82f9..408b797 100644 --- a/data/magic-api/api/系统管理/菜单管理/删除.ms +++ b/data/magic-api/api/系统管理/菜单管理/删除.ms @@ -5,10 +5,10 @@ "groupId" : "67b2ce258e24491194b74992958c74aa", "name" : "删除", "createTime" : null, - "updateTime" : 1665500654624, + "updateTime" : 1712806455648, "lock" : "0", "createBy" : null, - "updateBy" : "guyi", + "updateBy" : null, "path" : "/delete", "method" : "DELETE", "parameters" : [ { @@ -141,7 +141,17 @@ for(item in userIds){ } 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(); +let recursionDelete = (list) => { + list.forEach(it => { + db.table('sys_role_menu').where().eq("menu_id",it.id).delete(); + db.table("sys_menu").logic().where().eq("id",it.id).delete() + let children = db.select("select id from sys_menu where is_del = 0 and pid = #{it.id}") + if(children && children.size() > 0){ + recursionDelete(children) + } + }) +} +recursionDelete(db.select("select id from sys_menu where is_del = 0 and pid = #{id}")) -return result \ No newline at end of file +db.table('sys_role_menu').where().eq("menu_id",id).delete(); +return db.table("sys_menu").logic().where().eq("id",id).delete(); \ No newline at end of file