-- ----------------------------
-- 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 hz_inspect_temp
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_inspect_temp`  (
    `id` int(11) NOT NULL,
    `temp_time` datetime NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_offline_task
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_offline_task`  (
    `ID` bigint(20) NOT NULL COMMENT '主键',
    `TASK_NAME` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务名称',
    `TASK_STATUS` bigint(1) NULL DEFAULT NULL COMMENT '任务状态 0 - 任务开启  1 - 任务处理  2 - 任务完成 ',
    `START_TIME` datetime NULL DEFAULT NULL COMMENT '任务开启时间',
    `END_TIME` datetime NULL DEFAULT NULL COMMENT '任务结束时间',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '更新用户',
    `IS_DELETED` tinyint(4) NULL DEFAULT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for hz_st_camera_info
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_camera_info`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `TYPE` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '摄像头类型cameraType，1视频摄像头，2机器人摄像头，数据字典',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '租户ID',
    `NAME` varchar(127) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '摄像头名称',
    `ADDRESS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '摄像头地址',
    `SPAN_TIME` decimal(11, 3) NOT NULL COMMENT '配置拍照间隔时间',
    `RESOLUTION` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '_x_' COMMENT '像素值(_x_代表使用原始值，640x480代表强制缩放到640x480)',
    `IP` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '摄像头IP',
    `PORT` int(11) NOT NULL COMMENT '摄像头端口',
    `USER` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '摄像头账号',
    `PASSWORD` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '摄像头账号密码',
    `MONITOR_ITEMS` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '告警检测项目（字典表IDs， 通过 ^ 隔开），字典类型：minitor_item',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    `ADDRESS_TYPE` bigint(20) NULL DEFAULT NULL COMMENT '视频流地址类型',
    `LIVESOURCEADDRESS` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '视频流地址',
    `POINT_CODE` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '监测点编号',
    `LAST_REQUESTTIME` datetime NULL DEFAULT NULL COMMENT '最后请求时间',
    `POINT_ID` bigint(20) NULL DEFAULT -1 COMMENT '检测点id',
    `IS_CONTROL` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否云台控制',
    `IS_HIKVIDEO` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否平台接入',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '视频监控告警摄像头信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_clock
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_clock`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `CLOCK_TYPE_ID` bigint(20) NULL DEFAULT NULL COMMENT '表针类型ID',
    `POINTER_BASE_VALUES` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0|0|0|0' COMMENT '表针基准指针位置：指针尾x|指针尾y|指针头x|指针头y，不同指针之间通过\" ^ \" 隔开例如：2.1|3.1|4.2|4.3^2.1|3.1|4.2|4.3  （多个指针，从左开始数）默认为0|0|0|0  ，  需要人为校准，如果觉得精确度不行，再设置该字段值',
    `CAMERA_ID` bigint(20) NULL DEFAULT NULL COMMENT '视频巡检摄像机ID',
    `CAMERA_ADDR` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0,0' COMMENT '表盘在摄像机可视面二维坐标位置，例如：2,1   表示第三行第二列，行列均从0开始记录',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    `NAME` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表名称',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '巡检内容：表针读取中的表记录，正式运行前必须人为进行人为校验，校验不准则设置表针基准指针位置。设计前提是摄像头固定，但凡' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_clock_type
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_clock_type`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `CLOCK_NAME` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表盘名称',
    `POINTER_NUM` int(11) NULL DEFAULT 1 COMMENT '指针数量',
    `SCALE_VALUES` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '刻度对应值 例如：0|10^90|30,0|10^90|30  （0、90表示弧度，10、30表示测量值，弧度与测量值直接用  |  分隔开；0|10表示一组值，多组值之间通过” ^ “隔开，多个指针之间通过  ,  隔开，从左开始数）',
    `POINTER_RADIANS` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '指针起始弧度值，0|90^0|180（0|90 表示指针1（多个指针，从左开始数）的起止值，多个指针数据通过“ ^ ” 隔开）',
    `CLOCK_PRECISION` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表盘精度（例如10， 0.1，0.001， 0.0001）等， 多个表针精度通过^ 隔开：0.1^10',
    `CLOCK_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
    `UNIT` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '测量单位（多个测量值单位之间通过^分割：KV^KW',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '巡检内容：表针读取中表的类型' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_event_attachment
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_event_attachment`  (
    `ID` bigint(64) NOT NULL,
    `EVENT_ID` bigint(20) NOT NULL COMMENT '事件ID',
    `FILE_URL` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文件路径',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检情况附件表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_ex_event
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_ex_event`  (
    `ID` bigint(20) NOT NULL COMMENT 'ID',
    `TASK_ID` bigint(20) NULL DEFAULT NULL COMMENT '任务ID',
    `OBJECT_ID` bigint(20) NULL DEFAULT NULL COMMENT '对象ID',
    `PROJECT_ID` bigint(20) NULL DEFAULT NULL COMMENT '项目ID',
    `USER_ID` bigint(20) NULL DEFAULT NULL COMMENT '事件登记人',
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '事件编号',
    `TITLE` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '事件标题',
    `DESCRIPTION` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '事件描述',
    `IS_PROBLEM` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是否问题 0:否 1 是  默认0',
    `TYPE_BIG` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '问题类型(大)',
    `TYPE_SMALL` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '问题类型(小)',
    `LGTD` decimal(13, 10) NULL DEFAULT NULL COMMENT '经度(东经)',
    `LTTD` decimal(12, 10) NULL DEFAULT NULL COMMENT '纬度(北纬)',
    `ADDRESS` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '事件地点',
    `PROCESS_DEFINITION_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程定义id',
    `PROCESS_INSTANCE_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程实例id',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL,
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE,
    INDEX `idx_task_id`(`TASK_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检情况列表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_ex_event_record
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_ex_event_record`  (
    `ID` bigint(64) NOT NULL,
    `EVENT_ID` bigint(20) NOT NULL COMMENT '事件ID',
    `OBJECT_ID` bigint(20) NOT NULL COMMENT '对象ID',
    `PROJECT_ID` bigint(20) NOT NULL COMMENT '项目ID',
    `CONTENT_ID` bigint(20) NOT NULL COMMENT '内容ID',
    `CURRENT_STATUS` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '内容当前状态 0 异常 1 正常 ',
    `CURRENT_VALUE` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容当前值',
    `CURRENT_DESC` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容当前描述',
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容编码:由系统自动生成自动生成',
    `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容名称',
    `DESCRIPTION` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容描述',
    `RECORD_TYPE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记录类型  0 不记录  1仅选择 2仅记值 3选择并记值',
    `CHECK_TYPE` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检测类型 原来数据字典 暂时设计只支持99个类型',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT NULL COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    `CHECK_TYPE_SON` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '存字典表key 检测类型子类 子类的子类通过-隔开例如：1-12',
    `FILE_URL` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件地址',
    `CAMERA_ADDR` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开关/灯/表盘在摄像机可视面二维坐标位置 例如：2 1   表示第三行第二列 行列均从0开始记录 默认 0 0  如果有多张图则：0 0 1( 最后一位表示所在图片 最后一位1表示第二张图) 默认0 0 0',
    `OTHER_PARAM` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其他参数 例如多联断路器内断路器的',
    `CHECK_VAL` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '校验值 用来判断当前值是否正确：枚举数据通过 隔开 区间通过 隔开',
    `DICT_TYPE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记值方式为选择时选择值',
    PRIMARY KEY (`ID`) USING BTREE,
    INDEX `idx_event_id`(`EVENT_ID`) USING BTREE,
    INDEX `idx_is_deleted_tenant_id`(`IS_DELETED`, `TENANT_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检情况记录表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_ex_object
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_ex_object`  (
    `ID` bigint(64) NOT NULL,
    `TASK_ID` bigint(20) NOT NULL COMMENT '任务ID',
    `OBJECT_ID` bigint(20) NOT NULL COMMENT '对象ID',
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对象编码',
    `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对象名称',
    `ADDRESS` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地理位置',
    `LGTD` decimal(13, 10) NULL DEFAULT NULL COMMENT '经度(东经)',
    `LTTD` decimal(12, 10) NULL DEFAULT NULL COMMENT '纬度(北纬)',
    `DUPLICATE_RECORD` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是否重复记录 0 不允许 1允许',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE,
    INDEX `idx_task_id`(`TASK_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检任务对象表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_ex_object_project
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_ex_object_project`  (
    `ID` bigint(64) NOT NULL,
    `TASK_ID` bigint(64) NOT NULL COMMENT '任务ID',
    `OBJECT_ID` bigint(64) NOT NULL COMMENT '对象ID',
    `PROJECT_ID` bigint(64) NOT NULL COMMENT '项目ID',
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '目标编码',
    `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '目标名称',
    `DESCRIPTION` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '目标描述',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE,
    INDEX `idx_task_id`(`TASK_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检任务对象项目表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_ex_object_project_content
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_ex_object_project_content`  (
    `ID` bigint(64) NOT NULL,
    `TASK_ID` bigint(20) NOT NULL COMMENT '任务ID',
    `OBJECT_ID` bigint(20) NOT NULL COMMENT '对象ID',
    `PROJECT_ID` bigint(20) NOT NULL COMMENT '项目ID',
    `CONTENT_ID` bigint(20) NOT NULL COMMENT '内容ID',
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容编码 由系统自动生成自动生成',
    `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容名称',
    `AVAILABLE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '完成标识 0 不可用 1 可用',
    `DESCRIPTION` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容描述',
    `CHECK_TYPE` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检测类型',
    `RECORD_TYPE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记录类型',
    `CHECK_TYPE_SON` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '存字典表key 检测类型子类  子类的子类通过-隔开例如：1-12',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    `CLOCK_ID` bigint(20) NULL DEFAULT NULL COMMENT '表针识别 表盘ID',
    `CAMERA_ID` bigint(20) NULL DEFAULT NULL COMMENT '视频巡检摄像机ID',
    `CAMERA_ADDR` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开关/灯/表盘在摄像机可视面二维坐标位置 例如：2 1   表示第三行第二列 行列均从0开始记录 默认 0 0 如果有多张图则：0 0 1( 最后一位表示所在图片 最后一位1表示第二张图) 默认0 0 0',
    `OTHER_PARAM` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其他参数 例如多联断路器内断路器的个数',
    `CHECK_VAL` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '校验值 用来判断当前值是否正确：枚举数据通过 “    ”隔开  区间通过~隔开',
    `DICT_TYPE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记值方式为选择时选择值',
    `attr_signage` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性标识',
    `attr_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性名称',
    PRIMARY KEY (`ID`) USING BTREE,
    INDEX `idx_task_id`(`TASK_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检任务对象项目内容表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_ex_task
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_ex_task`  (
    `ID` bigint(20) NOT NULL COMMENT 'ID',
    `PLAN_ID` bigint(20) NULL DEFAULT NULL COMMENT '计划ID',
    `TYPE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划模式 0 人员 1岗位  2机构 3自由模式 4 自由人模式',
    `PLAN_NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划名称',
    `BATCH_NUMBER` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务批次号',
    `CYCLE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划周期 0: 从不 1:每天 2:每月  3:每季度 5:每年 4:每周',
    `METHOD` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '派发方式：0 抢占模式  1 并发模式',
    `PLAN_START_TIME` datetime NULL DEFAULT NULL COMMENT '任务计划开始时间',
    `PLAN_END_TIME` datetime NULL DEFAULT NULL COMMENT '任务计划结束时间',
    `START_TIME` datetime NULL DEFAULT NULL COMMENT '任务实际开始时间',
    `END_TIME` datetime NULL DEFAULT NULL COMMENT '任务实际结束时间',
    `KEEP_ON_RECORD` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '巡检报备 0 未报备 1已报备',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '任务状态 0未开始 1进行中 2暂停 3已完成 4未完成',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    `AUTO_VIDEO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '巡检类型标识： 0普通巡检 1 视频自动巡检 2机器人巡检',
    `TASK_CONTENT` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '临时任务的巡检任务内容',
    `PLAN_TYPE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'common' COMMENT '计划类型common常规任务temporary临时任务',
    `START_REMIND_FLAG` tinyint(1) NULL DEFAULT 0 COMMENT '任务开始前 是否发送提醒短信 标识',
    `END_REMIND_FLAG` tinyint(1) NULL DEFAULT 0 COMMENT '任务结束前 是否发送提醒短信 标识',
    `START_REMIND_TIME` datetime NULL DEFAULT NULL COMMENT '开始前提醒时间',
    `END_REMIND_TIME` datetime NULL DEFAULT NULL COMMENT '结束前提醒时间',
    `DUTY_ID` bigint(20) NULL DEFAULT NULL COMMENT '值班ID',
    `message_template_id` bigint(20) NULL DEFAULT NULL COMMENT '消息模板ID',
    `push_status` bigint(1) NULL DEFAULT NULL COMMENT '推送状态',
    PRIMARY KEY (`ID`) USING BTREE,
    INDEX `idx_create_dept`(`CREATE_DEPT`) USING BTREE,
    INDEX `idx_delete`(`IS_DELETED`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检任务表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_ex_task_user
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_ex_task_user`  (
    `ID` bigint(64) NOT NULL,
    `TASK_ID` bigint(20) NOT NULL COMMENT '任务ID',
    `USER_ID` bigint(20) NOT NULL COMMENT '用户ID',
    `CLAIM_STATUS` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领用状态 0:未领用  1:已领用 每条任务可以存在多个用户，但是只有一个领用人',
    `CLAIM_TIME` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '领用时间',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE,
    INDEX `idx_user_id`(`USER_ID`) USING BTREE,
    INDEX `idx_is_deleted_tenant_id`(`IS_DELETED`, `TENANT_ID`) USING BTREE,
    INDEX `TASK_ID_INDEX`(`TASK_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检任务执行人列表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_hi_task_gather
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_hi_task_gather`  (
    `USER_ID` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
    `USER_NAME` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户名称',
    `ROUTE_ID` bigint(20) NULL DEFAULT NULL COMMENT '路径id',
    `ROUTE_NAME` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
    `PROBLEM_NUM` bigint(20) NULL DEFAULT NULL COMMENT '问题数',
    `ID` bigint(20) NOT NULL COMMENT '任务id',
    `PLAN_ID` bigint(20) NULL DEFAULT NULL COMMENT '计划ID',
    `TYPE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划模式 0 人员 1岗位  2机构 3自由模式 4 自由人模式',
    `PLAN_NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划名称',
    `BATCH_NUMBER` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务批次号',
    `CYCLE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划周期 0: 从不 1:每天 2:每月  3:每季度 5:每年 4:每周',
    `METHOD` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '派发方式：0 抢占模式  1 并发模式',
    `PLAN_START_TIME` datetime NULL DEFAULT NULL COMMENT '任务计划开始时间',
    `PLAN_END_TIME` datetime NULL DEFAULT NULL COMMENT '任务计划结束时间',
    `START_TIME` datetime NULL DEFAULT NULL COMMENT '任务实际开始时间',
    `END_TIME` datetime NULL DEFAULT NULL COMMENT '任务实际结束时间',
    `KEEP_ON_RECORD` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '巡检报备 0 未报备 1已报备',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '任务状态 0未开始 1进行中 2暂停 3已完成 4未完成',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    `AUTO_VIDEO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '巡检类型标识： 0普通巡检，1,视频自动巡检，2机器人巡检',
    `TASK_CONTENT` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '临时任务的巡检任务内容',
    `PLAN_TYPE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'common' COMMENT '计划类型,common常规任务,temporary临时任务',
    `START_REMIND_FLAG` bit(1) NULL DEFAULT b'0' COMMENT '任务开始前 是否发送提醒短信 标识',
    `END_REMIND_FLAG` bit(1) NULL DEFAULT b'0' COMMENT '任务结束前 是否发送提醒短信 标识',
    `START_REMIND_TIME` datetime NULL DEFAULT NULL COMMENT '开始前提醒时间',
    `END_REMIND_TIME` datetime NULL DEFAULT NULL COMMENT '结束前提醒时间'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检任务表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_hi_task_result
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_hi_task_result`  (
    `ID` bigint(20) NOT NULL COMMENT 'ID',
    `PLAN_ID` bigint(20) NULL DEFAULT NULL COMMENT '计划ID',
    `BATCH_NUMBER` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '批次号',
    `REASON` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '原因',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务派发结果表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_offline_record
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_offline_record`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `USER_ID` bigint(20) NOT NULL COMMENT '用户ID',
    `TERMINAL_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '终端设备标识imei',
    `STATUS` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态  1=离线 2=已复原',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户ID',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '离线记录' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_content
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_content`  (
    `ID` bigint(64) NOT NULL COMMENT 'ID',
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容编码:由系统自动生成自动生成',
    `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容名称',
    `DESCRIPTION` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容描述',
    `RECORD_TYPE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记录类型 0不记录 1仅选择 2仅记值 3选择并记值',
    `CHECK_TYPE` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检测类型 原来数据字典 暂时设计只支持99个类型',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户',
    `CLOCK_ID` bigint(20) NULL DEFAULT NULL COMMENT '表针识别 表盘ID',
    `CAMERA_ID` bigint(20) NULL DEFAULT NULL COMMENT '视频巡检摄像机ID',
    `DICT_TYPE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记值方式为选择时选择值',
    `UP_LIMIT` double NULL DEFAULT NULL COMMENT '上限值',
    `DOWN_LIMIT` double NULL DEFAULT NULL COMMENT '下限值',
    `SUGGESTION` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '问题排除建议',
    `SORT` int(11) NULL DEFAULT 0 COMMENT '排序',
    `SUPPORT_AUTO_VIDEO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是支持的巡检类型  0普通巡检 1视频自动巡检 2机器人巡检',
    `CHECK_TYPE_SON` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '存字典表key 检测类型子类 子类的子类通过-隔开例如：1-12',
    `CAMERA_ADDR` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开关/灯/表盘在摄像机可视面二维坐标位置 例如：2 1   表示第三行第二列 行列均从0开始记录 默认 0 0 如果有多张图则：0 0 1( 最后一位表示所在图片 最后一位1表示第二张图) 默认0 0 0',
    `OTHER_PARAM` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其他参数 例如多联断路器内断路器的个数',
    `CHECK_VAL` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其他参数 例如多联断路器内断路器的个数',
    `model_signage` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模型标识',
    `attr_signage` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性标识',
    `attr_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性名称',
    `fac_device_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联的hz3000设备id',
    `fac_device_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联的hz3000设备名称',
    PRIMARY KEY (`ID`) USING BTREE,
    UNIQUE INDEX `UK_OBJECT_CONTENT_CODE`(`CODE`) USING BTREE,
    INDEX `idx_is_deleted_tenant_id`(`IS_DELETED`, `TENANT_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检对象内容' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_content_definition
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_content_definition`  (
    `ID` bigint(64) NOT NULL COMMENT 'ID',
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容编码:由系统自动生成自动生成',
    `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容名称',
    `DESCRIPTION` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容描述',
    `RECORD_TYPE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记录类型 0不记录 1仅选择 2仅记值 3选择并记值',
    `CHECK_TYPE` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检测类型 原来数据字典 暂时设计只支持99个类型',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户',
    `CLOCK_ID` bigint(20) NULL DEFAULT NULL COMMENT '表针识别，表盘ID',
    `CAMERA_ID` bigint(20) NULL DEFAULT NULL COMMENT '视频巡检摄像机ID',
    `DICT_TYPE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记值方式为选择时选择值',
    `UP_LIMIT` double NULL DEFAULT NULL COMMENT '上限值',
    `DOWN_LIMIT` double NULL DEFAULT NULL COMMENT '下限值',
    `SUGGESTION` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '问题排除建议',
    `SORT` int(11) NULL DEFAULT 0 COMMENT '排序',
    `SUPPORT_AUTO_VIDEO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是支持的巡检类型  0普通巡检 1视频自动巡检 2机器人巡检',
    `CHECK_TYPE_SON` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '存字典表key 检测类型子类 子类的子类通过-隔开例如：1-12',
    `CAMERA_ADDR` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开关/灯/表盘在摄像机可视面二维坐标位置 例如：2 1   表示第三行第二列 行列均从0开始记录 默认 0 0 如果有多张图则：0 0 1( 最后一位表示所在图片 最后一位1表示第二张图) 默认0 0 0',
    `OTHER_PARAM` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其他参数 例如多联断路器内断路器的个数',
    `CHECK_VAL` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '校验值 用来判断当前值是否正确：枚举数据通过 “    ”隔开  区间通过~隔开',
    `model_signage` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模型标识',
    `attr_signage` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性标识',
    `attr_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性名称',
    PRIMARY KEY (`ID`) USING BTREE,
    UNIQUE INDEX `UK_OBJECT_CONTENT_CODE`(`CODE`) USING BTREE,
    INDEX `idx_is_deleted_tenant_id`(`IS_DELETED`, `TENANT_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检对象内容' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for hz_st_re_object
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_object`  (
    `ID` bigint(20) NOT NULL,
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对象编码',
    `EM_CODE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备编码',
    `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对象名称',
    `ADDRESS` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地理位置',
    `LGTD` decimal(13, 10) NULL DEFAULT NULL COMMENT '经度(东经)',
    `LTTD` decimal(12, 10) NULL DEFAULT NULL COMMENT '纬度(北纬)',
    `TABLE_CODE` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对象来源 对象来源于哪一个表',
    `REAL_ID` bigint(20) NULL DEFAULT NULL COMMENT '对象实际ID 对象所在的来源表对应的真实ID',
    `DESCRIPTION` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对象描述',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户',
    `SUPPORT_AUTO_VIDEO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '巡检类型标识： 0普通巡检 1 视频自动巡检 2机器人巡检',
    `em_codes` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备编号，按逗号分隔',
    PRIMARY KEY (`ID`) USING BTREE,
    UNIQUE INDEX `UK_OBJECT_CODE`(`CODE`) USING BTREE,
    INDEX `idx_is_deleted_tenant_id`(`IS_DELETED`, `TENANT_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检对象表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_object_danger
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_object_danger`  (
    `ID` bigint(20) NOT NULL,
    `OBJECT_ID` bigint(20) NULL DEFAULT NULL COMMENT '巡检对象ID',
    `DANGER_ID` bigint(20) NULL DEFAULT NULL COMMENT '危险点ID',
    `SORT` int(11) NULL DEFAULT NULL COMMENT '排序',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态（1是未读 2是已读）',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    PRIMARY KEY (`ID`) USING BTREE,
    INDEX `idx_object_id`(`OBJECT_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检对象危险点关联表( 一个巡检对象对应多个危险点）' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_object_template
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_object_template`  (
    `ID` bigint(64) NOT NULL,
    `OBJECT_ID` bigint(20) NULL DEFAULT NULL COMMENT '对象ID',
    `TEMPLATE_ID` bigint(20) NULL DEFAULT NULL COMMENT '模板ID',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检对象默认模板表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_object_user
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_object_user`  (
    `ID` bigint(64) NOT NULL,
    `OBJECT_ID` bigint(64) NOT NULL COMMENT '对象ID',
    `USER_ID` bigint(64) NOT NULL COMMENT '用户ID',
    `TEMPLATE_ID` bigint(20) NOT NULL COMMENT '模板id',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检对象人员表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_plan
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_plan`  (
    `ID` bigint(64) NOT NULL COMMENT 'ID',
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划编码',
    `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划名称',
    `START_TIME` date NULL DEFAULT NULL COMMENT '计划开始时间',
    `END_TIME` date NULL DEFAULT NULL COMMENT '计划结束时间',
    `TYPE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划模式 0 人员 1岗位  2机构 3自由模式 4 自由人模式',
    `METHOD` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '派发方式：0 抢占模式  1 并发模式',
    `CYCLE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划周期 0: 从不 1:每天 2:每月  3:每季度 5:每年 4:每周',
    `APPROVER` bigint(20) NULL DEFAULT NULL COMMENT '审批人',
    `APPROVE_TIME` datetime NULL DEFAULT NULL COMMENT '审批时间 ',
    `FROM_SOURCE` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划来源 1巡检 2点检',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 6 COMMENT '计划状态  0:待审核-->1:已审核-->2:派发中-->3:暂停-->4:结束-->5审核不通过-->6待提交',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    `TASK_FLG` tinyint(4) NULL DEFAULT 0 COMMENT '是否立即生产任务 1-是 0-否',
    `ROUTE_DATA` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '巡检路线数据',
    `ROUTE_ID` bigint(20) NULL DEFAULT NULL COMMENT '巡检路线ID字段',
    `ROUTE_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路线名称',
    `START_REMIND` int(11) NULL DEFAULT NULL COMMENT '开始前提醒（分钟）',
    `END_REMIND` int(11) NULL DEFAULT NULL COMMENT '结束前提醒（分钟）',
    `TASK_TIMES_A_DAY` int(11) NULL DEFAULT NULL COMMENT '一天任务次数',
    `EXEC_TIME_JSON` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '任务执行时间json数据',
    `AI_CHECK_ITEMS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开始任务时AI检测项 来自数据字段表: beginCheckType  多个检测项直接通过隔开',
    `AUTO_VIDEO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '巡检类型标识： 0普通巡检  1视频自动巡检  2机器人巡检',
    `PLAN_TYPE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'common' COMMENT '计划类型 common常规任务 temporary临时任务',
    `TASK_CONTENT` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '临时任务的巡检任务内容',
    `message_template_id` bigint(20) NULL DEFAULT NULL COMMENT '消息模板ID',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检计划表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_plan_class
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_plan_class`  (
    `ID` bigint(20) NOT NULL,
    `PLAN_ID` bigint(20) NOT NULL COMMENT '计划ID',
    `CLASS_ID` bigint(20) NOT NULL COMMENT '班次ID',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检计划执行班次表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_plan_object_template
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_plan_object_template`  (
    `ID` bigint(20) NOT NULL,
    `PLAN_ID` bigint(20) NOT NULL COMMENT '计划ID',
    `OBJECT_ID` bigint(20) NOT NULL COMMENT '对象ID',
    `TEMPLATE_ID` bigint(20) NULL DEFAULT NULL COMMENT '模板ID',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检计划对象模板表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_plan_org
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_plan_org`  (
    `ID` bigint(64) NOT NULL,
    `PLAN_ID` bigint(20) NOT NULL COMMENT '计划ID',
    `ORG_ID` bigint(20) NOT NULL COMMENT '机构ID',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检计划执行机构表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_plan_position
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_plan_position`  (
    `ID` bigint(64) NOT NULL,
    `PLAN_ID` bigint(64) NOT NULL COMMENT '计划ID',
    `POSITION_ID` bigint(64) NOT NULL COMMENT '岗位ID',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检计划执行岗位表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_plan_user
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_plan_user`  (
    `ID` bigint(20) NOT NULL,
    `PLAN_ID` bigint(20) NOT NULL COMMENT '计划ID',
    `USER_ID` bigint(20) NOT NULL COMMENT '用户ID',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检计划执行人表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_project
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_project`  (
    `ID` bigint(64) NOT NULL COMMENT 'ID',
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目编码',
    `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目名称',
    `DESCRIPTION` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目描述',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户',
    `SUPPORT_AUTO_VIDEO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '巡检类型标识： 0普通巡检 1 视频自动巡检 2机器人巡检',
    `em_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备编号',
    PRIMARY KEY (`ID`) USING BTREE,
    UNIQUE INDEX `UK_PROJECT_CODE`(`CODE`) USING BTREE,
    INDEX `idx_is_deleted_tenant_id`(`IS_DELETED`, `TENANT_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检项目表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_project_content
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_project_content`  (
    `ID` bigint(64) NOT NULL AUTO_INCREMENT,
    `PROJECT_ID` bigint(64) NOT NULL COMMENT '目标ID',
    `CONTENT_ID` bigint(64) NOT NULL COMMENT '内容ID',
    `SORT` tinyint(4) NULL DEFAULT 0,
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1772837380198252546 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检项目内容表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_route
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_route`  (
    `ID` bigint(20) NOT NULL,
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `ROUTE_NAME` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路线名称',
    `ROUTE_DATA` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '路线数据',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态（1是未读，2是已读）',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    `SUPPORT_AUTO_VIDEO` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '巡检类型标识： 0普通巡检，1,视频自动巡检，2机器人巡检',
    `type` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '巡检路线 字典：routeType 1-值班 2-通用',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '巡检路径表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_route_gather
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_route_gather`  (
    `ID` bigint(20) NOT NULL,
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `ROUTE_NAME` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路线名称',
    `ROUTE_DATA` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '路线数据',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态（1是未读，2是已读）',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    `SUPPORT_AUTO_VIDEO` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '巡检类型标识： 0普通巡检，1,视频自动巡检，2机器人巡检',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '巡检路径表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_template
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_template`  (
    `ID` bigint(64) NOT NULL,
    `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板代码',
    `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板名称',
    `DESCRIPTION` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板描述',
    `DUPLICATE_RECORD` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是否重复记录 0 不允许 1允许',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户',
    `SUPPORT_AUTO_VIDEO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '巡检类型标识： 0普通巡检，1,视频自动巡检，2机器人巡检',
    `object_id` bigint(20) NULL DEFAULT NULL COMMENT '巡检对象ID',
    PRIMARY KEY (`ID`) USING BTREE,
    UNIQUE INDEX `UK_TEMPLATE_CODE`(`CODE`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检模板表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_re_template_project
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_re_template_project`  (
    `ID` bigint(64) NOT NULL,
    `TEMPLATE_ID` bigint(20) NOT NULL COMMENT '模板ID',
    `PROJECT_ID` bigint(20) NOT NULL COMMENT '项目ID',
    `SORT` int(11) NULL DEFAULT NULL COMMENT '排序',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检模板项目表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_robot
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_robot`  (
    `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `USER_ID` bigint(20) NULL DEFAULT NULL COMMENT '机器人用户ID',
    `CAMERA_ID` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '机器人带的摄像头ID,多个摄像头之间通过 , 隔开',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态（1是未读，2是已读）',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    `NAME` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机器人名称',
    `REMARK` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述信息',
    `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机器人编号',
    PRIMARY KEY (`ID`) USING BTREE,
    UNIQUE INDEX `index_user_id`(`USER_ID`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1768533894367297539 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '巡检机器人的信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_robot_task
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_robot_task`  (
    `ID` bigint(20) NOT NULL COMMENT 'ID',
    `NAME` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务名称',
    `CHECK_TYPE_SON` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '任务类型 ： 0图片,1识别,10热成像',
    `PROJECT_ID` bigint(20) NOT NULL COMMENT '目标ID',
    `CONTENT_IDS` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容IDS，ID之间通过英文逗号隔开，内容需要是同一种检测类型子类，如果是识别，所选内容需要是同一个图上',
    `MACHINE_PARAMS` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机械臂参数 ：一个数组： 1,2,3,4,5,6',
    `FLEXIBLE_FLAG` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '机械臂伸缩参数',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    `TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '2' COMMENT '智能巡检任务类型， 1 视频巡检, 2 机器人巡检(默认）',
    `CAMERA_ID` bigint(20) NULL DEFAULT NULL COMMENT '摄像头id',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '巡检项目内容机器人任务表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_robot_task_identify
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_robot_task_identify`  (
    `ID` bigint(20) NOT NULL COMMENT 'ID',
    `ROBOT_TASK_ID` bigint(20) NOT NULL COMMENT '机器人任务ID',
    `IDENTIFY_KEY` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '识别类型：11表针识别，13灯识别，',
    `ROW_LINES` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所在图该类型每行的列数， 5,4 表示第一行5个元素，第二行4个元素；多行直接用逗号隔开',
    `CONTENT_IDS` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容IDS，ID之间通过英文逗号隔开，内容需要是同一种检测类型子类，如果是识别，所选内容需要是同一个图上',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '机器人任务 - 识别参数表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_task_record
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_task_record`  (
    `ID` bigint(64) NOT NULL,
    `TASK_ID` bigint(20) NULL DEFAULT NULL COMMENT '任务ID',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '报备时间',
    `CREATOR` bigint(20) NULL DEFAULT NULL COMMENT '报备人',
    `REASON` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '报备原因',
    `TYPE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '报备模式 0 任务报备  1 人员报备',
    `EXECUTOR` bigint(20) NULL DEFAULT NULL COMMENT '任务执行人',
    `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
    `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
    `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
    `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '000000' COMMENT '租户',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检任务报备表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for hz_st_user_face_data
-- ----------------------------
CREATE TABLE IF NOT EXISTS `hz_st_user_face_data`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `USER_ID` bigint(20) NOT NULL COMMENT '用户ID',
    `FACE_DATA` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '人脸数据',
    `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态（1是未读，2是已读）',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    PRIMARY KEY (`ID`) USING BTREE,
    UNIQUE INDEX `index_user_id`(`USER_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户人脸数据表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- View structure for hz_st_other_object
-- ----------------------------
DROP VIEW IF EXISTS `hz_st_other_object`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `hz_st_other_object` AS select `equipment`.`hzims_em_info`.`TENANT_ID` AS `TENANT_ID`,`equipment`.`hzims_em_info`.`NUMBER` AS `CODE`,`equipment`.`hzims_em_info`.`NAME` AS `NAME`,`equipment`.`hzims_em_info`.`INS_LOCATION` AS `ADDRESS`,`equipment`.`hzims_em_info`.`LGTD` AS `LGTD`,`equipment`.`hzims_em_info`.`LTTD` AS `LTTD`,'hzims_em_info' AS `TABLE_CODE`,'设备' AS `TYPE`,`equipment`.`hzims_em_info`.`CREATE_USER` AS `CREATE_USER`,`equipment`.`hzims_em_info`.`CREATE_DEPT` AS `CREATE_DEPT`,`equipment`.`hzims_em_info`.`ID` AS `REAL_ID` from `equipment`.`hzims_em_info` where (`equipment`.`hzims_em_info`.`IS_DELETED` = 0);

-- ----------------------------
-- Procedure structure for modified_create_dept
-- ----------------------------
DROP PROCEDURE IF EXISTS `modified_create_dept`;
delimiter ;;
CREATE PROCEDURE `modified_create_dept`(IN oldDept BIGINT(20),IN newDept BIGINT(20))
BEGIN
    -- 定义循环条件
    DECLARE flag INT DEFAULT 0;
-- 保存表名
    DECLARE tname VARCHAR(50);
-- 查询数据库test中含有create_dept列的表,如果区分大小写使用binary COLUMN_NAME = 'create_dept'
    DECLARE result CURSOR FOR SELECT TABLE_NAME FROM  INFORMATION_SCHEMA.Columns WHERE TABLE_SCHEMA = 'hzims-inspect' AND COLUMN_NAME = 'create_dept';
-- 退出循环
    DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET flag = 1;
-- 打开游标
    OPEN result;
    WHILE flag <> 1 DO
            -- 游标指向下一个位置,可以有多个数据,比如FETCH result INTO tname,ttype,...;
            FETCH result INTO tname;
            -- 拼接字符串表名sql,根据需要使用CONCAT函数连接
            SET @execSql = CONCAT('UPDATE ', tname, ' SET create_dept =  ',newDept,' WHERE create_dept = ',oldDept,' ;');
            PREPARE stmt FROM @execSql;
            EXECUTE stmt;
        END WHILE;
END
;;
delimiter ;

-- ----------------------------
-- Procedure structure for p_gn_demonstration_data
-- ----------------------------
DROP PROCEDURE IF EXISTS `p_gn_demonstration_data`;
delimiter ;;
CREATE PROCEDURE `p_gn_demonstration_data`(in initDate VARCHAR(20),in showDate VARCHAR(20))
    COMMENT '广宁演示数据脚本'
BEGIN
    -- demo数据计划ID
    DECLARE old_plan_id BIGINT(20) DEFAULT 0;
    DECLARE new_plan_id BIGINT(20) DEFAULT 0;
    -- 定义循环条件
    DECLARE flag INT DEFAULT 0;
    -- 声明游标，取机构id
    DECLARE plan_cursor CURSOR FOR select id from hz_st_re_plan where `name` like CONCAT('%',DATE_FORMAT(str_to_date(initDate,'%Y-%m-%d'),'%m月%d日'),'%') limit 1;
    -- 退出循环
    DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET flag = 1;
    OPEN plan_cursor;
    select '进入....';
    WHILE flag <> 1 DO
            FETCH plan_cursor INTO old_plan_id;
            set @newPlanId = UUID_SHORT();
            set @initDateStr = DATE_FORMAT(str_to_date(initDate,'%Y-%m-%d'),'%m月%d日');
            set @showDateStr = DATE_FORMAT(str_to_date(showDate,'%Y-%m-%d'),'%m月%d日');
            select @initDateStr,@showDateStr,old_plan_id, @newPlanId;
        END WHILE;
    CLOSE plan_cursor;
END
;;
delimiter ;

-- ----------------------------
-- Procedure structure for p_gn_demonstration_task
-- ----------------------------
DROP PROCEDURE IF EXISTS `p_gn_demonstration_task`;
delimiter ;;
CREATE PROCEDURE `p_gn_demonstration_task`(in oldPlanId BIGINT(20),in newPlanId BIGINT(20),in initDate VARCHAR(20),in showDate VARCHAR(20))
    COMMENT '广宁制造巡检任务数据脚本'
BEGIN
    -- 定义循环条件
    DECLARE flag INT DEFAULT 0;
    DECLARE oldTaskId BIGINT(20) DEFAULT 0;
    -- 定义巡检计划对应任务的游标
    DECLARE task_cursor CURSOR for select id from hz_st_ex_task where PLAN_ID = oldPlanId and IS_DELETED = 0 limit 1;
    DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET flag = 1;
    OPEN task_cursor;
    WHILE flag <> 1 DO
            FETCH task_cursor INTO oldTaskId;
            SET @newTaskId = UUID_SHORT();
            select oldTaskId,@newTaskId;
            -- 插入巡检任务
        END WHILE;
    CLOSE task_cursor;
END
;;
delimiter ;