-- =====================================================
-- 菜单调整：应用管理改为目录，下挂 应用列表 + 接口字典（幂等，可重复执行）
-- 适用：已存在旧版「应用管理」单页菜单的环境，无需重跑全量 pangu_menu.sql
-- =====================================================

-- 1. 应用管理改为目录（M），去掉 component
UPDATE sys_menu SET menu_type = 'M', component = NULL, perms = '' WHERE menu_id = 2300;

-- 2. 新增「应用列表」二级菜单（若不存在）
INSERT IGNORE INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time)
VALUES (2307, '应用列表', 2300, 1, 'list', 'business/application/index', '', 1, 0, 'C', '0', '0', 'business:application:list', '#', 103, 1, NOW());

-- 3. 应用相关按钮归属到「应用列表」下
UPDATE sys_menu SET parent_id = 2307 WHERE menu_id IN (2301, 2302, 2303, 2304, 2305, 2306);

-- 4. 新增「接口字典」二级菜单（若不存在）
INSERT IGNORE INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time)
VALUES (2310, '接口字典', 2300, 2, 'apiDict', 'business/apiDict/index', '', 1, 0, 'C', '0', '0', 'business:apiDict:list', 'list', 103, 1, NOW());

-- 5. 接口字典按钮（若不存在）
INSERT IGNORE INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query_param, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time) VALUES
(2311, '接口字典查询', 2310, 1, '', '', '', 1, 0, 'F', '0', '0', 'business:apiDict:query', '#', 103, 1, NOW()),
(2312, '接口字典新增', 2310, 2, '', '', '', 1, 0, 'F', '0', '0', 'business:apiDict:add', '#', 103, 1, NOW()),
(2313, '接口字典修改', 2310, 3, '', '', '', 1, 0, 'F', '0', '0', 'business:apiDict:edit', '#', 103, 1, NOW()),
(2314, '接口字典删除', 2310, 4, '', '', '', 1, 0, 'F', '0', '0', 'business:apiDict:remove', '#', 103, 1, NOW());
