diff --git a/script/sql/zfjd-refactoring-v1/1004-备份菜单.sql b/script/sql/zfjd-refactoring-v1/1004-备份菜单.sql new file mode 100644 index 00000000..4061cb40 --- /dev/null +++ b/script/sql/zfjd-refactoring-v1/1004-备份菜单.sql @@ -0,0 +1,182 @@ +-- ============================================= +-- 005-2-重新整理二期菜单结构.sql +-- 1. 删除 system_code = 'authService' 的菜单记录 +-- 2. 重新生成二期菜单结构 +-- ============================================= + +-- 删除菜单类型为authService的记录 +DELETE FROM sys_menu WHERE system_code = 'authService'; + + + +-- ============================================= +-- 一级目录 (parent_id = 0, menu_type = 'M') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (10, '系统设置', 0, 1, 'system-setting', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'system', 103, 1, '2026-03-31 20:14:46', null, null, '系统设置目录', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (20, '机构与权限管理', 0, 2, 'org-permission', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'peoples', 103, 1, '2026-03-31 20:14:46', null, null, '机构与权限管理目录', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (30, '日志管理', 0, 3, 'log', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'log', 103, 1, '2026-03-31 20:14:46', null, null, '日志管理目录', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (40, '系统工具', 0, 4, 'tool', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'tool', 103, 1, '2026-03-31 20:14:46', null, null, '系统工具目录', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (50, '系统监控', 0, 5, 'monitor', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'monitor', 103, 1, '2026-03-31 20:14:46', null, null, '系统监控目录', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (60, '系统对接', 0, 6, 'integration', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'international', 103, 1, '2026-03-31 20:14:46', null, null, '系统对接目录', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (70, '系统集成模拟', 0, 7, 'system-integration-mock', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'redis', 103, 1, '2026-03-31 20:14:46', null, null, '系统集成模拟目录', 'authService', null); + +-- ============================================= +-- 系统设置 子菜单 (parent_id = 10, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (1001, '菜单管理', 10, 1, 'menu', 'system/menu/index-groupby', '', 1, 0, '#', '', 'C', '0', '0', 'system:menu:list', 'tree-table', 103, 1, '2026-03-31 20:14:46', null, null, '菜单管理菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (1002, '数据字典', 10, 2, 'dict', 'system/dict/index-manager', '', 1, 0, '#', '', 'C', '0', '0', 'system:dict:list', 'dict', 103, 1, '2026-03-31 20:14:46', null, null, '数据字典菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (1003, '参数设置', 10, 3, 'config', 'system/config/index', '', 1, 0, '#', '', 'C', '0', '0', 'system:config:list', 'edit', 103, 1, '2026-03-31 20:14:46', null, null, '参数设置菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (1004, '文件管理', 10, 4, 'oss', 'system/oss/index', '', 1, 0, '#', '', 'C', '0', '0', 'system:oss:list', 'upload', 103, 1, '2026-03-31 20:14:46', null, null, '文件管理菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (1005, '客户端管理', 10, 5, 'client', 'system/client/index', '', 1, 0, '#', '', 'C', '0', '0', 'system:client:list', 'international', 103, 1, '2026-03-31 20:14:46', null, null, '客户端管理菜单', 'authService', null); + +-- 系统设置 辅助隐藏页面 +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (1010, '字典数据', 10, 6, 'dict-data/index/:dictId', 'system/dict/data', '', 1, 1, '#', '', 'C', '1', '0', 'system:dict:list', '#', 103, 1, '2026-03-31 20:14:46', null, null, '/system/dict', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (1011, '文件配置管理', 10, 7, 'oss-config/index', 'system/oss/config', '', 1, 1, '#', '', 'C', '1', '0', 'system:ossConfig:list', '#', 103, 1, '2026-03-31 20:14:46', null, null, '/system/oss', 'authService', null); + +-- ============================================= +-- 机构与权限管理 子菜单 (parent_id = 20) +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (2001, '市认证单位与人员', 20, 1, 'auth-user', 'efcode/srz/index', '', 1, 0, '#', '', 'C', '0', '0', 'system:user:list', 'user', 103, 1, '2026-03-31 20:14:46', null, null, '市认证单位与人员菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (2002, '执法码单位与人员', 20, 2, 'efcode-org', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'tree', 103, 1, '2026-03-31 20:14:46', null, null, '执法码单位与人员目录', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (2003, '角色设置', 20, 3, 'role', 'system/role/index-dept-separate', '', 1, 0, '#', '', 'C', '0', '0', 'system:role:list', 'peoples', 103, 1, '2026-03-31 20:14:46', null, null, '角色设置菜单', 'authService', null); + +-- 执法码单位与人员 子菜单 (parent_id = 2002) +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (2010, '执法单位设置', 2002, 1, 'unitBuilder', 'efcode/virtualUnit/unitBuilder', '', 1, 0, '#', '', 'C', '0', '0', 'system:dept:list', 'tree', 103, 1, '2026-03-31 20:14:46', null, null, '执法单位设置菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (2011, '执法人员设置', 2002, 2, 'efuser', 'efcode/virtualUnit/unitUserManager', '', 1, 0, '#', '', 'C', '0', '0', 'efcode:user:list', 'user', 103, 1, '2026-03-31 20:14:46', null, null, '执法人员设置菜单', 'authService', null); + +-- 机构与权限管理 辅助隐藏页面 +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (2020, '分配用户', 20, 4, 'role-auth/user/:roleId', 'system/role/authUser', '', 1, 1, '#', '', 'C', '1', '0', 'system:role:edit', '#', 103, 1, '2026-03-31 20:14:46', null, null, '/system/role', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (2021, '分配角色', 20, 5, 'user-auth/role/:userId', 'system/user/authRole', '', 1, 1, '#', '', 'C', '1', '0', 'system:user:edit', '#', 103, 1, '2026-03-31 20:14:46', null, null, '/system/user', 'authService', null); + +-- ============================================= +-- 日志管理 子菜单 (parent_id = 30, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (3001, '操作日志', 30, 1, 'operlog', 'monitor/operlog/index', '', 1, 0, '#', '', 'C', '0', '0', 'monitor:operlog:list', 'form', 103, 1, '2026-03-31 20:14:46', null, null, '操作日志菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (3002, '登陆日志', 30, 2, 'logininfor', 'monitor/logininfor/index', '', 1, 0, '#', '', 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 103, 1, '2026-03-31 20:14:46', null, null, '登陆日志菜单', 'authService', null); + +-- ============================================= +-- 系统工具 子菜单 (parent_id = 40, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (4001, '代码生成', 40, 1, 'gen', 'tool/gen/index', '', 1, 0, '#', '', 'C', '0', '0', 'tool:gen:list', 'code', 103, 1, '2026-03-31 20:14:46', null, null, '代码生成菜单', 'authService', null); + +-- 系统工具 辅助隐藏页面 +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (4010, '修改生成配置', 40, 2, 'gen-edit/index/:tableId', 'tool/gen/editTable', '', 1, 1, '#', '', 'C', '1', '0', 'tool:gen:edit', '#', 103, 1, '2026-03-31 20:14:46', null, null, '/tool/gen', 'authService', null); + +-- ============================================= +-- 系统监控 子菜单 (parent_id = 50, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (5001, '任务调度', 50, 1, 'quartz', 'system/quartz/index', '', 1, 0, '#', '', 'C', '0', '0', 'monitor:snailjob:list', 'job', 103, 1, '2026-03-31 20:14:46', null, null, '任务调度菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (5002, '缓存监控', 50, 2, 'cache', 'monitor/cache/index', '', 1, 0, '#', '', 'C', '0', '0', 'monitor:cache:list', 'redis', 103, 1, '2026-03-31 20:14:46', null, null, '缓存监控菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (5003, '在线认证用户', 50, 3, 'online-auth', 'monitor/online/index', '', 1, 0, '#', '', 'C', '0', '0', 'monitor:online:list', 'online', 103, 1, '2026-03-31 20:14:46', null, null, '在线认证用户菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (5004, '在线企业用户', 50, 4, 'online-enterprise', 'monitor/online/index', '', 1, 0, '#', '', 'C', '0', '0', 'monitor:online:enterprise', 'online', 103, 1, '2026-03-31 20:14:46', null, null, '在线企业用户菜单', 'authService', null); + +-- ============================================= +-- 系统对接 子菜单 (parent_id = 60, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6001, '密钥管理', 60, 1, 'secret-key', 'efcode/secretkey/index', '', 1, 0, '#', '', 'C', '0', '0', 'efcode:secretkey:list', 'validCode', 103, 1, '2026-03-31 20:14:46', null, null, '密钥管理菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6002, '接口管理', 60, 2, 'api-manage', 'efcode/api/index', '', 1, 0, '#', '', 'C', '0', '0', 'efcode:api:list', 'swagger', 103, 1, '2026-03-31 20:14:46', null, null, '接口管理菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6003, '前置库', 60, 3, 'front-db', 'efcode/frontdb/index', '', 1, 0, '#', '', 'C', '0', '0', 'efcode:frontdb:list', 'server', 103, 1, '2026-03-31 20:14:46', null, null, '前置库菜单', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6004, 'DataX任务', 60, 4, 'datax', 'efcode/datax/index', '', 1, 0, '#', '', 'C', '0', '0', 'efcode:datax:list', 'job', 103, 1, '2026-03-31 20:14:46', null, null, 'DataX任务菜单', 'authService', null); + +-- ============================================= +-- 系统集成模拟 子菜单 (parent_id = 70, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (7001, '深i企模拟集成', 70, 1, 'integrationmock-siq', 'efcode/integrationmock/siq/index', '', 1, 0, '#', '', 'C', '0', '0', 'integration:siq:list', '#', 103, 1, '2026-03-31 20:14:46', null, null, '深i企模拟集成', 'authService', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (7002, '深政易模拟集成', 70, 2, 'integrationmock-szy', 'efcode/integrationmock/szy/index', '', 1, 0, '#', '', 'C', '0', '0', 'integration:szy:list', '#', 103, 1, '2026-03-31 20:14:46', null, null, '深政易模拟集成', 'authService', null); + + +-- ... existing code ... + +-- ============================================= +-- 监管端菜单结构 (system_code = 'supervisionCode') +-- 一级目录 ID 从 600 开始 +-- ============================================= + +-- 删除旧的 supervisionCode 菜单记录(如有需要可取消注释) +DELETE FROM sys_menu WHERE system_code = 'supervisionCode'; + +-- ============================================= +-- 一级目录 (parent_id = 0, menu_type = 'M') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (600, '统计查询', 0, 1, 'statistics', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'chart', 103, 1, '2026-05-15 00:00:00', null, null, '统计查询目录', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (610, '工作报表', 0, 2, 'work-report', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'form', 103, 1, '2026-05-15 00:00:00', null, null, '工作报表目录', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (620, '报表趋势', 0, 3, 'report-trend', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'monitor', 103, 1, '2026-05-15 00:00:00', null, null, '报表趋势目录', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (630, '综合管理', 0, 4, 'general-manage', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'system', 103, 1, '2026-05-15 00:00:00', null, null, '综合管理目录', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (640, '计划管理', 0, 5, 'plan-manage', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'date', 103, 1, '2026-05-15 00:00:00', null, null, '计划管理目录', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (650, '任务管理', 0, 6, 'task-manage', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'job', 103, 1, '2026-05-15 00:00:00', null, null, '任务管理目录', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (660, '预约管理', 0, 7, 'appointment-manage', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'time-range', 103, 1, '2026-05-15 00:00:00', null, null, '预约管理目录', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (670, '预告管理', 0, 8, 'notice-manage', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'message', 103, 1, '2026-05-15 00:00:00', null, null, '预告管理目录', 'supervisionCode', null); + +-- ============================================= +-- 统计查询 子目录 (parent_id = 600, menu_type = 'M') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6100, '行政执法', 600, 1, 'administrative', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'list', 103, 1, '2026-05-15 00:00:00', null, null, '行政执法目录', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6200, '非行政执法', 600, 2, 'non-administrative', null, '', 1, 0, '#', '', 'M', '0', '0', '', 'list', 103, 1, '2026-05-15 00:00:00', null, null, '非行政执法目录', 'supervisionCode', null); + +-- ============================================= +-- 行政执法 子菜单 (parent_id = 6100, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6101, '涉企执法情况(2)', 6100, 1, 'enterprise-enforcement', 'efcode/report/registration/index', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:statistics:enterpriseEnforcement', '#', 103, 1, '2026-05-15 00:00:00', null, null, '涉企执法情况菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6102, '企业受检次数(4)', 6100, 2, 'enterprise-inspection', '', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:statistics:enterpriseInspection', '#', 103, 1, '2026-05-15 00:00:00', null, null, '企业受检次数菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6103, '企业信息情况(5)', 6100, 3, 'enterprise-info', '', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:statistics:enterpriseInfo', '#', 103, 1, '2026-05-15 00:00:00', null, null, '企业信息情况菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6104, '执法单位情况(5)', 6100, 4, 'enforcement-unit', '', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:statistics:enforcementUnit', '#', 103, 1, '2026-05-15 00:00:00', null, null, '执法单位情况菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6105, '执法投诉情况(4)', 6100, 5, 'enforcement-complaint', '', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:statistics:enforcementComplaint', '#', 103, 1, '2026-05-15 00:00:00', null, null, '执法投诉情况菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6106, '检查计划情况(5)', 6100, 6, 'inspection-plan', '', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:statistics:inspectionPlan', '#', 103, 1, '2026-05-15 00:00:00', null, null, '检查计划情况菜单', 'supervisionCode', null); + +-- ============================================= +-- 非行政执法 子菜单 (parent_id = 6200, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6201, '非行政执法(3)', 6200, 1, 'non-administrative-list', 'supervision/statistics/nonAdministrative', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:statistics:nonAdministrative', '#', 103, 1, '2026-05-15 00:00:00', null, null, '非行政执法菜单', 'supervisionCode', null); + +-- 工作报表 子菜单 (parent_id = 610, menu_type = 'C') +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6111, '执法分析(1)', 610, 1, 'enforcement-analysis', 'efcode/report/registration_statistics/index', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:report:enforcementAnalysis', '#', 103, 1, '2026-05-15 00:00:00', null, null, '执法分析菜单', 'supervisionCode', null); + +-- ============================================= +-- 综合管理 子菜单 (parent_id = 630, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6301, '普法服务', 630, 1, 'law-service', 'supervision/general/lawService', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:general:lawService', '#', 103, 1, '2026-05-15 00:00:00', null, null, '普法服务菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6302, '轮播图管理', 630, 2, 'carousel', 'supervision/general/carousel', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:general:carousel', '#', 103, 1, '2026-05-15 00:00:00', null, null, '轮播图管理菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6303, '公告管理', 630, 3, 'announcement', 'supervision/general/announcement', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:general:announcement', '#', 103, 1, '2026-05-15 00:00:00', null, null, '公告管理菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6304, '送码入企', 630, 4, 'send-code', 'efcode/enterprise_pub_qrcode/index', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:general:sendCode', '#', 103, 1, '2026-05-15 00:00:00', null, null, '送码入企菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6305, '送码入企查询', 630, 5, 'send-code-query', 'efcode/enterprise_pub_qrcode/indexForQuery', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:general:sendCodeQuery', '#', 103, 1, '2026-05-15 00:00:00', null, null, '送码入企查询菜单', 'supervisionCode', null); + +-- ============================================= +-- 计划管理 子菜单 (parent_id = 640, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6401, '其他计划', 640, 1, 'other-plan', 'supervision/plan/otherPlan', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:plan:otherPlan', '#', 103, 1, '2026-05-15 00:00:00', null, null, '其他计划菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6402, '我的计划', 640, 2, 'my-plan', 'supervision/plan/myPlan', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:plan:myPlan', '#', 103, 1, '2026-05-15 00:00:00', null, null, '我的计划菜单', 'supervisionCode', null); + +-- ============================================= +-- 任务管理 子菜单 (parent_id = 650, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6501, '我的任务', 650, 1, 'my-task', 'supervision/task/myTask', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:task:myTask', '#', 103, 1, '2026-05-15 00:00:00', null, null, '我的任务菜单', 'supervisionCode', null); + +-- ============================================= +-- 预约管理 子菜单 (parent_id = 660, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6601, '手动预约', 660, 1, 'manual-appointment', 'supervision/appointment/manual', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:appointment:manual', '#', 103, 1, '2026-05-15 00:00:00', null, null, '手动预约菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6602, '系统匹配', 660, 2, 'system-match', 'supervision/appointment/systemMatch', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:appointment:systemMatch', '#', 103, 1, '2026-05-15 00:00:00', null, null, '系统匹配菜单', 'supervisionCode', null); + +-- ============================================= +-- 预告管理 子菜单 (parent_id = 670, menu_type = 'C') +-- ============================================= + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6701, '待执行预告', 670, 1, 'pending-notice', 'supervision/notice/pending', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:notice:pending', '#', 103, 1, '2026-05-15 00:00:00', null, null, '待执行预告菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6702, '历史预告', 670, 2, 'history-notice', 'supervision/notice/history', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:notice:history', '#', 103, 1, '2026-05-15 00:00:00', null, null, '历史预告菜单', 'supervisionCode', null); +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, url, target, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark, system_code, type) VALUES (6703, '草稿箱', 670, 3, 'draft', 'supervision/notice/draft', '', 1, 0, '#', '', 'C', '0', '0', 'supervision:notice:draft', '#', 103, 1, '2026-05-15 00:00:00', null, null, '草稿箱菜单', 'supervisionCode', null); diff --git a/zdxt-modules/zdxt-enforcement-code-common/src/main/java/com/zdxt/enforcementcode/common/annotation/EfcodeDataFilterInterceptor.java b/zdxt-modules/zdxt-enforcement-code-common/src/main/java/com/zdxt/enforcementcode/common/annotation/EfcodeDataFilterInterceptor.java index 7efdd1ee..56bb8631 100644 --- a/zdxt-modules/zdxt-enforcement-code-common/src/main/java/com/zdxt/enforcementcode/common/annotation/EfcodeDataFilterInterceptor.java +++ b/zdxt-modules/zdxt-enforcement-code-common/src/main/java/com/zdxt/enforcementcode/common/annotation/EfcodeDataFilterInterceptor.java @@ -68,7 +68,7 @@ public class EfcodeDataFilterInterceptor implements InnerInterceptor { * @return SQL 片段;null 表示全部放行;非 null 字符串追加到 WHERE */ private String buildFilterSql(EfcodeDataFilter filter) { - return DataFilterUtil.buildFilterSql( + return DataFilterUtil.buildFilterSqlV2( filter.tableAlias(), filter.column(), filter.includeSearch(), filter.includeStatistics() ); diff --git a/zdxt-modules/zdxt-enforcement-code-common/src/main/java/com/zdxt/enforcementcode/common/util/DataFilterUtil.java b/zdxt-modules/zdxt-enforcement-code-common/src/main/java/com/zdxt/enforcementcode/common/util/DataFilterUtil.java index 5d0618d3..b09bc2c2 100644 --- a/zdxt-modules/zdxt-enforcement-code-common/src/main/java/com/zdxt/enforcementcode/common/util/DataFilterUtil.java +++ b/zdxt-modules/zdxt-enforcement-code-common/src/main/java/com/zdxt/enforcementcode/common/util/DataFilterUtil.java @@ -15,6 +15,7 @@ import org.dromara.common.core.service.UserService; import org.dromara.common.core.utils.SpringUtils; import org.dromara.common.satoken.utils.LoginHelper; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; @@ -237,6 +238,11 @@ public class DataFilterUtil { .collect(Collectors.toList()); } + // ======================== 角色前缀常量 ======================== + + /** ViewEFDataRole_Area 角色前缀(role_key 格式: ViewEFDataRole_Area:Area_XxxXxx) */ + public static final String ROLE_VIEW_EF_DATA_AREA_PREFIX = "ViewEFDataRole_Area:"; + // ======================== SQL 过滤条件构建方法 ======================== /** @@ -308,6 +314,100 @@ public class DataFilterUtil { return "1 = 0"; } + /** + * 根据当前用户权限,构建数据过滤 SQL 片段(V2 版本)。 + *

+ * 与 V1 的区别:增加对 ViewEFDataRole_Area 角色的支持。 + *

+ * + * @param tableAlias 业务表别名(如 "t"、"e" 等),为空则不使用别名 + * @param column 业务表中用于匹配 sys_dept_id 的列名,默认 "bureau_dept_id" + * @param includeSearch 是否包含查询节点 + * @param includeStatistics 是否包含统计节点 + * @return SQL 片段;null 表示全部放行;非 null 则为过滤条件 + */ + public static String buildFilterSqlV2(String tableAlias, String column, + boolean includeSearch, boolean includeStatistics) { + // 超管或 ViewAllDataRole → 不过滤 + if (isFullAccess()) { + return null; + } + + // ViewFilterDataRole → 构建子查询条件 + if (needFilter()) { + // 获取用户拥有的 ViewEFDataRole_Area 角色对应的 vir_id 列表 + List areaVirIds = getAreaRoleVirIds(); + + List bureauDeptIds; + if (CollUtil.isNotEmpty(areaVirIds)) { + // 通过 vir_id 获取对应的 sys_dept_id + bureauDeptIds = getAreaBureauDeptIds(areaVirIds); + } else { + // 未拥有 ViewEFDataRole_Area 角色,退回原逻辑 + String userBureauDeptId = getUserBureauDeptId(LoginHelper.getUserId()); + if (StrUtil.isBlank(userBureauDeptId)) { + return "1 = 0"; + } + bureauDeptIds = Collections.singletonList(userBureauDeptId); + } + + if (CollUtil.isEmpty(bureauDeptIds)) { + return "1 = 0"; + } + + String columnRef = buildColumnRef(tableAlias, column); + + // 构建过滤 SQL:支持多个 bureauDeptId + StringBuilder sb = new StringBuilder(); + sb.append("("); + for (int i = 0; i < bureauDeptIds.size(); i++) { + if (i > 0) { + sb.append(" OR "); + } + String escapedDeptId = escapeSql(bureauDeptIds.get(i)); + // 子查询:通过 userBureauDeptId 找到 virId,再通过 FIND_IN_SET 查子孙节点的 sys_dept_id + sb.append(columnRef).append(" IN ("); + sb.append("SELECT eu.sys_dept_id FROM efcode_virtual_unit eu"); + sb.append(" WHERE FIND_IN_SET("); + sb.append("(SELECT eu2.vir_id FROM efcode_virtual_unit eu2 WHERE eu2.sys_dept_id = '").append(escapedDeptId).append("' LIMIT 1)"); + sb.append(", eu.vir_ancestors)"); + sb.append(" AND eu.sys_dept_id IS NOT NULL AND eu.sys_dept_id != ''"); + + // includeSearch / includeStatistics 过滤条件 + if (includeSearch || includeStatistics) { + sb.append(" AND (1=0"); + if (includeSearch) { + sb.append(" OR eu.vir_include_search = '是'"); + } + if (includeStatistics) { + sb.append(" OR eu.vir_include_statistics = '是'"); + } + sb.append(")"); + } + sb.append(")"); + + // 补充自身部门 + sb.append(" OR ").append(columnRef).append(" = '").append(escapedDeptId).append("'"); + } + sb.append(")"); + + return sb.toString(); + } + + // 无权访问 + return "1 = 0"; + } + /** * 使用默认列名 "bureau_dept_id" 构建数据过滤 SQL 片段。 * @@ -317,7 +417,7 @@ public class DataFilterUtil { * @return SQL 片段;null 表示全部放行;非 null 则为过滤条件 */ public static String buildFilterSql(String tableAlias, boolean includeSearch, boolean includeStatistics) { - return buildFilterSql(tableAlias, "bureau_dept_id", includeSearch, includeStatistics); + return buildFilterSqlV2(tableAlias, "bureau_dept_id", includeSearch, includeStatistics); } /** @@ -328,7 +428,7 @@ public class DataFilterUtil { * @return SQL 片段;null 表示全部放行;非 null 则为过滤条件 */ public static String buildFilterSql(boolean includeSearch, boolean includeStatistics) { - return buildFilterSql("", "bureau_dept_id", includeSearch, includeStatistics); + return buildFilterSqlV2("", "bureau_dept_id", includeSearch, includeStatistics); } /** @@ -541,6 +641,56 @@ public class DataFilterUtil { // ======================== 私有辅助方法 ======================== + /** + * 从当前用户的角色权限中提取 ViewEFDataRole_Area 角色对应的 vir_id 列表。 + *

+ * 例如角色 role_key 为 "ViewEFDataRole_Area:Area_FuTianQu", + * 则提取出 "Area_FuTianQu" 作为 efcode_virtual_unit 的 vir_id。 + * + * @return vir_id 列表;如果用户未拥有相关角色则返回空列表 + */ + private static List getAreaRoleVirIds() { + LoginUser user = LoginHelper.getLoginUser(); + if (user == null) { + return Collections.emptyList(); + } + Set rolePermission = user.getRolePermission(); + if (CollUtil.isEmpty(rolePermission)) { + return Collections.emptyList(); + } + return rolePermission.stream() + .filter(rk -> rk != null && rk.startsWith(ROLE_VIEW_EF_DATA_AREA_PREFIX)) + .map(rk -> rk.substring(ROLE_VIEW_EF_DATA_AREA_PREFIX.length())) + .filter(StrUtil::isNotBlank) + .distinct() + .collect(Collectors.toList()); + } + + /** + * 根据 ViewEFDataRole_Area 角色提取的 vir_id 列表,查询对应的 sys_dept_id 列表。 + *

+ * 通过 IEfcodeVirtualUnitService.queryById(virId) 获取 sys_dept_id。 + * + * @param areaVirIds vir_id 列表(如 ["Area_FuTianQu", "Area_LuoHuQu"]) + * @return 对应的 sys_dept_id 列表(已去重,排除空值) + */ + private static List getAreaBureauDeptIds(List areaVirIds) { + if (CollUtil.isEmpty(areaVirIds)) { + return Collections.emptyList(); + } + IEfcodeVirtualUnitService service = SpringUtils.getBean(IEfcodeVirtualUnitService.class); + List deptIds = new ArrayList<>(); + for (String virId : areaVirIds) { + EfcodeVirtualUnitVo vo = service.queryById(virId); + if (vo != null && StrUtil.isNotBlank(vo.getSysDeptId())) { + if (!deptIds.contains(vo.getSysDeptId())) { + deptIds.add(vo.getSysDeptId()); + } + } + } + return deptIds; + } + /** * 构建列引用(支持表别名) */