magic-boot/data/magic-api/api/系统管理/菜单管理/删除.ms
2023-12-28 20:58:43 +08:00

147 lines
3.6 KiB
Plaintext

{
"properties" : { },
"id" : "3564ad867beb48898f85c44bd3f7aa3f",
"script" : null,
"groupId" : "67b2ce258e24491194b74992958c74aa",
"name" : "删除",
"createTime" : null,
"updateTime" : 1665500654624,
"lock" : "0",
"createBy" : null,
"updateBy" : "guyi",
"path" : "/delete",
"method" : "DELETE",
"parameters" : [ {
"name" : "id",
"value" : "b1851d1b13594e71840103c11a37a669",
"description" : "",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : null,
"error" : null,
"expression" : null,
"children" : null
} ],
"options" : [ {
"name" : "permission",
"value" : "menu:delete",
"description" : "允许拥有该权限的访问",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : null,
"error" : null,
"expression" : null,
"children" : null
} ],
"requestBody" : "{\n\n}",
"headers" : [ ],
"paths" : [ ],
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": null,\n \"timestamp\": 1641201245421,\n \"executeTime\": 7\n}",
"description" : null,
"requestBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
},
"responseBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ {
"name" : "code",
"value" : "200",
"description" : "",
"required" : false,
"dataType" : "Integer",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "message",
"value" : "success",
"description" : "",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "data",
"value" : "null",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "timestamp",
"value" : "1641201245421",
"description" : "",
"required" : false,
"dataType" : "Long",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "executeTime",
"value" : "7",
"description" : "",
"required" : false,
"dataType" : "Integer",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
} ]
}
}
================================
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();
return result