From e1a2ae80bcac68064098d51bdec912fc74b7c964 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 10 九月 2026 13:15:05 +0800
Subject: [PATCH] feat(hrm): 添加HRM模块数据库表和菜单权限初始化脚本

---
 sql/mysql/hrm_regularize_workhour_schedule_menu_init.sql |  166 +++++++++++++++++++++++++++++++++
 sql/mysql/hrm_training_certificate_remind_init.sql       |  103 ++++++++++++++++++++
 2 files changed, 269 insertions(+), 0 deletions(-)

diff --git a/sql/mysql/hrm_regularize_workhour_schedule_menu_init.sql b/sql/mysql/hrm_regularize_workhour_schedule_menu_init.sql
new file mode 100644
index 0000000..468a115
--- /dev/null
+++ b/sql/mysql/hrm_regularize_workhour_schedule_menu_init.sql
@@ -0,0 +1,166 @@
+-- =============================================
+-- HRM 闇�姹傗憼鈶℃敹灏� SQL 鍒濆鍖栬剼鏈�
+-- 瑕嗙洊锛氳浆姝g敵璇疯〃銆佹湀搴﹀伐鏃舵眹鎬昏〃銆佸憳宸ョ骇鎺掔彮鏄庣粏琛ㄣ��
+--      缁╂晥鑰冩牳鐝粍鑼冨洿鍒楋紙scope_team_ids锛夈�佹柊鑿滃崟涓庢寜閽潈闄�
+-- 鎵ц搴擄細mom-xgdl锛坮un-once锛岀姝㈤噸澶嶆墽琛岋級
+-- 瑙勫垯锛氫笉鍚� tenant_id锛涜彍鍗�/鏉冮檺浣跨敤涓�娆℃�� INSERT
+-- =============================================
+
+-- =============================================
+-- 1. 杞鐢宠琛�
+-- =============================================
+CREATE TABLE IF NOT EXISTS `hrm_regularize_application` (
+    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鐢宠ID',
+    `no` varchar(32) NOT NULL COMMENT '鐢宠鍗曞彿',
+    `user_id` bigint NOT NULL COMMENT '鐢宠浜篒D锛堝叧鑱� system_users.id锛�',
+    `dept_id` bigint DEFAULT NULL COMMENT '閮ㄩ棬ID',
+    `post_id` bigint DEFAULT NULL COMMENT '宀椾綅ID',
+    `employment_type` tinyint DEFAULT NULL COMMENT '褰撳墠鐢ㄥ伐鎬ц川锛�1-姝e紡锛�2-鍔冲姟锛�3-澶栧寘锛�4-瀹炰範锛�5-閫�浼戣繑鑱橈紝6-鍏朵粬',
+    `expected_date` date DEFAULT NULL COMMENT '鎷熻浆姝f棩鏈�',
+    `reason` varchar(500) DEFAULT NULL COMMENT '杞鍘熷洜',
+    `status` tinyint NOT NULL DEFAULT 0 COMMENT '瀹℃壒鐘舵�侊細0-鑽夌锛�10-瀹℃壒涓紝20-宸查�氳繃锛�30-宸查┏鍥烇紝40-宸插彇娑�',
+    `process_instance_id` varchar(64) DEFAULT NULL COMMENT 'BPM娴佺▼瀹炰緥ID',
+    `approve_time` datetime DEFAULT NULL COMMENT '瀹℃壒瀹屾垚鏃堕棿',
+    `remark` varchar(500) DEFAULT NULL COMMENT '澶囨敞',
+    `creator` varchar(64) DEFAULT '' COMMENT '鍒涘缓鑰�',
+    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+    `updater` varchar(64) DEFAULT '' COMMENT '鏇存柊鑰�',
+    `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+    `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '鏄惁鍒犻櫎',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_no` (`no`),
+    KEY `idx_user_id` (`user_id`),
+    KEY `idx_status` (`status`),
+    KEY `idx_process_instance_id` (`process_instance_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='HRM杞鐢宠琛�';
+
+-- =============================================
+-- 2. 鏈堝害宸ユ椂姹囨�昏〃
+-- =============================================
+CREATE TABLE IF NOT EXISTS `hrm_workhour_summary` (
+    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '姹囨�籌D',
+    `employee_id` bigint NOT NULL COMMENT '鍛樺伐ID',
+    `dept_id` bigint DEFAULT NULL COMMENT '閮ㄩ棬ID',
+    `period` varchar(10) NOT NULL COMMENT '鏍哥畻鍛ㄦ湡锛坹yyy-MM锛�',
+    `work_days` int DEFAULT 0 COMMENT '鍑哄嫟澶╂暟',
+    `work_hours` decimal(10,2) DEFAULT 0 COMMENT '姝e父宸ユ椂锛堝皬鏃讹級',
+    `overtime_hours` decimal(10,2) DEFAULT 0 COMMENT '鍔犵彮宸ユ椂锛堝皬鏃讹級',
+    `remark` varchar(500) DEFAULT NULL COMMENT '澶囨敞',
+    `creator` varchar(64) DEFAULT '' COMMENT '鍒涘缓鑰�',
+    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+    `updater` varchar(64) DEFAULT '' COMMENT '鏇存柊鑰�',
+    `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+    `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '鏄惁鍒犻櫎',
+    PRIMARY KEY (`id`),
+    UNIQUE KEY `uk_employee_period` (`employee_id`, `period`),
+    KEY `idx_period` (`period`),
+    KEY `idx_dept_id` (`dept_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='HRM鏈堝害宸ユ椂姹囨�昏〃';
+
+-- =============================================
+-- 3. 鍛樺伐绾ф帓鐝槑缁嗚〃
+-- =============================================
+CREATE TABLE IF NOT EXISTS `mes_cal_schedule_detail` (
+    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '缂栧彿',
+    `plan_id` bigint DEFAULT NULL COMMENT '鎺掔彮璁″垝缂栧彿',
+    `team_id` bigint DEFAULT NULL COMMENT '鐝粍缂栧彿',
+    `user_id` bigint NOT NULL COMMENT '鐝粍鎴愬憳鐢ㄦ埛缂栧彿锛堝叧鑱� system_users.id锛�',
+    `day` datetime NOT NULL COMMENT '鏃ユ湡',
+    `shift_id` bigint DEFAULT NULL COMMENT '鐝缂栧彿',
+    `shift_name` varchar(50) DEFAULT NULL COMMENT '鐝鍚嶇О锛堝啑浣欙級',
+    `start_time` varchar(20) DEFAULT NULL COMMENT '寮�濮嬫椂闂达紙HH:mm锛屽啑浣欙級',
+    `end_time` varchar(20) DEFAULT NULL COMMENT '缁撴潫鏃堕棿锛圚H:mm锛屽啑浣欙級',
+    `source` tinyint NOT NULL DEFAULT 1 COMMENT '鏉ユ簮锛�1-鑷姩鐢熸垚锛�2-浜哄伐璋冩暣',
+    `remark` varchar(500) DEFAULT NULL COMMENT '澶囨敞',
+    `creator` varchar(64) DEFAULT '' COMMENT '鍒涘缓鑰�',
+    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+    `updater` varchar(64) DEFAULT '' COMMENT '鏇存柊鑰�',
+    `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+    `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '鏄惁鍒犻櫎',
+    PRIMARY KEY (`id`),
+    KEY `idx_plan_id` (`plan_id`),
+    KEY `idx_team_id` (`team_id`),
+    KEY `idx_user_id_day` (`user_id`, `day`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='MES鍛樺伐绾ф帓鐝槑缁嗚〃';
+
+-- =============================================
+-- 4. 缁╂晥鑰冩牳琛ㄥ鍔犵彮缁勮寖鍥村垪锛堝厛妫�鏌ュ啀娣诲姞锛屽吋瀹归噸澶嶆墽琛岋級
+-- =============================================
+SET @exists_scope_team_ids = (SELECT COUNT(*) FROM information_schema.columns
+    WHERE table_schema = 'mom-xgdl' AND table_name = 'hrm_performance_appraise' AND column_name = 'scope_team_ids');
+SET @sql_scope_team_ids = IF(@exists_scope_team_ids = 0,
+    'ALTER TABLE `hrm_performance_appraise` ADD COLUMN `scope_team_ids` varchar(500) DEFAULT NULL COMMENT ''鎸囧畾鐝粍缂栧彿闆嗗悎锛圝SON 鏁扮粍锛宻cope_type=2 鏃剁敓鏁堬級'' AFTER `scope_type`',
+    'SELECT 1');
+PREPARE stmt_scope_team_ids FROM @sql_scope_team_ids;
+EXECUTE stmt_scope_team_ids;
+DEALLOCATE PREPARE stmt_scope_team_ids;
+
+-- =============================================
+-- 5. 鑿滃崟涓庢寜閽潈闄愶紙涓�娆℃�� INSERT锛�
+-- =============================================
+
+-- 5.1 杞鐢宠鑿滃崟锛堢埗 6002 浜轰簨瀹℃壒锛�+ 鎸夐挳
+INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES
+(6007, '杞鐢宠', '', 2, 4, 6002, 'regularize', 'ep:promotion', 'hrm/regularize/index', 'HrmRegularizeApplication', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(600701, '杞鐢宠鏌ヨ', 'hrm:regularize:query', 3, 1, 6007, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(600702, '杞鐢宠鍒涘缓', 'hrm:regularize:create', 3, 2, 6007, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(600703, '杞鐢宠鏇存柊', 'hrm:regularize:update', 3, 3, 6007, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(600704, '杞鐢宠鍒犻櫎', 'hrm:regularize:delete', 3, 4, 6007, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(600705, '杞鐢宠鎻愪氦瀹℃壒', 'hrm:regularize:submit', 3, 5, 6007, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(600706, '杞鐢宠瀹℃壒', 'hrm:regularize:audit', 3, 6, 6007, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0');
+
+-- 5.2 鏈堝害宸ユ椂姹囨�昏彍鍗曪紙鐖� 6001 浜哄姏璧勬簮锛�+ 鎸夐挳
+INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES
+(1065700, '鏈堝害宸ユ椂姹囨��', '', 2, 3, 6001, 'work-hour-summary', 'ep:data-line', 'hrm/workHourSummary/index', 'HrmWorkHourSummary', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065701, '鏈堝害宸ユ椂姹囨�绘煡璇�', 'hrm:work-hour:query', 3, 1, 1065700, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065702, '鏈堝害宸ユ椂姹囨�荤敓鎴�', 'hrm:work-hour:generate', 3, 2, 1065700, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0');
+
+-- 5.3 钖叕缁撴瀯鑿滃崟锛堢埗 6020 钖叕绠$悊锛�+ 鎸夐挳
+INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES
+(1065710, '钖叕缁撴瀯', '', 2, 4, 6020, 'salary-structure', 'ep:coins', 'hrm/salaryStructure/index', 'HrmSalaryStructure', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065711, '钖叕缁撴瀯鏌ヨ', 'hrm:salary:query', 3, 1, 1065710, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065712, '钖叕缁撴瀯鍒涘缓', 'hrm:salary:create', 3, 2, 1065710, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065713, '钖叕缁撴瀯鏇存柊', 'hrm:salary:update', 3, 3, 1065710, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065714, '钖叕缁撴瀯鍒犻櫎', 'hrm:salary:delete', 3, 4, 1065710, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0');
+
+-- 5.4 鍛樺伐钖叕妗f鑿滃崟锛堢埗 6020 钖叕绠$悊锛�+ 鎸夐挳
+INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES
+(1065720, '鍛樺伐钖叕妗f', '', 2, 5, 6020, 'employee-salary', 'ep:wallet', 'hrm/employeeSalary/index', 'HrmEmployeeSalary', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065721, '鍛樺伐钖叕妗f鏌ヨ', 'hrm:salary:query', 3, 1, 1065720, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065722, '鍛樺伐钖叕妗f鍒涘缓', 'hrm:salary:create', 3, 2, 1065720, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065723, '鍛樺伐钖叕妗f鏇存柊', 'hrm:salary:update', 3, 3, 1065720, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065724, '鍛樺伐钖叕妗f鍒犻櫎', 'hrm:salary:delete', 3, 4, 1065720, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0');
+
+-- 5.5 鍛樺伐绾ф帓鐝槑缁嗚彍鍗曪紙鐖� 5200 璁″垝鎺掔▼锛�+ 鎸夐挳
+INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES
+(5270, '鍛樺伐鎺掔彮鏄庣粏', '', 2, 4, 5200, 'schedule-detail', 'ep:tickets', 'mes/cal/scheduleDetail/index', 'MesCalScheduleDetail', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(5271, '鍛樺伐鎺掔彮鏄庣粏鏌ヨ', 'mes:cal-schedule-detail:query', 3, 1, 5270, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(5272, '鍛樺伐鎺掔彮鏄庣粏鐢熸垚', 'mes:cal-schedule-detail:generate', 3, 2, 5270, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(5273, '鍛樺伐鎺掔彮鏄庣粏璋冩暣', 'mes:cal-schedule-detail:update', 3, 3, 5270, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0');
+
+-- =============================================
+-- 6. 瑙掕壊鎺堟潈锛堜笌 HRM 鐜版湁 1065330 宸ユ椂缁熻涓�鑷达紝鎺堟潈缁欒秴绠�/绠$悊鍛樿鑹诧級
+-- =============================================
+INSERT INTO `system_role_menu` (`role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES
+(1, 6007, '1', NOW(), '1', NOW(), b'0'),
+(1, 600701, '1', NOW(), '1', NOW(), b'0'),
+(1, 600702, '1', NOW(), '1', NOW(), b'0'),
+(1, 600703, '1', NOW(), '1', NOW(), b'0'),
+(1, 600704, '1', NOW(), '1', NOW(), b'0'),
+(1, 600705, '1', NOW(), '1', NOW(), b'0'),
+(1, 600706, '1', NOW(), '1', NOW(), b'0'),
+(2, 1065700, '1', NOW(), '1', NOW(), b'0'),
+(2, 1065701, '1', NOW(), '1', NOW(), b'0'),
+(2, 1065702, '1', NOW(), '1', NOW(), b'0'),
+(109, 1065700, '1', NOW(), '1', NOW(), b'0'),
+(109, 1065701, '1', NOW(), '1', NOW(), b'0'),
+(109, 1065702, '1', NOW(), '1', NOW(), b'0'),
+(111, 1065700, '1', NOW(), '1', NOW(), b'0'),
+(111, 1065701, '1', NOW(), '1', NOW(), b'0'),
+(111, 1065702, '1', NOW(), '1', NOW(), b'0');
\ No newline at end of file
diff --git a/sql/mysql/hrm_training_certificate_remind_init.sql b/sql/mysql/hrm_training_certificate_remind_init.sql
new file mode 100644
index 0000000..b092791
--- /dev/null
+++ b/sql/mysql/hrm_training_certificate_remind_init.sql
@@ -0,0 +1,103 @@
+-- ============================================
+-- HRM 鍩硅绠$悊 + 璇佷功/鍚堝悓鍒版湡鎻愰啋 妯″潡鍒濆鍖栬剼鏈�
+-- 鐩爣搴擄細mom-xgdl锛堝崟娆℃墽琛岋紝鍕块噸澶嶈窇锛�
+-- 1. 寤鸿〃(鍩硅娲诲姩 + 鍙傝浜哄憳)
+-- 2. 鑿滃崟 + 鎸夐挳鏉冮檺 + 瑙掕壊鎺堟潈
+-- 3. 绔欏唴淇℃ā鏉�(2)
+-- 4. 鍏ㄥ眬閰嶇疆(鎻愰啋澶╂暟锛岄粯璁� 30)
+-- 5. 瀹氭椂浠诲姟(姣忔棩 08:00 鍒版湡鎻愰啋)
+-- ============================================
+
+-- 1. 寤鸿〃
+CREATE TABLE IF NOT EXISTS `hrm_training` (
+    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '缂栧彿',
+    `training_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '鍩硅缂栧彿',
+    `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '鍩硅鍚嶇О',
+    `training_type` tinyint NOT NULL COMMENT '鍩硅绫诲瀷锛�1=瀹夊叏鍩硅锛�2=鎶�鑳藉煿璁紝3=绠$悊鍩硅锛�4=鍏朵粬锛�',
+    `trainer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '璁插笀',
+    `location` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '鍩硅鍦扮偣',
+    `hours` decimal(6,1) NULL DEFAULT NULL COMMENT '鍩硅瀛︽椂',
+    `start_date` date NULL DEFAULT NULL COMMENT '寮�濮嬫棩鏈�',
+    `end_date` date NULL DEFAULT NULL COMMENT '缁撴潫鏃ユ湡',
+    `issue_certificate` bit(1) NOT NULL DEFAULT b'0' COMMENT '鏄惁鑷姩鍙戣瘉锛�0=鍚︼紝1=鏄紱浠呭畨鍏�/鎶�鑳藉煿璁敮鎸侊級',
+    `cert_validity_months` int NULL DEFAULT NULL COMMENT '璇佷功鏈夋晥鏈燂紙鏈堬級锛岃嚜鍔ㄥ彂璇佹椂鐢ㄤ簬璁$畻璇佷功鍒版湡鏃�',
+    `status` tinyint NOT NULL DEFAULT 0 COMMENT '鐘舵�侊紙0=鑽夌锛�10=寰呭紑灞曪紝20=宸插畬鎴愶紝30=宸插彇娑堬級',
+    `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+
+    -- 鏍囧噯瀛楁
+    `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+    `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+    `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+    `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '鏄惁鍒犻櫎',
+    PRIMARY KEY (`id`) USING BTREE,
+    UNIQUE INDEX `uk_training_no` (`training_no`) USING BTREE,
+    INDEX `idx_status` (`status`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'HRM 鍩硅娲诲姩' ROW_FORMAT = Dynamic;
+
+CREATE TABLE IF NOT EXISTS `hrm_training_participant` (
+    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '缂栧彿',
+    `training_id` bigint NOT NULL COMMENT '鍩硅娲诲姩缂栧彿',
+    `employee_id` bigint NOT NULL COMMENT '鍛樺伐缂栧彿',
+    `attended` bit(1) NOT NULL DEFAULT b'0' COMMENT '鏄惁瀹為檯鍙傚姞锛�0=鏈弬鍔狅紝1=鍙傚姞锛�',
+    `score` decimal(10,2) NULL DEFAULT NULL COMMENT '鑰冩牳鎴愮哗',
+    `is_pass` bit(1) NOT NULL DEFAULT b'0' COMMENT '鏄惁鍚堟牸锛�0=涓嶅悎鏍硷紝1=鍚堟牸锛�',
+    `certificate_id` bigint NULL DEFAULT NULL COMMENT '鑱斿姩鐢熸垚鐨勮瘉涔﹁祫璐ㄧ紪鍙凤紙骞傜瓑鍥炲啓锛岄槻閲嶅鍙戣瘉锛�',
+    `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+
+    -- 鏍囧噯瀛楁
+    `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+    `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+    `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+    `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '鏄惁鍒犻櫎',
+    PRIMARY KEY (`id`) USING BTREE,
+    UNIQUE INDEX `uk_training_id_employee_id` (`training_id`, `employee_id`) USING BTREE,
+    INDEX `idx_employee_id` (`employee_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'HRM 鍩硅鍙傝浜哄憳' ROW_FORMAT = Dynamic;
+
+-- 2. 鑿滃崟锛堢埗鑿滃崟 6001 浜哄姏璧勬簮锛夛細鍩硅绠$悊
+INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES (1065600, '鍩硅绠$悊', '', 2, 99, 6001, 'training', 'ep:reading', 'hrm/training/index', 'HrmTraining', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0');
+
+INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES
+(1065601, '鍩硅绠$悊鏌ヨ', 'hrm:training:query', 3, 1, 1065600, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065602, '鍩硅绠$悊鏂板', 'hrm:training:create', 3, 2, 1065600, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065603, '鍩硅绠$悊淇敼', 'hrm:training:update', 3, 3, 1065600, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0'),
+(1065604, '鍩硅绠$悊鍒犻櫎', 'hrm:training:delete', 3, 4, 1065600, '', '', '', '', 0, b'1', b'0', b'1', '1', NOW(), '1', NOW(), b'0');
+
+-- 瑙掕壊鎺堟潈锛氫笌"璇佷功璧勮川"涓�鑷达紝鎺堟潈缁欒鑹� 2/109/111
+INSERT INTO `system_role_menu` (`role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES
+(2, 1065600, '1', NOW(), '1', NOW(), b'0'),
+(2, 1065601, '1', NOW(), '1', NOW(), b'0'),
+(2, 1065602, '1', NOW(), '1', NOW(), b'0'),
+(2, 1065603, '1', NOW(), '1', NOW(), b'0'),
+(2, 1065604, '1', NOW(), '1', NOW(), b'0'),
+(109, 1065600, '1', NOW(), '1', NOW(), b'0'),
+(109, 1065601, '1', NOW(), '1', NOW(), b'0'),
+(109, 1065602, '1', NOW(), '1', NOW(), b'0'),
+(109, 1065603, '1', NOW(), '1', NOW(), b'0'),
+(109, 1065604, '1', NOW(), '1', NOW(), b'0'),
+(111, 1065600, '1', NOW(), '1', NOW(), b'0'),
+(111, 1065601, '1', NOW(), '1', NOW(), b'0'),
+(111, 1065602, '1', NOW(), '1', NOW(), b'0'),
+(111, 1065603, '1', NOW(), '1', NOW(), b'0'),
+(111, 1065604, '1', NOW(), '1', NOW(), b'0');
+
+-- 3. 绔欏唴淇℃ā鏉匡紙type=2 绯荤粺娑堟伅锛涘彉閲忓悕椤讳笌鍚庣 HrmExpiryRemindServiceImpl 鎺ㄩ�佺殑 params 涓�鑷达級
+INSERT INTO `system_notify_template` (`name`, `code`, `nickname`, `content`, `type`, `params`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES
+('璇佷功鍒版湡鎻愰啋', 'hrm_certificate_expire_remind', 'HRM 绯荤粺', '{employeeName}锛屾偍鐨勮瘉涔﹁祫璐ㄣ�恵certTypeName}銆憑certName} 灏嗕簬 {expireDate} 鍒版湡锛岃鍙婃椂鍔炵悊澶嶅/鎹㈣瘉銆�', 2, '["employeeName","certTypeName","certName","expireDate"]', 0, '1', NOW(), '1', NOW(), b'0'),
+('鍔冲姩鍚堝悓鍒版湡鎻愰啋', 'hrm_contract_expire_remind', 'HRM 绯荤粺', '{employeeName}锛屾偍鐨勫姵鍔ㄥ悎鍚岋紙缂栧彿锛歿contractNo}锛夊皢浜� {endDate} 鍒版湡锛岃鍙婃椂鑱旂郴浜轰簨鍔炵悊缁鎴栫鑱屾墜缁��', 2, '["employeeName","contractNo","endDate"]', 0, '1', NOW(), '1', NOW(), b'0');
+
+-- 4. 鍏ㄥ眬閰嶇疆锛堝埌鏈熸彁閱掑ぉ鏁帮紝榛樿 30锛屽彲鍦ㄣ�岀郴缁熼厤缃�嶈皟鏁达級
+INSERT INTO `infra_config` (`category`, `type`, `name`, `config_key`, `value`, `visible`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES
+('biz', 2, 'HRM 璇佷功鍒版湡鎻愰啋澶╂暟', 'hrm.certificate.remind-days', '30', 1, '璇佷功璧勮川鏈夋晥鏈熷埌鏈熷墠 N 澶╂彁閱掞紙绔欏唴淇″彂閫佽嚦鍛樺伐绯荤粺璐﹀彿锛夛紝榛樿 30', '1', NOW(), '1', NOW(), b'0'),
+('biz', 2, 'HRM 鍚堝悓鍒版湡鎻愰啋澶╂暟', 'hrm.contract.remind-days', '30', 1, '鍔冲姩鍚堝悓鍒版湡鍓� N 澶╂彁閱掞紙绔欏唴淇″彂閫佽嚦鍛樺伐绯荤粺璐﹀彿锛夛紝榛樿 30', '1', NOW(), '1', NOW(), b'0');
+
+-- 5. 瀹氭椂浠诲姟锛氭瘡鏃� 08:00 鎵弿璇佷功/鍚堝悓鍒版湡骞跺彂閫佺珯鍐呬俊锛坔andlerName=hrmExpiryRemindJob锛宻tatus=1 鍚敤锛�
+INSERT INTO `infra_job` (`name`, `status`, `handler_name`, `handler_param`, `cron_expression`, `retry_count`, `retry_interval`, `monitor_timeout`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
+VALUES ('HRM 璇佷功/鍚堝悓鍒版湡鎻愰啋', 1, 'hrmExpiryRemindJob', NULL, '0 0 8 * * ?', 0, 0, 0, '1', NOW(), '1', NOW(), b'0');

--
Gitblit v1.9.3