-- 流程映射配置表
CREATE TABLE `bpm_process_mapping_config` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `process_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流程唯一标识(如:ORDER,PAYMENT)',
  `process_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流程显示名称',
  `table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '物理表名(如:order_info)',
  `entity_class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '实体类全限定名(如:com.example.order.OrderDO)',
  `mapper_class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Mapper接口全限定名(如:com.example.order.OrderMapper)',
  `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci 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 '是否删除',
  `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_process_code` (`process_code`, `deleted`) COMMENT '流程代码唯一索引',
  KEY `idx_tenant_id` (`tenant_id`) COMMENT '租户ID索引'
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='流程映射配置表';

-- 插入示例数据
INSERT INTO `bpm_process_mapping_config` 
(`process_code`, `process_name`, `table_name`, `entity_class`, `mapper_class`, `description`, `creator`, `tenant_id`) 
VALUES 
('LEAVE', '请假流程', 'bpm_oa_leave', 'cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALeaveDO', 'cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOALeaveMapper', '员工请假申请流程配置', 'system', 0),
('REIMBURSEMENT', '报销流程', 'bpm_oa_reimbursement', 'cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReimbursementDO', 'cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAReimbursementMapper', '员工报销申请流程配置', 'system', 0); 