-- ----------------------------
-- TABLE STRUCTURE FOR BLADE_MODULE_VERSION
-- ----------------------------
CREATE TABLE IF NOT EXISTS `BLADE_MODULE_VERSION`  (
    `MODULE_NAME` VARCHAR(64) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL,
    `VERSION` VARCHAR(8) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL,
    `HISTORY` VARCHAR(300) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL,
    PRIMARY KEY (`MODULE_NAME`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_PROCESS_TYPE
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_PROCESS_TYPE`  (
    `ID` BIGINT(20) NOT NULL AUTO_INCREMENT,
    `SEQUENCE` INT(11) NOT NULL COMMENT '序号',
    `DEPLOYMENT_ID` VARCHAR(160) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前环节流程KEY',
    `DEPLOYMENT_NAME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前流程名称',
    `SEGMENT` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '一个流程图的名称',
    `CREATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `UPDATE_TIME` DATETIME NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT 0 COMMENT '逻辑删除',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作流审批类型' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_STATISTICS
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_STATISTICS`  (
    `ID` BIGINT(20) NOT NULL COMMENT '编号',
    `MODULE_NAME` VARCHAR(150) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '功能模块',
    `MODULE_NAME_NUM` INT(11) NULL DEFAULT 0 COMMENT '功能模块统计',
    `DATE_CALCULATED` VARCHAR(20) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '统计日期',
    `CREATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `UPDATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `SORT` INT(11) NULL DEFAULT NULL COMMENT '排序',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '操作日志统计数据' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_SYS_LOG
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_SYS_LOG`  (
    `ID` BIGINT(20) NOT NULL COMMENT '操作日志编号',
    `TENANT_ID` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
    `SERVER_IP` VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '服务器IP',
    `SERVER_HOST` VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '服务器地址',
    `SERVER_NAME` VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '服务名称',
    `ENV` VARCHAR(20) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '环境',
    `OPERATION_USER_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '操作人ID',
    `OPERATION_USER_NAME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '操作人名称',
    `PATH` VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '请求路径 （操作地址）',
    `USER_AGENT` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '用户代理',
    `METHOD` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '操作方式',
    `METHOD_CLASS` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '方法类',
    `METHOD_NAME` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '方法名',
    `COST_TIME` VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '方法执行时间 消耗时间 毫秒',
    `PARAMETER` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '方法入参',
    `MODULE_NAME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '功能模块',
    `TITLE` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '操作方法',
    `ACTION` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '方法描述',
    `OPERATOR_TYPE` VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '系统类型',
    `BUSINESS_TYPE` VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '操作人类别',
    `JSON_RESULT` LONGTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '返回结果',
    `LOCAL_IP` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '请求的IP',
    `ERROR_MSG` LONGTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误消息',
    `OPERATION_TIME` DATETIME NULL DEFAULT NULL COMMENT '操作时间',
    `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '操作状态（0 正常 1 异常）',
    `CREATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `UPDATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT 0 COMMENT '逻辑删除 （0 可用 1 删除）',
    PRIMARY KEY (`ID`) USING BTREE,
    INDEX `HZIMS_SYS_LOG_OPERATION_TIME_INDEX`(`OPERATION_TIME`) USING BTREE,
    INDEX `HZIMS_SYS_LOG_MODULE_NAME_INDEX`(`MODULE_NAME`) USING BTREE,
    INDEX `HZIMS_SYS_LOG_TITLE_INDEX`(`TITLE`) USING BTREE
) ENGINE = MYISAM CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_WORKFLOW_OPERATION_LOG
-- ----------------------------
CREATE TABLE IF NOT EXISTS `HZIMS_WORKFLOW_OPERATION_LOG`  (
    `ID` BIGINT(20) NOT NULL AUTO_INCREMENT,
    `TAKE_ID` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前任务ID',
    `TAKE_NAME` VARCHAR(150) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前任务名称',
    `PROCESS_DEFINITION_KEY` CHAR(160) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '当前环节流程ID',
    `PROCESS_INSTANCE_KEY` CHAR(160) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '实例KEY',
    `NEXT_STEP_OPERATOR` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '下一环节处理人',
    `VARIABLES` LONGTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '表单',
    `USER_ID` VARCHAR(5000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '用户ID',
    `HANDLETYPE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT ' 根据HANDLETYPE区分是用户还是候选组角色 标识 0是用户 1是角色',
    `CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `UPDATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `IS_DELETED` TINYINT(1) NULL DEFAULT 0 COMMENT '是否逻辑删除，0 可用，1. 不可用',
    `IS_OPERATION_LOG` TINYINT(1) NULL DEFAULT 0 COMMENT '1 正常日志  0 错误日志',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 13245 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作流操作日志' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR LOG_OPTIONS_MODULE_NAME
-- ----------------------------
CREATE TABLE IF NOT EXISTS `LOG_OPTIONS_MODULE_NAME`  (
    `ID` BIGINT(20) NOT NULL AUTO_INCREMENT,
    `MODULE_NAME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '功能模块',
    `SORT` INT(11) NULL DEFAULT NULL COMMENT '排序',
    `CREATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `UPDATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `IS_DELETED` TINYINT(4) NULL DEFAULT 0 COMMENT '逻辑删除 （0 可用 1 删除）',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 67 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- TABLE STRUCTURE FOR PROCESS_DICT
-- ----------------------------
CREATE TABLE IF NOT EXISTS `PROCESS_DICT`  (
    `DICT_CODE` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '票据编码',
    `DICT_SORT` INT(4) NULL DEFAULT 0 COMMENT '票据排序',
    `DICT_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT '' COMMENT '票据字典码',
    `DICT_VALUE` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT '' COMMENT '票据流程标识',
    `DICT_LABEL` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT '' COMMENT '票据标签',
    `DICT_TYPE` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT '' COMMENT '票据类型',
    `IS_DEFAULT` CHAR(1) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT 'N' COMMENT '是否默认（Y是 N否）',
    `STATUS` TINYINT(1) NULL DEFAULT 0 COMMENT '状态（0正常 1停用）',
    `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '所属机构',
    `CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `UPDATE_TIME` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `REMARK` VARCHAR(500) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '票据备注',
    PRIMARY KEY (`DICT_CODE`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 10 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '工作流字典表' ROW_FORMAT = DYNAMIC;

-- 初始化流程配置記錄
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (1, 0, 'NETWORKING', 'WORKTICKETFLOW', '工作票', '两票管理', 'Y', 0, NULL, '2023-06-05 09:43:47', '2023-06-12 10:04:30', '第一种工作票 第二种工作票');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (2, 0, 'MOREACTIONBANKDIRECT', 'STANDARDTICKETFLOW', '操作票', '两票管理', 'Y', 0, NULL, '2023-06-06 14:15:39', '2023-06-06 14:15:52', '操作票');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (3, 0, 'MACHINERY', 'WORKTICKETFLOWMACHINERY', '机械工作票', '两票管理', 'Y', 0, NULL, '2023-06-12 10:04:56', '2023-06-12 10:07:52', '水力机械工作票');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (4, 0, 'MAINTENANCE', 'MAINTENANCE_TEST', '日常维护流程', '日常维护', 'Y', 0, NULL, '2023-06-14 15:06:39', '2023-06-14 15:06:41', '日常维护');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (5, 0, 'DEFECTCHECK', 'DEFECTCHECK', '消缺流程', '', 'Y', 0, NULL, '2023-06-16 17:01:01', '2023-06-26 11:36:54', '消缺流程');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (6, 6, 'OVERHAUL_PLAN', 'OVERHAUL_PLAN', '检修计划V4', '检修计划', 'Y', 0, NULL, '2023-06-16 17:01:01', '2023-06-16 17:04:01', '检修计划流程');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (7, 7, 'OVERHAUL_TASK', 'OVERHAUL_TASK', '检修任务V4', '检修任务', 'Y', 0, NULL, '2023-06-16 17:01:01', '2023-06-16 17:04:01', '检修任务流程');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (8, 8, 'DUTY_REC', 'DUTY_REC', '交接班V4', '交接班', 'Y', 0, NULL, '2023-07-25 18:35:01', '2023-07-25 18:35:01', '交接班流程');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (9, 9, 'WORK_TASK', 'WORK_TASK', '工作任务单V4', '工作任务单', 'Y', 0, NULL, '2023-07-25 18:35:01', '2024-01-09 14:48:18', '工作任务单流程');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (10, 10, 'OFFLINEWORKTICKET', 'OFFLINEWORKTICKET', '线下工作票', '线下工作票', 'Y', 0, NULL, '2023-12-28 16:35:10', '2023-12-28 16:35:14', '线下工作票流程');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (11, 11, 'DEALALARM', 'DEALALARM', '告警处理流程', '告警处理流程', 'Y', 0, NULL, '2024-02-19 16:56:10', '2024-02-19 16:56:34', '告警处理流程');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (12, 12, 'HIDDENDANGERCHECK', 'HIDDENDANGERCHECK', '隐患排查', '隐患排查', 'Y', 0, NULL, '2023-07-25 18:35:01', '2023-07-25 18:35:01', '隐患排查流程');
INSERT INTO `PROCESS_DICT` (`DICT_CODE`, `DICT_SORT`, `DICT_KEY`, `DICT_VALUE`, `DICT_LABEL`, `DICT_TYPE`, `IS_DEFAULT`, `STATUS`, `CREATE_DEPT`, `CREATE_TIME`, `UPDATE_TIME`, `REMARK`) VALUES (13, 13, 'HAZARD_RISK', 'HAZARD_RISK', '风险排查', '风险排查', 'Y', 0, NULL, '2023-07-25 18:35:01', '2023-09-19 22:35:40', '风险排查流程');