From 667f1e993ca482227f5099d7b3e0faf994ecd5e4 Mon Sep 17 00:00:00 2001 From: zlwu <704541015@qq.com> Date: Fri, 12 Jun 2026 19:46:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(db):=20=E6=B7=BB=E5=8A=A05=E4=B8=AA?= =?UTF-8?q?=E4=B8=80=E7=BA=A7=E8=8F=9C=E5=8D=95=E5=88=B0sys=5Fmenu?= =?UTF-8?q?=E8=A1=A8=E7=9A=84SQL=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- docs/sql/menu_restructuring.sql | 66 +++++++++++++++++---------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/docs/sql/menu_restructuring.sql b/docs/sql/menu_restructuring.sql index 36c60e52..ae047214 100644 --- a/docs/sql/menu_restructuring.sql +++ b/docs/sql/menu_restructuring.sql @@ -1,34 +1,36 @@ -/* - 菜单重组 - 插入一级菜单分组 - 用于 sys_menu 表插入 5 个新的一级目录 - 执行前请确认当前 tenant_no = 'zkxw' -*/ +-- ===================================================== +-- 菜单结构调整:插入 5 个一级菜单到 sys_menu 表 +-- 执行时间:2026-06-12 +-- 说明:新增 5 个一级菜单(市场、生产、质检、运营支撑、系统管理) +-- ===================================================== --- ---------------------------- --- 插入新的一级菜单(市场、生产、质检、运营支撑、系统管理) --- ---------------------------- +-- 一级菜单 +INSERT INTO sys_menu (id, menu_name, parent_id, menu_type, path, component, perms, is_frame, visible, status, tenant_no, order_num, create_by, create_dept_id, create_time, update_by, update_time, del_flag) VALUES +('TOP00000000000000000000000000001', '市场', '0', 'M', '/market', '/index/index', 'menu:market', 1, '1', '1', 'zkxw', 1, 'system', '', NOW(), 'system', NOW(), 0), +('TOP00000000000000000000000000002', '生产', '0', 'M', '/production-group', '/index/index', 'menu:production', 1, '1', '1', 'zkxw', 2, 'system', '', NOW(), 'system', NOW(), 0), +('TOP00000000000000000000000000003', '质检', '0', 'M', '/quality-group', '/index/index', 'menu:quality', 1, '1', '1', 'zkxw', 3, 'system', '', NOW(), 'system', NOW(), 0), +('TOP00000000000000000000000000004', '运营支撑', '0', 'M', '/operations-group', '/index/index', 'menu:operations', 1, '1', '1', 'zkxw', 4, 'system', '', NOW(), 'system', NOW(), 0), +('TOP00000000000000000000000000005', '系统管理', '0', 'M', '/system-manage', '/index/index', 'menu:system-manage', 1, '1', '1', 'zkxw', 5, 'system', '', NOW(), 'system', NOW(), 0); --- 市场 -INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `menu_type`, `path`, `component`, `perms`, `is_frame`, `visible`, `status`, `tenant_no`, `order_num`, `remark`, `create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`) -VALUES ('TOP00000000000000000000000000001', '市场', '0', 'M', '/market', NULL, 'menu:market', 1, '1', '1', 'zkxw', 1, '市场分组', 'system', '', NOW(), NULL, NOW(), 0); - --- 生产 -INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `menu_type`, `path`, `component`, `perms`, `is_frame`, `visible`, `status`, `tenant_no`, `order_num`, `remark`, `create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`) -VALUES ('TOP00000000000000000000000000002', '生产', '0', 'M', '/production-group', NULL, 'menu:production', 1, '1', '1', 'zkxw', 2, '生产分组', 'system', '', NOW(), NULL, NOW(), 0); - --- 质检 -INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `menu_type`, `path`, `component`, `perms`, `is_frame`, `visible`, `status`, `tenant_no`, `order_num`, `remark`, `create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`) -VALUES ('TOP00000000000000000000000000003', '质检', '0', 'M', '/quality-group', NULL, 'menu:quality', 1, '1', '1', 'zkxw', 3, '质检分组', 'system', '', NOW(), NULL, NOW(), 0); - --- 运营支撑 -INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `menu_type`, `path`, `component`, `perms`, `is_frame`, `visible`, `status`, `tenant_no`, `order_num`, `remark`, `create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`) -VALUES ('TOP00000000000000000000000000004', '运营支撑', '0', 'M', '/operations-group', NULL, 'menu:operations', 1, '1', '1', 'zkxw', 4, '运营支撑分组', 'system', '', NOW(), NULL, NOW(), 0); - --- 系统管理 -INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `menu_type`, `path`, `component`, `perms`, `is_frame`, `visible`, `status`, `tenant_no`, `order_num`, `remark`, `create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`) -VALUES ('TOP00000000000000000000000000005', '系统管理', '0', 'M', '/system-manage', NULL, 'menu:system-manage', 1, '1', '1', 'zkxw', 5, '系统管理分组', 'system', '', NOW(), NULL, NOW(), 0); - --- ---------------------------- --- 验证查询 --- ---------------------------- --- SELECT * FROM sys_menu WHERE id LIKE 'TOP%'; +-- ===================================================== +-- 注意事项: +-- 1. 执行前请确认 tenant_no 是否正确 +-- 2. 如果需要为超级管理员角色分配这些菜单权限,请执行以下 SQL: +-- +-- -- 假设 super_admin 角色的 id 为 '1',根据实际情况调整 +-- INSERT INTO sys_role_menu (id, role_id, menu_id, tenant_no, order_num, create_by, create_dept_id, create_time, update_by, update_time, del_flag) +-- SELECT +-- REPLACE(UUID(), '-', ''), +-- '1', -- 替换为实际的超级管理员角色ID +-- id, +-- tenant_no, +-- order_num, +-- 'system', +-- '', +-- NOW(), +-- 'system', +-- NOW(), +-- 0 +-- FROM sys_menu +-- WHERE menu_type = 'M' AND parent_id = '0' AND del_flag = 0; +-- =====================================================