关联组件表

This commit is contained in:
zegezy 2024-03-07 20:38:17 +08:00
parent 638cbe9eda
commit 67176d7d1b
2 changed files with 25 additions and 8 deletions

View File

@ -5,7 +5,7 @@
"groupId" : "67b2ce258e24491194b74992958c74aa", "groupId" : "67b2ce258e24491194b74992958c74aa",
"name" : "当前用户菜单", "name" : "当前用户菜单",
"createTime" : null, "createTime" : null,
"updateTime" : 1709642066002, "updateTime" : 1709717134895,
"lock" : "0", "lock" : "0",
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -565,11 +565,11 @@ var notLayoutMenus = db.select("""
-- 查询下级是否还有菜单(不包含按钮权限) -- 查询下级是否还有菜单(不包含按钮权限)
( (
select count(1) from sys_menu where is_del = 0 and pid = sm.id and select count(1) from sys_menu where is_del = 0 and pid = sm.id and
((component_name is not null and component_name != '') or (url is not null and url != '')) ((component_id is not null and component_id != '') or (url is not null and url != ''))
) sub_count, ) sub_count,
sm.keep_alive sm.keep_alive
from sys_menu sm left join sys_dynamic_component sdc on sdc.id = sm.component_name from sys_menu sm left join sys_dynamic_component sdc on sdc.id = sm.component_id
where sm.is_del = 0 and ((sm.component_name is not null and sm.component_name != '') or ( where sm.is_del = 0 and ((sm.component_id is not null and sm.component_id != '') or (
sm.url is not null and sm.url != '' sm.url is not null and sm.url != ''
-- 排除不需要加载路由的菜单 -- 排除不需要加载路由的菜单
and sm.url not like 'http%' and sm.url not like 'http%'
@ -607,7 +607,7 @@ var menus = db.select("""
sm.keep_alive, sm.keep_alive,
sdc.name as component_name, sdc.name as component_name,
sm.open_mode sm.open_mode
from sys_menu sm left join sys_dynamic_component sdc on sdc.id = sm.component_name from sys_menu sm left join sys_dynamic_component sdc on sdc.id = sm.component_id
where 1=1 where 1=1
?{userId != '1', ?{userId != '1',
and sm.id in ( and sm.id in (

View File

@ -5,7 +5,7 @@
"groupId" : "67b2ce258e24491194b74992958c74aa", "groupId" : "67b2ce258e24491194b74992958c74aa",
"name" : "获取菜单tree", "name" : "获取菜单tree",
"createTime" : null, "createTime" : null,
"updateTime" : 1656386304094, "updateTime" : 1709801228981,
"lock" : "0", "lock" : "0",
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -28,7 +28,7 @@
"requestBody" : "{\n\n}", "requestBody" : "{\n\n}",
"headers" : [ ], "headers" : [ ],
"paths" : [ ], "paths" : [ ],
"responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1634309660370,\n \"executeTime\": null\n}", "responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1709773777522,\n \"executeTime\": null\n}",
"description" : null, "description" : null,
"requestBodyDefinition" : { "requestBodyDefinition" : {
"name" : "", "name" : "",
@ -119,7 +119,24 @@
} }
================================ ================================
var toTree = (list,pid) => select t.*,toTree(list,t.id) children from list t where t.pid = pid 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_name,open_mode from sys_menu where is_del = 0 order by sort'),'0') var list = toTree(db.select("""
select
sm.id,
sm.name,
sm.pid,
sm.is_show,
sm.url,
sm.sort,
sm.permission,
sm.desc_ribe,
sm.icon,
sm.keep_alive,
sdc.name component_name,
sm.component_id,
sm.open_mode
from sys_menu sm left join sys_dynamic_component sdc on sm.component_id = sdc.id
where sm.is_del = 0 order by sm.sort
"""),'0')
return { return {
list: list, list: list,