/*
 Navicat Premium Data Transfer

 Source Server         : 报修系统数据库
 Source Server Type    : MySQL
 Source Server Version : 80022
 Source Host           : 172.16.20.95:3306
 Source Schema         : repair_report

 Target Server Type    : MySQL
 Target Server Version : 80022
 File Encoding         : 65001

 Date: 04/01/2024 09:19:31
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for repair_admin
-- ----------------------------
DROP TABLE IF EXISTS `repair_admin`;
CREATE TABLE `repair_admin`  (
  `id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键UUID类型',
  `account` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账号',
  `card_number` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '微校卡号',
  `password` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
  `username` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '昵称',
  `school_id` int(0) NOT NULL COMMENT '校区ID',
  `phone` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '手机号',
  `is_super` int(0) NOT NULL COMMENT '是否是超级管理员 不是：0；是：1',
  `statu` int(0) NOT NULL COMMENT '状态 正常：0；冻结：1',
  `is_mobile` int(0) NOT NULL COMMENT '是否是移动端创建 不是：0；是：1',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_area
-- ----------------------------
DROP TABLE IF EXISTS `repair_area`;
CREATE TABLE `repair_area`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `parent_id` int(0) NOT NULL COMMENT '父级ID',
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '区域/具体名称',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 504 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_article_build
-- ----------------------------
DROP TABLE IF EXISTS `repair_article_build`;
CREATE TABLE `repair_article_build`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `article_id` int(0) NOT NULL COMMENT '报修类型',
  `build_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '楼栋关联ID（多个楼栋用逗号隔开）',
  `user_id` int(0) NOT NULL COMMENT '用户ID',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `ididx`(`id`, `deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 684 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_article_type
-- ----------------------------
DROP TABLE IF EXISTS `repair_article_type`;
CREATE TABLE `repair_article_type`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `order_num` int(0) NULL DEFAULT NULL COMMENT '序号',
  `school_id` int(0) NOT NULL COMMENT '校区ID',
  `parent_id` int(0) NOT NULL COMMENT '父级ID(parentid为0的是第一级)',
  `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '报修故障（物品）类型名称',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 481 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_classes_settings
-- ----------------------------
DROP TABLE IF EXISTS `repair_classes_settings`;
CREATE TABLE `repair_classes_settings`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `user_id` int(0) NOT NULL COMMENT '用户ID',
  `start_date` date NOT NULL COMMENT '生效日期',
  `shift_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '班次ID（多个班次用逗号隔开）',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `unOne`(`user_id`, `start_date`, `shift_id`, `create_time`, `update_time`, `create_user`, `update_user`, `deleted`) USING BTREE COMMENT '不能存在重复值',
  INDEX `deletedIdx`(`user_id`, `deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4213 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_close
-- ----------------------------
DROP TABLE IF EXISTS `repair_close`;
CREATE TABLE `repair_close`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '关单原因',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_collaborate_record
-- ----------------------------
DROP TABLE IF EXISTS `repair_collaborate_record`;
CREATE TABLE `repair_collaborate_record`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '报修记录ID',
  `user_id` int(0) NOT NULL COMMENT '申请人ID',
  `approver_id` int(0) NULL DEFAULT NULL COMMENT '审批操作人ID',
  `collaborator` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '协作人ID（多个人用逗号隔开）',
  `voice` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '语音 可能做成语音文件上传的方式 然后这个字段记录语音文件名',
  `voice_length` int(0) NULL DEFAULT NULL COMMENT '录音时长',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `approval_statu` int(0) NOT NULL COMMENT '审批状态 0拒绝 1同意 2待审批',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 50 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_consumables
-- ----------------------------
DROP TABLE IF EXISTS `repair_consumables`;
CREATE TABLE `repair_consumables`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '维修记录ID',
  `article_id` int(0) NOT NULL COMMENT '物品类型ID',
  `consume_id` int(0) NOT NULL COMMENT '耗材ID',
  `consume_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '耗材名称',
  `price` decimal(10, 2) NOT NULL COMMENT '耗材单价',
  `number` double NOT NULL COMMENT '耗材数量',
  `total_price` decimal(10, 2) NOT NULL COMMENT '合计费用',
  `change_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '改价人',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1030 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_consume
-- ----------------------------
DROP TABLE IF EXISTS `repair_consume`;
CREATE TABLE `repair_consume`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `school_id` int(0) NOT NULL COMMENT '校区ID',
  `article_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '故障（改名叫物品）类型ID （多个ID用逗号隔开）',
  `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '耗材名称',
  `price` decimal(10, 2) NOT NULL COMMENT '单价',
  `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 416 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_dispatch_record
-- ----------------------------
DROP TABLE IF EXISTS `repair_dispatch_record`;
CREATE TABLE `repair_dispatch_record`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '报修记录ID',
  `users_id` int(0) NOT NULL COMMENT '被派单人ID',
  `assigned_time` datetime(0) NOT NULL COMMENT '被派单/被转单/被协作时间',
  `receiving_time` datetime(0) NULL DEFAULT NULL COMMENT '接单时间 用来计算是否接单超时 \r\n计算公式：\r\n（被派单时间 + 接单考核时间） < 接单时间',
  `acceptance_assess_time` int(0) NOT NULL COMMENT '接单考核时间',
  `source_id` int(0) NULL DEFAULT NULL COMMENT '协作或转单',
  `order_type` int(0) NOT NULL COMMENT '派单类型 0派单 1协作 2转单',
  `is_lose_efficacy` int(0) NOT NULL COMMENT '是否已失效（0未失效，1已失效）',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `userIdx`(`users_id`, `is_lose_efficacy`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5667 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_evaluate
-- ----------------------------
DROP TABLE IF EXISTS `repair_evaluate`;
CREATE TABLE `repair_evaluate`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '报修记录ID',
  `star` int(0) NOT NULL COMMENT '星级',
  `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '评价内容',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3750 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_leave_message
-- ----------------------------
DROP TABLE IF EXISTS `repair_leave_message`;
CREATE TABLE `repair_leave_message`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '维修记录ID',
  `recipient_id` int(0) NOT NULL COMMENT '接收人员ID',
  `sender_id` int(0) NOT NULL COMMENT '发送人员ID',
  `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内容',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 166 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_notice_setting
-- ----------------------------
DROP TABLE IF EXISTS `repair_notice_setting`;
CREATE TABLE `repair_notice_setting`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '公告内容',
  `is_top` int(0) NOT NULL COMMENT '是否置顶展示 不展示：0 展示：1',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 29 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_offline_record
-- ----------------------------
DROP TABLE IF EXISTS `repair_offline_record`;
CREATE TABLE `repair_offline_record`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '报修记录ID',
  `voice` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '语音 可能做成语音文件上传的方式 然后这个字段记录语音文件名',
  `voice_length` int(0) NULL DEFAULT NULL COMMENT '录音时长',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `user_id` int(0) NOT NULL COMMENT '申请人ID',
  `approver_id` int(0) NULL DEFAULT NULL COMMENT '审批操作人ID',
  `approval_statu` int(0) NOT NULL COMMENT '审批状态 0拒绝 1同意 2待审批',
  `refuse_remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '拒绝原因',
  `old_record` int(0) NOT NULL COMMENT '原来的工单状态',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 344 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_pay_record
-- ----------------------------
DROP TABLE IF EXISTS `repair_pay_record`;
CREATE TABLE `repair_pay_record`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '报修记录ID',
  `user_id` int(0) NOT NULL COMMENT '支付人员ID',
  `pay_no` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '支付流水号（对应支付平台的）',
  `pay_price` decimal(10, 2) NOT NULL COMMENT '交易金额',
  `is_success` int(0) NOT NULL COMMENT '是否支付成功 未支付/等待支付：1；支付成功：2；支付失败：3',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '备注',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 490 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_receiving
-- ----------------------------
DROP TABLE IF EXISTS `repair_receiving`;
CREATE TABLE `repair_receiving`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '维修记录ID',
  `dispatch_id` int(0) NOT NULL COMMENT '派单ID（关联派单表）',
  `user_id` int(0) NOT NULL COMMENT '接单人ID',
  `receiving_time` datetime(0) NOT NULL COMMENT '接单时间',
  `finish_time` datetime(0) NULL DEFAULT NULL COMMENT '维修完成时间 用来计算是否维修超时 \r\n计算公式：\r\n（接单时间 + 维修考核时间） < 维修完成时间',
  `maintenance_assess_time` int(0) NOT NULL COMMENT '维修考核时间（单位：分钟）',
  `is_lose_efficacy` int(0) NOT NULL COMMENT '是否已失效（未失效：0；已失效：1）',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4601 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_record
-- ----------------------------
DROP TABLE IF EXISTS `repair_record`;
CREATE TABLE `repair_record`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `area_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '报修区域',
  `article_id` int(0) NOT NULL COMMENT '报修物品ID',
  `record_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '报修单号(也是微信支付种的商户单号)',
  `school_id` int(0) NOT NULL COMMENT '校区ID',
  `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '详细地址',
  `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '故障描述',
  `image` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '故障图片 最多三张（多张按逗号隔开）',
  `maintenancer` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修照片 最多两张 必填 （多张按逗号隔开）',
  `voice` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '报修录音',
  `voice_length` int(0) NULL DEFAULT NULL COMMENT '录音时长',
  `finish_voice` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修录音',
  `finish_voice_length` int(0) NULL DEFAULT NULL COMMENT '维修录音时长',
  `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修内容',
  `customs_officer_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关单人ID 多个人用逗号隔开',
  `user_id` int(0) NOT NULL COMMENT '报修人ID',
  `user_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '报修人姓名',
  `user_phone` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '报修人联系电话',
  `user_class` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '报修人年级等信息',
  `build_id` int(0) NOT NULL COMMENT '楼栋ID',
  `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '合计费用',
  `maintenancer_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修人ID（多个人用逗号隔开）',
  `maintenancer_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修人姓名（用协作、改派操作之前第一个师傅的名字）',
  `maintenancer_phone` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修人联系电话（用协作、改派操作之前第一个师傅的电话）',
  `maintenance_state` int(0) NOT NULL COMMENT '维修状态(派单中，维修中，协作，转后勤，已完成，待确认，转单待审核，协作待审核，已取消，已关单)',
  `is_duty` int(0) NULL DEFAULT NULL COMMENT '是否是值班单 不是值班单0 是值班单1  定时到正常班次时间重新分配',
  `is_collaborate` int(0) NULL DEFAULT NULL COMMENT '是否是协作单 不是协作单0 是协作单1  判断关单用的',
  `logistics_personnel` int(0) NULL DEFAULT NULL COMMENT '后勤人员ID',
  `report_time` datetime(0) NOT NULL COMMENT '报修时间',
  `remark` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关单原因',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  `version` int(0) NOT NULL COMMENT '乐观锁',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5623 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_refund_record
-- ----------------------------
DROP TABLE IF EXISTS `repair_refund_record`;
CREATE TABLE `repair_refund_record`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '报修记录ID',
  `user_id` int(0) NOT NULL COMMENT '被退款人员ID',
  `wx_no` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商户退款单号（对应微信的）',
  `refund_no` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信退款单号（对应微信的）',
  `refund_price` decimal(10, 2) NOT NULL COMMENT '退款金额',
  `is_success` int(0) NOT NULL COMMENT '是否退款成功 退款中0；退款成功1；退款失败2',
  `approve` int(0) NULL DEFAULT NULL COMMENT '审批状态 待审批：0；通过：1；驳回：2',
  `approve_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '申请人',
  `approved_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '审批人',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '备注',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_school
-- ----------------------------
DROP TABLE IF EXISTS `repair_school`;
CREATE TABLE `repair_school`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '校区名称',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `name_unique`(`name`) USING BTREE COMMENT '校区名称不能重复'
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_shift_settings
-- ----------------------------
DROP TABLE IF EXISTS `repair_shift_settings`;
CREATE TABLE `repair_shift_settings`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '班次名称',
  `start_time` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '开始时间',
  `end_time` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '结束时间',
  `not_work_time` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '非工作时间 多个时间用逗号隔开',
  `is_duty` int(0) NOT NULL COMMENT '是否值班 不值班：0；值班：1',
  `color` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '颜色（存储rgb值）',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_system_messages
-- ----------------------------
DROP TABLE IF EXISTS `repair_system_messages`;
CREATE TABLE `repair_system_messages`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '报修记录ID',
  `recipient_id` int(0) NOT NULL COMMENT '接收人员ID',
  `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内容',
  `is_read` int(0) NOT NULL COMMENT '是否已读 未读：0；已读：1',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 31451 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_system_setting
-- ----------------------------
DROP TABLE IF EXISTS `repair_system_setting`;
CREATE TABLE `repair_system_setting`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `hour` int(0) NOT NULL COMMENT '工单完成后多少小时，用户未评价系统默认好评',
  `emergency_call` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '黄家湖紧急电话',
  `emergency_mxh` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '墨轩湖紧急电话',
  `service_phone` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '服务监督电话',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_track_record
-- ----------------------------
DROP TABLE IF EXISTS `repair_track_record`;
CREATE TABLE `repair_track_record`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '报修记录ID',
  `maintenance_state` int(0) NOT NULL COMMENT '维修状态(派单中，维修中，协作，转后勤，已完成，待确认，转单待审核，协作待审核，已取消，已关单)',
  `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '跟踪内容',
  `user_id` int(0) NULL DEFAULT NULL COMMENT '用户ID',
  `user_zzstr` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对应身份',
  `image` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '照片',
  `voice` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '录音',
  `voice_length` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '录音时长',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 18317 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_transfer_record
-- ----------------------------
DROP TABLE IF EXISTS `repair_transfer_record`;
CREATE TABLE `repair_transfer_record`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `record_id` int(0) NOT NULL COMMENT '报修记录ID',
  `voice` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '语音 可能做成语音文件上传的方式 然后这个字段记录语音文件名',
  `voice_length` int(0) NULL DEFAULT NULL COMMENT '录音时长',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `user_id` int(0) NOT NULL COMMENT '申请人ID',
  `approver_id` int(0) NULL DEFAULT NULL COMMENT '审批操作人ID',
  `approval_statu` int(0) NOT NULL COMMENT '审批状态 0拒绝 1同意 2待审批',
  `refuse_remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '拒绝原因',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 222 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_user
-- ----------------------------
DROP TABLE IF EXISTS `repair_user`;
CREATE TABLE `repair_user`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `card_number` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微校卡号',
  `user_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名称',
  `user_phone` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户手机号',
  `user_zzid` int(0) NOT NULL COMMENT '用户身份ID 用户：0 维修师傅：1 郭班长：2 后勤人员：3',
  `user_class` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '报修人年级等信息',
  `work_type` int(0) NULL DEFAULT NULL COMMENT '工种',
  `identity_type` int(0) NULL DEFAULT NULL COMMENT '微校身份类型ID 其他：0； 学生：1； 教职工：4；校友：5；本科生：6',
  `college` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '学院',
  `grade` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '年级',
  `profession` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '专业',
  `school_id` int(0) NOT NULL COMMENT '校区ID',
  `state` int(0) NULL DEFAULT NULL COMMENT '员工状态 正常接单：1；停止接单：2；',
  `team_id` int(0) NULL DEFAULT NULL COMMENT '维修班 校方人员：0；第三方人员：1',
  `build_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '楼栋关联ID（多个楼栋用逗号隔开）',
  `article_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '故障类型（改名叫物品）关联ID（多个故障类型用逗号隔开）',
  `is_change` int(0) NULL DEFAULT NULL COMMENT '是否能转换  不能转换：0；能转换：1',
  `acceptance_assess_time` int(0) NULL DEFAULT NULL COMMENT '接单考核时间',
  `maintenance_assess_time` int(0) NULL DEFAULT NULL COMMENT '维修考核时间',
  `openid` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信唯一标识openid',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `ididex`(`id`, `user_zzid`, `school_id`, `deleted`, `state`, `article_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 43737 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for repair_work_type
-- ----------------------------
DROP TABLE IF EXISTS `repair_work_type`;
CREATE TABLE `repair_work_type`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工种名称',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `name_unique`(`name`) USING BTREE COMMENT '工种类型名称不能重复'
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for wx_access_token
-- ----------------------------
DROP TABLE IF EXISTS `wx_access_token`;
CREATE TABLE `wx_access_token`  (
  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `access_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'access_token',
  `expires_time` datetime(0) NOT NULL COMMENT '过期时间',
  `create_time` datetime(0) NOT NULL COMMENT '创建时间',
  `update_time` datetime(0) NOT NULL COMMENT '更新时间',
  `create_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人员',
  `update_user` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人员',
  `deleted` int(0) NOT NULL COMMENT '逻辑删除 未删除：0；删除：1',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 532 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
