magic-boot/data/magic-api/api/系统管理/用户管理/删除.ms

62 lines
1.5 KiB
Plaintext
Raw Normal View History

2021-10-24 20:09:53 +08:00
{
"properties" : { },
"id" : "c86e4f8fd4bc4d63bfaec8a53ea333cf",
"script" : null,
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
"name" : "删除",
"createTime" : null,
"updateTime" : 1655304921225,
2021-10-24 20:09:53 +08:00
"lock" : "0",
"createBy" : null,
"updateBy" : null,
2021-10-24 20:09:53 +08:00
"path" : "/delete",
"method" : "DELETE",
2021-10-24 20:09:53 +08:00
"parameters" : [ ],
"options" : [ {
"name" : "permission",
"value" : "user:delete",
"description" : "允许拥有该权限的访问",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : null,
"error" : null,
"expression" : null,
"children" : null
} ],
2022-02-06 12:34:56 +08:00
"requestBody" : "{\n\n}",
2021-10-24 20:09:53 +08:00
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
},
"responseBodyDefinition" : null
2021-10-24 20:09:53 +08:00
}
================================
import org.ssssssss.magicapi.modules.db.cache.SqlCache
2022-01-04 14:56:52 +08:00
if(Arrays.asList(id.split(',')).contains('1')){
exit 500, '不允许删除超级管理员'
}
2021-10-24 20:09:53 +08:00
for(userId in id.split(',')){
2022-01-04 14:56:52 +08:00
SqlCache.delete(`permissions:${userId}`)
2021-10-24 20:09:53 +08:00
db.table("sys_user").logic().where().eq("id",userId).delete();
db.update("""
delete from sys_user_role where user_id = #{userId}
""")
2021-10-24 20:09:53 +08:00
}
return true