-- HRM用户数据交接映射表
CREATE TABLE IF NOT EXISTS `hrm_user_handover` (
    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '映射ID',
    `from_user_id` bigint NOT NULL COMMENT '离职用户ID',
    `to_user_id` bigint NOT NULL COMMENT '交接目标用户ID',
    `resignation_id` bigint NOT NULL COMMENT '关联的离职申请ID',
    `handover_status` tinyint NOT NULL DEFAULT 0 COMMENT '交接状态：0-进行中，20-已完成',
    `handover_time` datetime DEFAULT NULL COMMENT '交接完成时间',
    `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci 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 KEY `uk_from_to_resignation` (`from_user_id`, `to_user_id`, `resignation_id`),
    KEY `idx_from_user_id` (`from_user_id`),
    KEY `idx_to_user_id` (`to_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='HRM用户数据交接映射表';
