magic-boot/data/magic-api/api/后台/角色管理/删除.ms

60 lines
1.5 KiB
Plaintext
Raw Normal View History

2021-10-24 20:09:53 +08:00
{
"properties" : { },
"id" : "633b78b93bba43fba785c71c1c18d7f7",
"script" : null,
"groupId" : "89130d496f6f467c88b22ae4a7f688eb",
"name" : "删除",
"createTime" : null,
"updateTime" : 1647615829916,
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" : "role: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
}
================================
2022-01-04 14:56:52 +08:00
import '@get:/role/cache/delete' as cacheDelete
var userCount = db.selectInt("select count(1) from sys_user_role where role_id = #{id}")
if(userCount > 0){
exit 500, '角色已分配,不允许删除'
}
2022-01-04 14:56:52 +08:00
var roleId = id
cacheDelete()
db.table("sys_role_menu").where().eq("role_id",id).delete()
2021-10-24 20:09:53 +08:00
return db.table("sys_role").logic().where().eq("id",id).delete();