-- ============================================================
-- 就业一湛通服务平台 - 就业登记模块 菜单权限SQL（达梦数据库版）
-- 菜单层级：就业登记 > 就业登记管理
-- 注意：达梦保留字 name/description/status 用双引号包围
-- ============================================================

-- ============================================================
-- 清理旧数据（兼容重复执行）
-- ============================================================
DELETE FROM sys_role_permission WHERE permission_id IN (
    '178061200000100', '178061200000110',
    '178061200000111', '178061200000112', '178061200000113',
    '178061200000114', '178061200000115', '178061200000116'
);
DELETE FROM sys_permission WHERE id IN (
    '178061200000111', '178061200000112', '178061200000113',
    '178061200000114', '178061200000115', '178061200000116'
);
DELETE FROM sys_permission WHERE id IN (
    '178061200000100', '178061200000110'
);

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

-- 一级菜单：就业登记
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 ('178061200000100', '', '就业登记', '/employmentRegistration', 'layouts/default/index', 1, '', NULL, 0, NULL, '0', 2.30, 0, 'ant-design:form-outlined', 0, 0, 0, 0, NULL, 'admin', '2026-06-12 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 ('178061200000110', '178061200000100', '就业登记管理', '/employmentRegistration/employmentRegistrationList', 'employmentregistration/EmploymentRegistrationList', 1, '', NULL, 1, NULL, '0', 1.00, 0, 'ant-design:profile-outlined', 1, 0, 0, 0, NULL, 'admin', '2026-06-12 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 ('178061200000111', '178061200000110', '添加就业登记', NULL, NULL, 0, '', NULL, 2, 'employment_registration:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-12 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 ('178061200000112', '178061200000110', '编辑就业登记', NULL, NULL, 0, '', NULL, 2, 'employment_registration:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-12 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 ('178061200000113', '178061200000110', '删除就业登记', NULL, NULL, 0, '', NULL, 2, 'employment_registration:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-12 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 ('178061200000114', '178061200000110', '批量删除就业登记', NULL, NULL, 0, '', NULL, 2, 'employment_registration:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-12 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 ('178061200000115', '178061200000110', '导出excel_就业登记', NULL, NULL, 0, '', NULL, 2, 'employment_registration:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-12 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 ('178061200000116', '178061200000110', '导入excel_就业登记', NULL, NULL, 0, '', NULL, 2, 'employment_registration:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-12 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 ('178061200000120', 'f6817f48af4fb3af11b9e8bf182f618b', '178061200000100', NULL, '2026-06-12 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 ('178061200000121', 'f6817f48af4fb3af11b9e8bf182f618b', '178061200000110', NULL, '2026-06-12 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 ('178061200000122', 'f6817f48af4fb3af11b9e8bf182f618b', '178061200000111', NULL, '2026-06-12 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 ('178061200000123', 'f6817f48af4fb3af11b9e8bf182f618b', '178061200000112', NULL, '2026-06-12 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 ('178061200000124', 'f6817f48af4fb3af11b9e8bf182f618b', '178061200000113', NULL, '2026-06-12 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 ('178061200000125', 'f6817f48af4fb3af11b9e8bf182f618b', '178061200000114', NULL, '2026-06-12 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 ('178061200000126', 'f6817f48af4fb3af11b9e8bf182f618b', '178061200000115', NULL, '2026-06-12 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 ('178061200000127', 'f6817f48af4fb3af11b9e8bf182f618b', '178061200000116', NULL, '2026-06-12 10:00:00', '127.0.0.1');
