-- ============================================================
-- 就业一湛通服务平台 - 就业援助模块 菜单权限SQL（达梦数据库版）
-- 菜单层级：就业援助 > 初步符合条件人员 / 就业援助管理
-- 注意：达梦保留字 name/description/status 用双引号包围
-- ============================================================

-- ============================================================
-- 清理旧数据（兼容重复执行）
-- 必须先删角色授权，再删按钮权限，最后删菜单
-- ============================================================
-- 1. 删除已插入的角色授权
DELETE FROM sys_role_permission WHERE permission_id IN (
    '178060100000200', '178060100000210', '178060100000220',
    '178060100000211', '178060100000212', '178060100000213',
    '178060100000214', '178060100000215', '178060100000216',
    '178060100000221', '178060100000222', '178060100000223',
    '178060100000224', '178060100000225', '178060100000226'
);

-- 2. 删除已插入的按钮权限
DELETE FROM sys_permission WHERE id IN (
    '178060100000211', '178060100000212', '178060100000213',
    '178060100000214', '178060100000215', '178060100000216',
    '178060100000221', '178060100000222', '178060100000223',
    '178060100000224', '178060100000225', '178060100000226'
);

-- 3. 删除已插入的页面菜单
DELETE FROM sys_permission WHERE id IN (
    '178060100000200', '178060100000210', '178060100000220'
);

-- ============================================================
-- 重新插入菜单权限
-- ============================================================

-- 一级菜单：就业援助
INSERT INTO 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 ('178060100000200', '', '就业援助', '/employmentAssistance', 'layouts/default/index', 1, '', NULL, 0, NULL, '0', 2.20, 0, 'ant-design:heart-outlined', 0, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

-- 二级菜单：初步符合条件人员
INSERT INTO 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 ('178060100000210', '178060100000200', '初步符合条件人员', '/employmentAssistance/preliminaryEligibleList', 'preliminaryeligible/PreliminaryEligibleList', 1, '', NULL, 1, NULL, '0', 1.00, 0, 'ant-design:user-outlined', 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

-- 二级菜单：就业援助管理
INSERT INTO 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 ('178060100000220', '178060100000200', '就业援助管理', '/employmentAssistance/employmentAssistanceList', 'employmentassistance/EmploymentAssistanceList', 1, '', NULL, 1, NULL, '0', 2.00, 0, 'ant-design:team-outlined', 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

-- ============================================================
-- 初步符合条件人员 - 按钮权限
-- ============================================================

INSERT INTO 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 ('178060100000211', '178060100000210', '添加初步符合条件人员', NULL, NULL, 0, '', NULL, 2, 'preliminary_eligible:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

INSERT INTO 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 ('178060100000212', '178060100000210', '编辑初步符合条件人员', NULL, NULL, 0, '', NULL, 2, 'preliminary_eligible:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

INSERT INTO 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 ('178060100000213', '178060100000210', '删除初步符合条件人员', NULL, NULL, 0, '', NULL, 2, 'preliminary_eligible:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

INSERT INTO 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 ('178060100000214', '178060100000210', '批量删除初步符合条件人员', NULL, NULL, 0, '', NULL, 2, 'preliminary_eligible:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

INSERT INTO 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 ('178060100000215', '178060100000210', '导出excel_初步符合条件人员', NULL, NULL, 0, '', NULL, 2, 'preliminary_eligible:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

INSERT INTO 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 ('178060100000216', '178060100000210', '导入excel_初步符合条件人员', NULL, NULL, 0, '', NULL, 2, 'preliminary_eligible:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

-- ============================================================
-- 就业援助管理 - 按钮权限
-- ============================================================

INSERT INTO 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 ('178060100000221', '178060100000220', '添加就业援助管理', NULL, NULL, 0, '', NULL, 2, 'employment_assistance:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

INSERT INTO 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 ('178060100000222', '178060100000220', '编辑就业援助管理', NULL, NULL, 0, '', NULL, 2, 'employment_assistance:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

INSERT INTO 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 ('178060100000223', '178060100000220', '删除就业援助管理', NULL, NULL, 0, '', NULL, 2, 'employment_assistance:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

INSERT INTO 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 ('178060100000224', '178060100000220', '批量删除就业援助管理', NULL, NULL, 0, '', NULL, 2, 'employment_assistance:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

INSERT INTO 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 ('178060100000225', '178060100000220', '导出excel_就业援助管理', NULL, NULL, 0, '', NULL, 2, 'employment_assistance:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

INSERT INTO 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 ('178060100000226', '178060100000220', '导入excel_就业援助管理', NULL, NULL, 0, '', NULL, 2, 'employment_assistance:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-09 10:00:00', NULL, NULL, 0, 0, 1, 0);

-- ============================================================
-- 角色授权（admin角色 - f6817f48af4fb3af11b9e8bf182f618b）
-- ============================================================

INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000230', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000200', NULL, '2026-06-09 10:00:00', '127.0.0.1');

INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000231', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000210', NULL, '2026-06-09 10:00:00', '127.0.0.1');

INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000232', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000220', NULL, '2026-06-09 10:00:00', '127.0.0.1');

-- 初步符合条件人员按钮权限
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000233', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000211', NULL, '2026-06-09 10:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000234', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000212', NULL, '2026-06-09 10:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000235', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000213', NULL, '2026-06-09 10:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000236', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000214', NULL, '2026-06-09 10:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000237', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000215', NULL, '2026-06-09 10:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000238', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000216', NULL, '2026-06-09 10:00:00', '127.0.0.1');

-- 就业援助管理按钮权限
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000239', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000221', NULL, '2026-06-09 10:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000240', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000222', NULL, '2026-06-09 10:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000241', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000223', NULL, '2026-06-09 10:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000242', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000224', NULL, '2026-06-09 10:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000243', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000225', NULL, '2026-06-09 10:00:00', '127.0.0.1');
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000244', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000226', NULL, '2026-06-09 10:00:00', '127.0.0.1');
