-- ============================================================
-- 职业指导服务 - 修正版菜单与权限插入 SQL (达梦 DM8 适配)
-- 修复说明：之前使用的 ID (如 178060100000031) 已被“见习岗位管理”占用
-- 现在使用全新的号段 1780603... 确保绝对不冲突
-- ============================================================

-- 0. 先清理之前可能插入的错误层级和权限关联
DELETE FROM ZJRS_JEECG_BOOT.SYS_ROLE_PERMISSION WHERE PERMISSION_ID IN ('178060300000000', '178060300000001', '178060300000002', '178060300000003');
DELETE FROM ZJRS_JEECG_BOOT.SYS_PERMISSION WHERE ID IN ('178060300000000', '178060300000001', '178060300000002', '178060300000003');

-- 1. 一级菜单：职业指导服务 (新ID: 178060300000000)
INSERT INTO ZJRS_JEECG_BOOT.SYS_PERMISSION (ID, PARENT_ID, NAME, URL, COMPONENT, IS_ROUTE, COMPONENT_NAME, REDIRECT, MENU_TYPE, PERMS, PERMS_TYPE, SORT_NO, ALWAYS_SHOW, ICON, IS_LEAF, KEEP_ALIVE, HIDDEN, HIDE_TAB, DESCRIPTION, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, DEL_FLAG, RULE_FLAG, STATUS, INTERNAL_OR_EXTERNAL)
VALUES ('178060300000000', NULL, '职业指导服务', '/careerguidance', 'layouts/default/index', 1, NULL, '/careerguidance/document', 0, NULL, '1', 3.00, 0, 'ant-design:book-outlined', 0, 1, 0, 0, NULL, 'admin', SYSDATE, NULL, NULL, 0, 0, 1, 0);

-- 2. 二级菜单：职业指导公开文件 (新ID: 178060300000001)
INSERT INTO ZJRS_JEECG_BOOT.SYS_PERMISSION (ID, PARENT_ID, NAME, URL, COMPONENT, IS_ROUTE, COMPONENT_NAME, REDIRECT, MENU_TYPE, PERMS, PERMS_TYPE, SORT_NO, ALWAYS_SHOW, ICON, IS_LEAF, KEEP_ALIVE, HIDDEN, HIDE_TAB, DESCRIPTION, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, DEL_FLAG, RULE_FLAG, STATUS, INTERNAL_OR_EXTERNAL)
VALUES ('178060300000001', '178060300000000', '职业指导公开文件', '/careerguidance/document', 'careerguidancedocument/CareerGuidanceDocumentList', 1, 'CareerGuidanceDocumentList', NULL, 1, 'careerguidancedocument:list', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'admin', SYSDATE, NULL, NULL, 0, 0, 1, 0);

-- 3. 二级菜单：职业指导专家库 (新ID: 178060300000002)
INSERT INTO ZJRS_JEECG_BOOT.SYS_PERMISSION (ID, PARENT_ID, NAME, URL, COMPONENT, IS_ROUTE, COMPONENT_NAME, REDIRECT, MENU_TYPE, PERMS, PERMS_TYPE, SORT_NO, ALWAYS_SHOW, ICON, IS_LEAF, KEEP_ALIVE, HIDDEN, HIDE_TAB, DESCRIPTION, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, DEL_FLAG, RULE_FLAG, STATUS, INTERNAL_OR_EXTERNAL)
VALUES ('178060300000002', '178060300000000', '职业指导专家库', '/careerguidance/expert', 'careerguidanceexpert/CareerGuidanceExpertList', 1, 'CareerGuidanceExpertList', NULL, 1, 'careerguidanceexpert:list', '1', 2.00, 0, NULL, 1, 1, 0, 0, NULL, 'admin', SYSDATE, NULL, NULL, 0, 0, 1, 0);

-- 4. 二级菜单：职业指导服务管理 (新ID: 178060300000003)
INSERT INTO ZJRS_JEECG_BOOT.SYS_PERMISSION (ID, PARENT_ID, NAME, URL, COMPONENT, IS_ROUTE, COMPONENT_NAME, REDIRECT, MENU_TYPE, PERMS, PERMS_TYPE, SORT_NO, ALWAYS_SHOW, ICON, IS_LEAF, KEEP_ALIVE, HIDDEN, HIDE_TAB, DESCRIPTION, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, DEL_FLAG, RULE_FLAG, STATUS, INTERNAL_OR_EXTERNAL)
VALUES ('178060300000003', '178060300000000', '职业指导服务管理', '/careerguidance/service', 'careerguidanceservice/CareerGuidanceServiceList', 1, 'CareerGuidanceServiceList', NULL, 1, 'careerguidanceservice:list', '1', 3.00, 0, NULL, 1, 1, 0, 0, NULL, 'admin', SYSDATE, NULL, NULL, 0, 0, 1, 0);

-- ============================================================
-- 5. 直接给 admin 角色授权新 ID
-- ============================================================

INSERT INTO ZJRS_JEECG_BOOT.SYS_ROLE_PERMISSION (ID, ROLE_ID, PERMISSION_ID, DATA_RULE_IDS, OPERATE_DATE, OPERATE_IP) 
VALUES ('178060300000000_admin', 'f6817f48af4fb3af11b9e8bf182f618b', '178060300000000', NULL, SYSDATE, '127.0.0.1');

INSERT INTO ZJRS_JEECG_BOOT.SYS_ROLE_PERMISSION (ID, ROLE_ID, PERMISSION_ID, DATA_RULE_IDS, OPERATE_DATE, OPERATE_IP) 
VALUES ('178060300000001_admin', 'f6817f48af4fb3af11b9e8bf182f618b', '178060300000001', NULL, SYSDATE, '127.0.0.1');

INSERT INTO ZJRS_JEECG_BOOT.SYS_ROLE_PERMISSION (ID, ROLE_ID, PERMISSION_ID, DATA_RULE_IDS, OPERATE_DATE, OPERATE_IP) 
VALUES ('178060300000002_admin', 'f6817f48af4fb3af11b9e8bf182f618b', '178060300000002', NULL, SYSDATE, '127.0.0.1');

INSERT INTO ZJRS_JEECG_BOOT.SYS_ROLE_PERMISSION (ID, ROLE_ID, PERMISSION_ID, DATA_RULE_IDS, OPERATE_DATE, OPERATE_IP) 
VALUES ('178060300000003_admin', 'f6817f48af4fb3af11b9e8bf182f618b', '178060300000003', NULL, SYSDATE, '127.0.0.1');
