-- ============================================================
-- 湛江市智慧人社运营运维（2025-2027年）项目
-- 就业一湛通服务平台 - 招聘会管理模块
-- 菜单及权限初始化脚本
--
-- 数据库：达梦数据库 (DM8)
-- 创建日期：2026-06-12
-- ============================================================

-- ============================================================
-- 1. 清理旧数据（兼容重复执行）
-- ============================================================
DELETE FROM sys_role_permission WHERE permission_id IN (
    '178060100000600', '178060100000610', '178060100000611',
    '178060100000612', '178060100000613', '178060100000614',
    '178060100000615', '178060100000616'
);
DELETE FROM sys_permission WHERE id IN (
    '178060100000610', '178060100000611', '178060100000612',
    '178060100000613', '178060100000614', '178060100000615',
    '178060100000616'
);
DELETE FROM sys_permission WHERE id = '178060100000600';

-- ============================================================
-- 2. 一级菜单：招聘会管理
-- ============================================================
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 ('178060100000600', '', '招聘会管理', '/recruitmentFair', 'layouts/default/index', 1, '', NULL, 0, NULL, '0', 2.30, 0, 'ant-design:calendar-outlined', 0, 0, 0, 0, NULL, 'admin', '2026-06-12 10:00:00', NULL, NULL, 0, 0, 1, 0);

-- ============================================================
-- 3. 二级菜单：招聘会管理页面
-- ============================================================
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 ('178060100000610', '178060100000600', '招聘会管理', '/recruitmentFair/recruitmentFairList', 'recruitmentfair/RecruitmentFairList', 1, '', NULL, 1, NULL, '0', 1.00, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-12 10:00:00', NULL, NULL, 0, 0, 1, 0);

-- ============================================================
-- 4. 按钮权限
-- ============================================================
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 ('178060100000611', '178060100000610', '添加招聘会信息', NULL, NULL, 0, '', NULL, 2, 'recruitment_fair: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 ('178060100000612', '178060100000610', '编辑招聘会信息', NULL, NULL, 0, '', NULL, 2, 'recruitment_fair: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 ('178060100000613', '178060100000610', '删除招聘会信息', NULL, NULL, 0, '', NULL, 2, 'recruitment_fair: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 ('178060100000614', '178060100000610', '批量删除招聘会信息', NULL, NULL, 0, '', NULL, 2, 'recruitment_fair: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 ('178060100000615', '178060100000610', '导出excel_招聘会管理', NULL, NULL, 0, '', NULL, 2, 'recruitment_fair: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 ('178060100000616', '178060100000610', '导入excel_招聘会管理', NULL, NULL, 0, '', NULL, 2, 'recruitment_fair:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-06-12 10:00:00', NULL, NULL, 0, 0, 1, 0);

-- ============================================================
-- 5. 角色授权（admin角色）
-- ============================================================
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip)
VALUES ('178060100000620', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000600', 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 ('178060100000621', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000610', 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 ('178060100000622', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000611', 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 ('178060100000623', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000612', 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 ('178060100000624', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000613', 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 ('178060100000625', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000614', 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 ('178060100000626', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000615', 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 ('178060100000627', 'f6817f48af4fb3af11b9e8bf182f618b', '178060100000616', NULL, '2026-06-12 10:00:00', '127.0.0.1');
