-- V14__Fix_menu_data.sql
-- 清理测试菜单数据
DELETE FROM sys_menu WHERE menu_name LIKE '%测试%' OR menu_name LIKE '%回归%';

-- 插入一级菜单
INSERT INTO sys_menu (menu_name, parent_id, order_num, menu_type, status, created_at, updated_at) VALUES
('系统管理', 0, 1, 'M', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('系统监控', 0, 2, 'M', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('审计日志', 0, 3, 'M', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

-- 插入二级菜单（系统管理下）
INSERT INTO sys_menu (menu_name, parent_id, order_num, menu_type, component, perms, status, created_at, updated_at) VALUES
('用户管理', (SELECT id FROM sys_menu WHERE menu_name = '系统管理' AND parent_id = 0), 1, 'C', 'system/user/index', 'system:user:list', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('角色管理', (SELECT id FROM sys_menu WHERE menu_name = '系统管理' AND parent_id = 0), 2, 'C', 'system/role/index', 'system:role:list', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('菜单管理', (SELECT id FROM sys_menu WHERE menu_name = '系统管理' AND parent_id = 0), 3, 'C', 'system/menu/index', 'system:menu:list', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('参数配置', (SELECT id FROM sys_menu WHERE menu_name = '系统管理' AND parent_id = 0), 4, 'C', 'system/config/index', 'system:config:list', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('字典管理', (SELECT id FROM sys_menu WHERE menu_name = '系统管理' AND parent_id = 0), 5, 'C', 'system/dict/index', 'system:dict:list', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

-- 插入二级菜单（系统监控下）
INSERT INTO sys_menu (menu_name, parent_id, order_num, menu_type, component, perms, status, created_at, updated_at) VALUES
('文件管理', (SELECT id FROM sys_menu WHERE menu_name = '系统监控' AND parent_id = 0), 1, 'C', 'system/file/index', 'system:file:list', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('通知公告', (SELECT id FROM sys_menu WHERE menu_name = '系统监控' AND parent_id = 0), 2, 'C', 'system/notice/index', 'system:notice:list', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

-- 插入二级菜单（审计日志下）
INSERT INTO sys_menu (menu_name, parent_id, order_num, menu_type, component, perms, status, created_at, updated_at) VALUES
('登录日志', (SELECT id FROM sys_menu WHERE menu_name = '审计日志' AND parent_id = 0), 1, 'C', 'audit/login/index', 'audit:login:list', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('操作日志', (SELECT id FROM sys_menu WHERE menu_name = '审计日志' AND parent_id = 0), 2, 'C', 'audit/operation/index', 'audit:operation:list', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('异常日志', (SELECT id FROM sys_menu WHERE menu_name = '审计日志' AND parent_id = 0), 3, 'C', 'audit/exception/index', 'audit:exception:list', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
