magic-boot/data/magic-api/api/后台/菜单管理/获取菜单tree.ms
2022-03-05 10:31:35 +08:00

104 lines
2.8 KiB
Plaintext

{
"properties" : { },
"id" : "ffb6988226d14e6789cc30193e008183",
"script" : null,
"groupId" : "67b2ce258e24491194b74992958c74aa",
"name" : "获取菜单tree",
"createTime" : null,
"updateTime" : 1646402874965,
"lock" : "0",
"method" : "GET",
"path" : "/tree",
"parameters" : [ ],
"option" : "[{\"name\":\"permission\",\"value\":\"menu:view\",\"description\":\"允许拥有该权限的访问\"}]",
"requestBody" : "{\n\n}",
"headers" : [ ],
"paths" : [ ],
"responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1634309660370,\n \"executeTime\": null\n}",
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ {
"name" : "code",
"value" : "402",
"description" : "",
"required" : false,
"dataType" : "Integer",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "message",
"value" : "凭证已过期",
"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" : "1634309660370",
"description" : "",
"required" : false,
"dataType" : "Long",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "executeTime",
"value" : "null",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
} ]
},
"optionMap" : {
"permission" : "menu:view"
}
}
================================
var toTree = (list,pid) => select t.*,toTree(list,t.id) children from list t where t.pid = pid
var list = toTree(db.select('select id,name,pid,is_show,url,sort,permission,desc_ribe,icon,keep_alive,component_id from sys_menu where is_del = 0 order by sort'),'0')
return {
list: list,
total: list.getLength()
}