DROP TABLE IF EXISTS `meeting_info`;
CREATE TABLE `meeting_info`
(
    `id`                     bigint(20) NOT NULL AUTO_INCREMENT,
    `title`                  varchar(128) DEFAULT NULL COMMENT '会议标题',
    `reception_object`       varchar(128) DEFAULT NULL COMMENT '接待对象',
    `reception_number`       int(4) DEFAULT NULL COMMENT '接待人数',
    `reception_director`     varchar(64)  DEFAULT NULL COMMENT '接待负责人',
    `reception_content`      varchar(512) DEFAULT NULL COMMENT '接待内容',
    `guarantee_personnel`    varchar(256) DEFAULT NULL COMMENT '保障人员',
    `reception_requirement`  varchar(256) DEFAULT NULL COMMENT '接待要求',
    `reception_time`         datetime     DEFAULT NULL COMMENT '接待时间',
    `inspection_template_id` bigint(20) DEFAULT NULL COMMENT '巡检模板id',
    `status`                 int(2) DEFAULT NULL COMMENT '会议状态（10：未开始，20：会议中，30：已结束）',
    `create_time`            datetime     DEFAULT NULL COMMENT '创建时间',
    `update_time`            datetime     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '会议信息表' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `inspection_record`;
CREATE TABLE `inspection_record`
(
    `id`                   bigint(20) NOT NULL AUTO_INCREMENT,
    `meeting_id`           bigint(20) DEFAULT NULL COMMENT '关联会议id',
    `inspection_personnel` varchar(16) DEFAULT NULL COMMENT '巡检人员',
    `normal_num`           int(4) DEFAULT NULL COMMENT '正常项目个数',
    `error_num`            int(4) DEFAULT NULL COMMENT '异常项目个数',
    `inspection_type`      int(2) DEFAULT NULL COMMENT '巡检类型（10：日常巡检，20：会议巡检）',
    `create_time`          datetime    DEFAULT NULL COMMENT '创建时间',
    `update_time`          datetime    DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检记录表' ROW_FORMAT = DYNAMIC;


DROP TABLE IF EXISTS `inspection_result`;
CREATE TABLE `inspection_result`
(
    `id`                    bigint(20) NOT NULL AUTO_INCREMENT,
    `inspection_record_id`  bigint(20) DEFAULT NULL COMMENT '关联巡检记录id',
    `inspection_project_id` bigint(20) DEFAULT NULL COMMENT '关联巡检项目id',
    `result`                int(2) DEFAULT NULL COMMENT '巡检结果类型（10：正常 20：不正常）',
    `remark`                varchar(256) DEFAULT NULL COMMENT '巡检结果描述',
    `create_time`           datetime     DEFAULT NULL COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检结果表' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `upload_record`;
CREATE TABLE `upload_record`
(
    `id`                   bigint(20) NOT NULL AUTO_INCREMENT,
    `inspection_result_id` bigint(20) DEFAULT NULL COMMENT '关联巡检结果id，如果为空表示是图片回传',
    `file_type`            int(2) DEFAULT NULL COMMENT '文件类型 10：图片回传 20：巡检结果',
    `source_name`          varchar(256) DEFAULT NULL COMMENT '源文件名称',
    `file_path`            varchar(512) DEFAULT NULL COMMENT '文件地址',
    `upload_user_id`       bigint(20) DEFAULT NULL COMMENT '操作人员id',
    `create_time`          datetime     DEFAULT NULL COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '文件上传记录' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `notice_info`;
CREATE TABLE `notice_info`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT,
    `title`       varchar(128) DEFAULT NULL COMMENT '公告标题',
    `content`     text         DEFAULT NULL COMMENT '公告内容',
    `create_time` datetime     DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公告管理' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `inspection_project`;
CREATE TABLE `inspection_project`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT,
    `name`        varchar(128) DEFAULT NULL COMMENT '巡检项目名称',
    `create_time` datetime     DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检项目表' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `inspection_template`;
CREATE TABLE `inspection_template`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT,
    `name`        varchar(128) DEFAULT NULL COMMENT '模板名称',
    `type`        int(2) DEFAULT NULL COMMENT '模板类型 10：日常巡检 20：会议巡检',
    `is_enable`   int(2) DEFAULT NULL COMMENT '是否启用 10：启用 20：禁用',
    `create_time` datetime     DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检模板表' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `inspection_template_project`;
CREATE TABLE `inspection_template_project`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT,
    `template_id` bigint(20) DEFAULT NULL COMMENT '关联模板id',
    `project_id`  bigint(20) DEFAULT NULL COMMENT '巡检项目id',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检模板&巡检项目关联表' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `fault_handling_record`;
CREATE TABLE `fault_handling_record`
(
    `id`                  bigint(20) NOT NULL AUTO_INCREMENT,
    `title`               varchar(128) DEFAULT NULL COMMENT '故障标题',
    `content`             varchar(512) DEFAULT NULL COMMENT '故障内容',
    `treatment_method`    varchar(512) DEFAULT NULL COMMENT '处理方式',
    `treatment_personnel` varchar(512) DEFAULT NULL COMMENT '处理人员',
    `propose_personnel`   varchar(512) DEFAULT NULL COMMENT '提出人员',
    `status`              int(2) DEFAULT NULL COMMENT '10：未处理 20：已处理',
    `create_time`         datetime     DEFAULT NULL COMMENT '创建时间',
    `update_time`         datetime     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '故障处理记录' ROW_FORMAT = DYNAMIC;

