/*
 Navicat Premium Data Transfer

 Source Server         : 172.16.20.78 
 Source Server Type    : MySQL
 Source Server Version : 80030
 Source Host           : localhost:3306
 Source Schema         : patrol

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

 Date: 30/05/2023 16:22:00
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for check_item
-- ----------------------------
DROP TABLE IF EXISTS `check_item`;
CREATE TABLE `check_item`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `item_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '妫€鏌ラ」缂栧彿',
  `item_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '妫€鏌ラ」鍚嶇О',
  `item_type` int NOT NULL COMMENT '妫€鏌ラ」绫诲埆 1閫夋嫨銆?鏁板瓧銆?鏂囨湰銆?鎷嶇収',
  `is_required` tinyint(1) NOT NULL DEFAULT 1 COMMENT '鏄惁蹇呭～',
  `default_value` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '榛樿鍊?',
  `is_score` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁鍙備笌璇勫垎',
  `patrol_type_id` bigint NOT NULL COMMENT '妫€鏌ョ被鍒玦d',
  `patrol_type_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '妫€鏌ョ被鍒悕绉?鍐椾綑瀛楁',
  `user_id` bigint NULL DEFAULT NULL COMMENT '鎵€灞炰汉鍛榠d',
  `username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鎵€灞炰汉鍛樺悕绉?',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞璇存槑',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_check_item_check_item_type_1`(`patrol_type_id` ASC) USING BTREE,
  CONSTRAINT `check_item_ibfk_1` FOREIGN KEY (`patrol_type_id`) REFERENCES `check_item_type` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 447 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"检查项目-项目\",\r\n    \"prefix\": \"check_item\",\r\n    \"remarks\": \"检查项\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"检查项\",\r\n    \"prefix\": \"check_item\",\r\n    \"remarks\": \"检查项\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for check_item_extra_of_num
-- ----------------------------
DROP TABLE IF EXISTS `check_item_extra_of_num`;
CREATE TABLE `check_item_extra_of_num`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `check_item_id` bigint NOT NULL COMMENT '妫€鏌ラ」id',
  `unit` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
  `decimal_places` int NOT NULL DEFAULT 2 COMMENT '灏忔暟鐐瑰悗浣嶆暟',
  `qualified_score` int NOT NULL DEFAULT 0 COMMENT '鍚堟牸璇勫垎',
  `no_qualified_score` int NOT NULL DEFAULT 0 COMMENT '涓嶅悎鏍艰瘎鍒?',
  `valid_max_value` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏈夋晥鍊间笂闄?',
  `valid_min_value` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏈夋晥鍊间笅闄?',
  `qualified_max_value` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍚堟牸鍊间笂闄?',
  `qualified_min_value` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍚堟牸鍊间笅闄?',
  `check_valid_max_value` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁寮哄埗鏍￠獙鏈夋晥鍊间笂闄?杈撳叆鍊间笉鑳藉ぇ浜庢湁鏁堝€间笂闄?',
  `check_valid_min_value` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁寮哄埗鏍￠獙鏈夋晥鍊间笅闄?杈撳叆鍊间笉鑳藉ぇ浜庢湁鏁堝€间笅闄?',
  `check_qualified_max_value` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁寮哄埗鏍￠獙鍚堟牸鍊间笂闄?杈撳叆鍊煎ぇ浜庡悎鏍煎€间笂闄愭椂涓轰笉鍚堟牸',
  `check_qualified_min_value` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁寮哄埗鏍￠獙鍚堟牸鍊间笅闄?杈撳叆鍊煎皬浜庡悎鏍煎€间笅闄愭椂涓轰笉鍚堟牸',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `check_item_index`(`check_item_id` ASC) USING BTREE,
  CONSTRAINT `check_item_extra_of_num_ibfk_1` FOREIGN KEY (`check_item_id`) REFERENCES `check_item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 85 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数字项额外信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for check_item_extra_of_select
-- ----------------------------
DROP TABLE IF EXISTS `check_item_extra_of_select`;
CREATE TABLE `check_item_extra_of_select`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `check_item_id` bigint NOT NULL COMMENT '妫€鏌ラ」id',
  `allow_multiple` tinyint(1) NOT NULL COMMENT '鏄惁鍏佽澶氶€?',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_check_item_extra_of_select_check_item_1`(`check_item_id` ASC) USING BTREE,
  CONSTRAINT `check_item_extra_of_select_ibfk_1` FOREIGN KEY (`check_item_id`) REFERENCES `check_item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 266 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '选择项额外信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for check_item_extra_of_txt
-- ----------------------------
DROP TABLE IF EXISTS `check_item_extra_of_txt`;
CREATE TABLE `check_item_extra_of_txt`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `check_item_id` bigint NOT NULL COMMENT '妫€鏌ラ」id',
  `allow_multiple` tinyint(1) NOT NULL DEFAULT 2 COMMENT '鏄惁鍏佽澶氳',
  `qualified_score` int NOT NULL DEFAULT 0 COMMENT '鍚堟牸璇勫垎',
  `no_qualified_score` int NOT NULL DEFAULT 0 COMMENT '涓嶅悎鏍艰瘎鍒?',
  `qualified_judge` int NOT NULL COMMENT '鍚堟牸鍒ゅ畾 1濮嬬粓鍚堟牸銆?濮嬬粓涓嶅悎鏍笺€?鏃犲唴瀹瑰悎鏍笺€?鏈夊唴瀹瑰悎鏍?',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_check_item_extra_of_txt_check_item_1`(`check_item_id` ASC) USING BTREE,
  CONSTRAINT `check_item_extra_of_txt_ibfk_1` FOREIGN KEY (`check_item_id`) REFERENCES `check_item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文本项额外信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for check_item_of_photo_point
-- ----------------------------
DROP TABLE IF EXISTS `check_item_of_photo_point`;
CREATE TABLE `check_item_of_photo_point`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `check_item_id` bigint NOT NULL COMMENT '妫€鏌ラ」id',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鎷嶇収鐐瑰悕绉?',
  `is_required` tinyint(1) NOT NULL DEFAULT 1 COMMENT '鏄惁蹇呴』鎷嶇収',
  `qualified_judge` tinyint(1) NOT NULL DEFAULT 1 COMMENT '鍚堟牸鍒ゅ畾 true:鎷嶇収鍚堟牸銆乫alse:鎷嶇収涓嶅悎鏍?',
  `qualified_score` int NOT NULL DEFAULT 0 COMMENT '鍚堟牸璇勫垎',
  `no_qualified_score` int NOT NULL DEFAULT 0 COMMENT '涓嶅悎鏍艰瘎鍒?',
  `seq` int NOT NULL COMMENT '鎺掑簭',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_check_item_of_photo_point_check_item_1`(`check_item_id` ASC) USING BTREE,
  CONSTRAINT `check_item_of_photo_point_ibfk_1` FOREIGN KEY (`check_item_id`) REFERENCES `check_item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 115 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '拍照项拍照点信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for check_item_of_select_option
-- ----------------------------
DROP TABLE IF EXISTS `check_item_of_select_option`;
CREATE TABLE `check_item_of_select_option`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `check_item_id` bigint NOT NULL COMMENT '妫€鏌ラ」id',
  `option_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '閫夐」鍚嶇О',
  `qualified_if_select` tinyint(1) NOT NULL COMMENT '閫変腑鏄惁鍚堟牸',
  `qualified_if_no_select` tinyint(1) NOT NULL COMMENT '鏈€変腑鏄惁鍚堟牸',
  `default_select` tinyint(1) NOT NULL COMMENT '鏄惁榛樿閫変腑',
  `score` int NOT NULL DEFAULT 0 COMMENT '鍚堟牸璇勫垎',
  `seq` int NOT NULL DEFAULT 0 COMMENT '鎺掑簭',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_check_item_of_select_option_check_item_1`(`check_item_id` ASC) USING BTREE,
  CONSTRAINT `check_item_of_select_option_ibfk_1` FOREIGN KEY (`check_item_id`) REFERENCES `check_item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 628 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '选择项选项信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for check_item_type
-- ----------------------------
DROP TABLE IF EXISTS `check_item_type`;
CREATE TABLE `check_item_type`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `type_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '绫诲埆鍚嶇О',
  `seq` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绫诲埆鎺掑簭',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"检查项目-项目分类\",\r\n    \"prefix\": \"check_item\",\r\n    \"remarks\": \"项目类别\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 1,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 1,\r\n    \"query\": 1,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"项目类别\",\r\n    \"prefix\": \"check_item\",\r\n    \"remarks\": \"项目类别\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]\r\n' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for check_route
-- ----------------------------
DROP TABLE IF EXISTS `check_route`;
CREATE TABLE `check_route`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璺嚎缂栧彿',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璺嚎鍚嶇О',
  `responsibler` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璐熻矗浜哄悕绉?',
  `telephone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鑱旂郴鐢佃瘽',
  `remark` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `route_no_unique_index`(`number` ASC) USING BTREE,
  INDEX `id`(`id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"检查路线-路线查询\",\r\n    \"prefix\": \"check_route\",\r\n    \"remarks\": \"检查路线\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"检查路线\",\r\n    \"prefix\": \"check_route\",\r\n    \"remarks\": \"检查路线\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for check_route_and_device
-- ----------------------------
DROP TABLE IF EXISTS `check_route_and_device`;
CREATE TABLE `check_route_and_device`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
  `route_id` bigint NOT NULL COMMENT '璺嚎id',
  `device_id` bigint NOT NULL COMMENT '璁惧id',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `route_id`(`route_id` ASC) USING BTREE,
  INDEX `device_id`(`device_id` ASC) USING BTREE,
  CONSTRAINT `check_route_and_device_ibfk_1` FOREIGN KEY (`route_id`) REFERENCES `check_route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `check_route_and_device_ibfk_2` FOREIGN KEY (`device_id`) REFERENCES `device` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 55 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '路线与设备' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for check_route_and_device_room
-- ----------------------------
DROP TABLE IF EXISTS `check_route_and_device_room`;
CREATE TABLE `check_route_and_device_room`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
  `route_id` bigint NOT NULL COMMENT '璺嚎id',
  `room_id` bigint NOT NULL COMMENT '鎴块棿id',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_check_route_and_device_room_check_route_1`(`route_id` ASC) USING BTREE,
  INDEX `fk_check_route_and_device_room_device_room_1`(`room_id` ASC) USING BTREE,
  CONSTRAINT `check_route_and_device_room_ibfk_1` FOREIGN KEY (`route_id`) REFERENCES `check_route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `check_route_and_device_room_ibfk_2` FOREIGN KEY (`room_id`) REFERENCES `device_room` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 187 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '路线与房间' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device
-- ----------------------------
DROP TABLE IF EXISTS `device`;
CREATE TABLE `device`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '璁惧id',
  `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璁惧鍚嶇О',
  `room_id` bigint NOT NULL COMMENT '鎴块棿id',
  `number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璁惧缂栧彿',
  `vendor` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璁惧鍘傚',
  `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璁惧鍨嬪彿',
  `type` int NOT NULL COMMENT '璁惧绫诲瀷 1锛氭満鏌滆澶? 99锛氬叾浠栬澶?',
  `params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '璁惧鍙傛暟 json鏍煎紡',
  `images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '璁惧鐓х墖 json鏍煎紡',
  `files` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '璁惧闄勪欢 json鏍煎紡',
  `create_time` datetime NOT NULL COMMENT '璁惧鍒涘缓鏃堕棿',
  `update_time` datetime NOT NULL COMMENT '璁惧鏇存柊鏃堕棿',
  `update_user_id` bigint NOT NULL COMMENT '璁惧鏇存柊鐢ㄦ埛id',
  `update_username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璁惧鏇存柊鐢ㄦ埛鍚?',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_device_device_room_1`(`room_id` ASC) USING BTREE,
  CONSTRAINT `device_ibfk_1` FOREIGN KEY (`room_id`) REFERENCES `device_room` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 8085 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"资产管理-设备管理\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"设备\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"设备\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"设备\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_and_check_item
-- ----------------------------
DROP TABLE IF EXISTS `device_and_check_item`;
CREATE TABLE `device_and_check_item`  (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `device_id` bigint NOT NULL COMMENT '璁惧id',
  `check_item_id` bigint NOT NULL COMMENT '妫€鏌ラ」id',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_device_and_check_item_device_1`(`device_id` ASC) USING BTREE,
  INDEX `fk_device_and_check_item_check_item_1`(`check_item_id` ASC) USING BTREE,
  CONSTRAINT `device_and_check_item_ibfk_1` FOREIGN KEY (`check_item_id`) REFERENCES `check_item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `device_and_check_item_ibfk_2` FOREIGN KEY (`device_id`) REFERENCES `device` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 6972 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '设备与检查项' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_building
-- ----------------------------
DROP TABLE IF EXISTS `device_building`;
CREATE TABLE `device_building`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '妤兼爧id',
  `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '妤兼爧鍚嶇О',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  `update_time` datetime NOT NULL COMMENT '鏈€鍚庢洿鏂版椂闂?',
  `update_user_id` bigint NOT NULL COMMENT '鏈€鍚庢洿鏂扮敤鎴穒d',
  `update_username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鏈€鍚庢洿鏂扮敤鎴峰悕',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `name`(`name` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"资产管理-楼栋管理\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"楼栋\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"楼栋\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"楼栋\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_cabinet_child_device
-- ----------------------------
DROP TABLE IF EXISTS `device_cabinet_child_device`;
CREATE TABLE `device_cabinet_child_device`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鏈烘煖鍐呰澶噄d',
  `cabinet_id` bigint NOT NULL COMMENT '鏈烘煖id',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璁惧鍚嶇О',
  `vendor` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璁惧鍘傚晢',
  `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璁惧鍨嬪彿',
  `layer_count` int NOT NULL COMMENT '璁惧鍗犵敤灞傛暟',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
  `top` int NOT NULL COMMENT '璁惧椤堕儴璺濇満鏌滈《绔窛绂?',
  `bottom` int NOT NULL COMMENT '璁惧搴曢儴璺濇満鏌滈《绔窛绂?',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_device_cabinet_child_device_device_extra_of_cabinet_1`(`cabinet_id` ASC) USING BTREE,
  CONSTRAINT `device_cabinet_child_device_ibfk_1` FOREIGN KEY (`cabinet_id`) REFERENCES `device_extra_of_cabinet` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 73 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"资产管理-设备管理-机柜-设备\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"机柜内设备\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 1,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"机柜内设备\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"机柜内设备\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_cabinet_log
-- ----------------------------
DROP TABLE IF EXISTS `device_cabinet_log`;
CREATE TABLE `device_cabinet_log`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鏈烘煖鎿嶄綔鏃ュ織id',
  `cabinet_id` bigint NOT NULL COMMENT '鏈烘煖id',
  `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鎿嶄綔鍐呭',
  `create_time` datetime NOT NULL COMMENT '鎿嶄綔鏃堕棿',
  `operate_user_id` bigint NOT NULL COMMENT '鎿嶄綔鐢ㄦ埛id',
  `operate_username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鎿嶄綔鐢ㄦ埛鍚?',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_device_cabinet_log_device_extra_of_cabinet_1`(`cabinet_id` ASC) USING BTREE,
  CONSTRAINT `device_cabinet_log_ibfk_1` FOREIGN KEY (`cabinet_id`) REFERENCES `device_extra_of_cabinet` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 116 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"资产管理-设备管理-机柜-操作日志\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"机柜操作日志\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"机柜操作日志\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"机柜操作日志\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_extra_of_cabinet
-- ----------------------------
DROP TABLE IF EXISTS `device_extra_of_cabinet`;
CREATE TABLE `device_extra_of_cabinet`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鏈烘煖id',
  `device_id` bigint NOT NULL COMMENT '璁惧id',
  `layer_total` int NOT NULL DEFAULT 56 COMMENT '鏈烘煖灞傛暟',
  `layer_used` int NOT NULL DEFAULT 0 COMMENT '鏈烘煖宸蹭娇鐢ㄥ眰鏁?',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_device_extra_of_cabinet_device_1`(`device_id` ASC) USING BTREE,
  CONSTRAINT `device_extra_of_cabinet_ibfk_1` FOREIGN KEY (`device_id`) REFERENCES `device` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 6673 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '机柜设备额外信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_floor
-- ----------------------------
DROP TABLE IF EXISTS `device_floor`;
CREATE TABLE `device_floor`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '妤煎眰id',
  `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '妤煎眰鍚嶇О',
  `building_id` bigint NOT NULL COMMENT '妤兼爧id',
  `create_time` datetime NOT NULL COMMENT '妤煎眰鍒涘缓鏃堕棿',
  `update_time` datetime NOT NULL COMMENT '妤煎眰鏇存柊鏃堕棿',
  `update_user_id` bigint NOT NULL COMMENT '鏈€鍚庢洿鏂扮敤鎴穒d',
  `update_username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鏈€鍚庢洿鏂扮敤鎴峰悕',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `name`(`name` ASC, `building_id` ASC) USING BTREE,
  INDEX `fk_floor_building_1`(`building_id` ASC) USING BTREE,
  CONSTRAINT `device_floor_ibfk_1` FOREIGN KEY (`building_id`) REFERENCES `device_building` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 29 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"资产管理-楼层管理\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"楼层\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"楼层\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"楼层\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_room
-- ----------------------------
DROP TABLE IF EXISTS `device_room`;
CREATE TABLE `device_room`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鎴块棿id',
  `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鎴块棿鍚嶇О',
  `floor_id` bigint NOT NULL COMMENT '妤煎眰id',
  `number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鎴块棿缂栧彿',
  `create_time` datetime NOT NULL COMMENT '鎴块棿鍒涘缓鏃堕棿',
  `update_time` datetime NOT NULL COMMENT '鎴块棿鏈€鍚庢洿鏂版椂闂?',
  `update_user_id` bigint NOT NULL COMMENT '鎴块棿鏈€鍚庢洿鏂扮敤鎴穒d',
  `update_username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鎴块棿鏈€鍚庢洿鏂扮敤鎴峰悕',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `name`(`name` ASC, `floor_id` ASC) USING BTREE,
  INDEX `fk_room_floor_1`(`floor_id` ASC) USING BTREE,
  CONSTRAINT `device_room_ibfk_1` FOREIGN KEY (`floor_id`) REFERENCES `device_floor` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 95 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"资产管理-房间管理\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"房间\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"房间\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"房间\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_room_and_check_item
-- ----------------------------
DROP TABLE IF EXISTS `device_room_and_check_item`;
CREATE TABLE `device_room_and_check_item`  (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `room_id` bigint NOT NULL COMMENT '鎴块棿id',
  `check_item_id` bigint NOT NULL COMMENT '妫€鏌ラ」id',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_device_room_and_check_item_device_room_1`(`room_id` ASC) USING BTREE,
  INDEX `device_room_and_check_item_ibfk_1`(`check_item_id` ASC) USING BTREE,
  CONSTRAINT `device_room_and_check_item_ibfk_1` FOREIGN KEY (`check_item_id`) REFERENCES `check_item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `device_room_and_check_item_ibfk_2` FOREIGN KEY (`room_id`) REFERENCES `device_room` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 944 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '房间与检查项' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_template
-- ----------------------------
DROP TABLE IF EXISTS `device_template`;
CREATE TABLE `device_template`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '璁惧id',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璁惧鍚嶇О',
  `layer_count` int NOT NULL COMMENT '鍗犵敤灞傛暟',
  `vendor` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璁惧鍘傚晢',
  `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璁惧鍨嬪彿',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"资产管理-设备管理-机柜-设备模板\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"机柜内设备模板\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 1,\r\n    \"remove\": 1,\r\n    \"removes\": 0,\r\n    \"update\": 1,\r\n    \"query\": 1,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"机柜内设备模板\",\r\n    \"prefix\": \"device\",\r\n    \"remarks\": \"机柜内设备模板\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for patrol_plan
-- ----------------------------
DROP TABLE IF EXISTS `patrol_plan`;
CREATE TABLE `patrol_plan`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `route_id` bigint NOT NULL COMMENT '璺嚎id',
  `user_id` bigint NOT NULL COMMENT '鍒涘缓浜篿d',
  `number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '缂栧彿',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍚嶇О',
  `disabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁绂佺敤',
  `type` int NOT NULL COMMENT '绫诲瀷 1:鏃ヨ鍒?2:鍛ㄨ鍒?3:鏈堣鍒?4:瀛ｈ鍒?5:鍗婂勾璁″垝 6:骞磋鍒?',
  `run_model` int NOT NULL DEFAULT 1 COMMENT '鎵ц妯″紡 1:鍏朵腑涓€浜?2:姣忎汉鍒嗗埆',
  `begin_date` date NOT NULL COMMENT '璁″垝鎵ц寮€濮嬫棩鏈?',
  `end_date` date NULL DEFAULT NULL COMMENT '璁″垝鎵ц缁撴潫鏃ユ湡锛岀┖浠ｈ〃姘镐笉缁撴潫',
  `begin_time` time NOT NULL COMMENT '浠诲姟鎵ц寮€濮嬫椂闂?',
  `end_time` time NOT NULL COMMENT '浠诲姟鎵ц缁撴潫鏃堕棿',
  `days` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '璁″垝鍖呭惈鐨勫ぉ [1-365]',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `plan_no_unique_index`(`number` ASC) USING BTREE,
  UNIQUE INDEX `plan_name_unique_index`(`name` ASC) USING BTREE,
  INDEX `plan_type_index`(`type` ASC) USING BTREE,
  INDEX `plan_status_index`(`disabled` ASC) USING BTREE,
  INDEX `user_id`(`user_id` ASC) USING BTREE,
  INDEX `check_route_id_index`(`route_id` ASC) USING BTREE,
  CONSTRAINT `patrol_plan_ibfk_1` FOREIGN KEY (`route_id`) REFERENCES `check_route` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `patrol_plan_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 87 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"巡检计划-巡检计划查询\",\r\n    \"prefix\": \"patrol\",\r\n    \"remarks\": \"巡检计划\",\r\n    \"version\": \"1.0.2\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"巡检计划\",\r\n    \"prefix\": \"patrol\",\r\n    \"remarks\": \"巡检计划\",\r\n    \"version\": \"1.0.2\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for patrol_plan_and_system_user
-- ----------------------------
DROP TABLE IF EXISTS `patrol_plan_and_system_user`;
CREATE TABLE `patrol_plan_and_system_user`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
  `plan_id` bigint NOT NULL COMMENT '宸℃璁″垝id',
  `user_id` bigint NOT NULL COMMENT '鎵ц浜篿d',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `plan_id`(`plan_id` ASC) USING BTREE,
  INDEX `user_id`(`user_id` ASC) USING BTREE,
  CONSTRAINT `patrol_plan_and_system_user_ibfk_1` FOREIGN KEY (`plan_id`) REFERENCES `patrol_plan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `patrol_plan_and_system_user_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 770 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '巡检计划与执行人' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for patrol_task
-- ----------------------------
DROP TABLE IF EXISTS `patrol_task`;
CREATE TABLE `patrol_task`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `plan_id` bigint NOT NULL COMMENT '璁″垝id',
  `route_id` bigint NOT NULL COMMENT '璺嚎id',
  `route_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璺嚎鍚嶇О',
  `route_responsibler` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璐熻矗浜哄悕绉?',
  `route_telephone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鑱旂郴鐢佃瘽',
  `user_id` bigint NOT NULL COMMENT '鍒涘缓浜篿d',
  `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍒涘缓浜哄悕绉?',
  `number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '缂栧彿',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍚嶇О',
  `type` int NOT NULL COMMENT '绫诲瀷 1:鏃ヨ鍒?2:鍛ㄨ鍒?3:鏈堣鍒?4:瀛ｈ鍒?5:鍗婂勾璁″垝 6:骞磋鍒?',
  `status` int NOT NULL DEFAULT 1 COMMENT '鐘舵€?1:鏈紑濮?2:杩涜涓?3:姝ｅ父瀹屾垚 4:瓒呮椂婕忔 5:瓒呮椂瀹屾垚',
  `run_model` int NOT NULL DEFAULT 1 COMMENT '鎵ц妯″紡 1:鍏朵腑涓€浜?2:姣忎汉鍒嗗埆',
  `disabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁绂佺敤',
  `begin_time` datetime NOT NULL COMMENT '浠诲姟鎵ц寮€濮嬫椂闂?',
  `end_time` datetime NOT NULL COMMENT '浠诲姟鎵ц缁撴潫鏃堕棿',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_id`(`user_id` ASC) USING BTREE,
  INDEX `route_id`(`route_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7839 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"巡检计划-巡检任务\",\r\n    \"prefix\": \"patrol\",\r\n    \"remarks\": \"巡检任务\",\r\n    \"version\": \"1.0.3\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"巡检任务\",\r\n    \"prefix\": \"patrol\",\r\n    \"remarks\": \"巡检任务\",\r\n    \"version\": \"1.0.3\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for patrol_task_and_system_user
-- ----------------------------
DROP TABLE IF EXISTS `patrol_task_and_system_user`;
CREATE TABLE `patrol_task_and_system_user`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
  `task_id` bigint NOT NULL COMMENT '宸℃浠诲姟id',
  `user_id` bigint NOT NULL COMMENT '鎵ц浜篿d',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `task_id`(`task_id` ASC) USING BTREE,
  INDEX `user_id`(`user_id` ASC) USING BTREE,
  CONSTRAINT `patrol_task_and_system_user_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `patrol_task` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `patrol_task_and_system_user_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 30472 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '巡检任务与执行人' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for patrol_task_record
-- ----------------------------
DROP TABLE IF EXISTS `patrol_task_record`;
CREATE TABLE `patrol_task_record`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
  `task_id` bigint NOT NULL COMMENT '浠诲姟id',
  `user_id` bigint NOT NULL COMMENT '鎵ц鐢ㄦ埛id',
  `username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鎵ц鐢ㄦ埛鍚?',
  `building_id` bigint NOT NULL COMMENT '妤兼爧id',
  `building_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '妤兼爧鍚嶇О',
  `floor_id` bigint NOT NULL COMMENT '妤煎眰id',
  `floor_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '妤煎眰鍚嶇О',
  `room_id` bigint NOT NULL COMMENT '鎴块棿id',
  `room_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鎴块棿鍚嶇О',
  `room_number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鎴块棿缂栧彿',
  `device_id` bigint NULL DEFAULT NULL COMMENT '璁惧id',
  `device_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧鍚嶇О',
  `check_item_id` bigint NOT NULL COMMENT '妫€鏌ラ」id',
  `check_item_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '妫€鏌ラ」鍚嶇О',
  `check_item_snapshot` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '妫€鏌ラ」蹇収 json',
  `oneself` tinyint(1) NULL DEFAULT NULL COMMENT '鏄惁鏄湰浜哄畬鎴?',
  `completed` tinyint(1) NOT NULL COMMENT '鏄惁瀹屾垚',
  `check_item_type` int NOT NULL COMMENT '妫€鏌ラ」绫诲埆 1閫夋嫨銆?鏁板瓧銆?鏂囨湰銆?鎷嶇収',
  `type` int NOT NULL COMMENT '绫诲瀷 1:鎴块棿 2:璁惧',
  `score` int NULL DEFAULT NULL COMMENT '鍒嗘暟',
  `score_total` int NOT NULL COMMENT '鍚堟牸鎬诲垎鏁?',
  `qualified` tinyint(1) NULL DEFAULT NULL COMMENT '鏄惁鍚堟牸',
  `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '璁板綍鍊硷紝鐢ㄦ埛杈撳叆',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  `update_time` datetime NOT NULL COMMENT '鏇存柊鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_patrol_task_record_check_item_1`(`check_item_id` ASC) USING BTREE,
  INDEX `fk_patrol_task_record_system_user_1`(`user_id` ASC) USING BTREE,
  INDEX `fk_patrol_task_record_patrol_task_1`(`task_id` ASC) USING BTREE,
  CONSTRAINT `patrol_task_record_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `patrol_task` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 3603972 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"巡检任务-巡检任务记录\",\r\n    \"prefix\": \"patrol\",\r\n    \"remarks\": \"巡检任务记录\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"巡检任务记录\",\r\n    \"prefix\": \"patrol\",\r\n    \"remarks\": \"巡检任务记录\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for stock_change_record
-- ----------------------------
DROP TABLE IF EXISTS `stock_change_record`;
CREATE TABLE `stock_change_record`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id涓婚敭',
  `goods_id` bigint NOT NULL COMMENT '鐗╁搧id',
  `count` int NOT NULL COMMENT '鍙樺寲鏁伴噺锛屽叆搴撴椂澶т簬0锛屽嚭搴撴椂灏忎簬0',
  `create_time` datetime NOT NULL COMMENT '鎿嶄綔鏃堕棿',
  `user_id` bigint NULL DEFAULT NULL COMMENT '棰嗗彇浜篿d',
  `operator_id` bigint NULL DEFAULT NULL COMMENT '鎿嶄綔浜篿d',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_change_record_goods_1`(`goods_id` ASC) USING BTREE,
  CONSTRAINT `stock_change_record_ibfk_1` FOREIGN KEY (`goods_id`) REFERENCES `stock_goods` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 50 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"出入库管理-出入库记录\",\r\n    \"prefix\": \"stock\",\r\n    \"remarks\": \"出入库记录\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"出入库记录\",\r\n    \"prefix\": \"stock\",\r\n    \"remarks\": \"出入库记录\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for stock_classify
-- ----------------------------
DROP TABLE IF EXISTS `stock_classify`;
CREATE TABLE `stock_classify`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id涓婚敭',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍒嗙被鍚嶇О',
  `create_time` datetime NOT NULL COMMENT '娣诲姞鏃堕棿',
  `update_time` datetime NOT NULL COMMENT '鏇存柊鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"出入库管理-物品分类\",\r\n    \"prefix\": \"stock\",\r\n    \"remarks\": \"物品类别\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"物品类别\",\r\n    \"prefix\": \"stock\",\r\n    \"remarks\": \"物品类别\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for stock_goods
-- ----------------------------
DROP TABLE IF EXISTS `stock_goods`;
CREATE TABLE `stock_goods`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id涓婚敭锛堢墿鍝佺紪鍙凤級',
  `classify_id` bigint NOT NULL COMMENT '鐗╁搧鍒嗙被id',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鐗╁搧鍚嶇О',
  `count` int NOT NULL COMMENT '鐗╁搧鏁伴噺',
  `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鐗╁搧浠嬬粛',
  `create_time` datetime NOT NULL COMMENT '鐗╁搧娣诲姞鏃堕棿',
  `update_time` datetime NOT NULL COMMENT '鐗╁搧鏇存柊鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_goods_classify_1`(`classify_id` ASC) USING BTREE,
  CONSTRAINT `stock_goods_ibfk_1` FOREIGN KEY (`classify_id`) REFERENCES `stock_classify` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"出入库管理-物品库存\",\r\n    \"prefix\": \"stock\",\r\n    \"remarks\": \"物品\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"物品\",\r\n    \"prefix\": \"stock\",\r\n    \"remarks\": \"物品\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_attendance
-- ----------------------------
DROP TABLE IF EXISTS `system_attendance`;
CREATE TABLE `system_attendance`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `user_id` bigint NOT NULL COMMENT '鐢ㄦ埛id',
  `last_score` int NOT NULL COMMENT '涓婃鍒嗗€?',
  `change_score` int NOT NULL COMMENT '鍙樺姩鍒嗗€?',
  `current_score` int NOT NULL COMMENT '褰撳墠鍒嗗€?',
  `month` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鑰冨嫟骞存湀',
  `type` int NOT NULL COMMENT '鑰冨嫟绫诲瀷 1:浠诲姟 2:璇勫垎 3:鍒濆',
  `event` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '浜嬩欢',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_id`(`user_id` ASC) USING BTREE,
  CONSTRAINT `system_attendance_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 21895 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"系统设置-考勤管理\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"考勤\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"考勤管理\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"考勤\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_database_backup
-- ----------------------------
DROP TABLE IF EXISTS `system_database_backup`;
CREATE TABLE `system_database_backup`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id涓婚敭',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鏂囦欢鍚?',
  `path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璁块棶璺緞',
  `type` int NOT NULL COMMENT '绫诲瀷 1:鑷姩澶囦唤 2:鎵嬪姩澶囦唤',
  `status` int NULL DEFAULT NULL COMMENT '鐘舵€?1:姝ｅ湪澶囦唤 2:澶囦唤澶辫触 3:澶囦唤瀹屾垚',
  `file_size` bigint NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '澶囨敞',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 93 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"系统设置-数据备份\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"数据备份\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"数据备份\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"数据备份\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_dept
-- ----------------------------
DROP TABLE IF EXISTS `system_dept`;
CREATE TABLE `system_dept`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id涓婚敭',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍚嶇О',
  `parent_id` bigint NOT NULL COMMENT '涓婄骇閮ㄩ棬id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"系统设置-部门管理\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"部门\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"部门\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"部门\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_electricity
-- ----------------------------
DROP TABLE IF EXISTS `system_electricity`;
CREATE TABLE `system_electricity`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id涓婚敭',
  `electricity_it` float(11, 2) NOT NULL COMMENT 'it鐢ㄧ數閲?',
  `electricity_total` float(11, 2) NOT NULL COMMENT '鎬荤敤鐢甸噺',
  `month` date NOT NULL COMMENT '骞存湀',
  `electricity_other` float(11, 2) NOT NULL DEFAULT 0.00,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `month`(`month` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"系统设置-PUE管理\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"电量\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"电量管理\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"电量\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_log
-- ----------------------------
DROP TABLE IF EXISTS `system_log`;
CREATE TABLE `system_log`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鏃ュ織ID',
  `user_id` bigint NULL DEFAULT NULL COMMENT '鐢ㄦ埛ID',
  `user_ip` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鐢ㄦ埛IP',
  `method` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '璇锋眰绫诲瀷',
  `platform` int NOT NULL COMMENT '骞冲彴绫诲瀷 1:绠＄悊绔?2:灏忕▼搴忕',
  `uri` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '璇锋眰鎺ュ彛鍚?',
  `success` tinyint(1) NULL DEFAULT NULL COMMENT '鏄惁璇锋眰鎴愬姛',
  `time` bigint NULL DEFAULT NULL COMMENT '璇锋眰鑰楁椂',
  `request` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '璇锋眰鍙傛暟',
  `response` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '鍝嶅簲缁撴灉',
  `file_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '寮傚父鏂囦欢',
  `line_number` int NULL DEFAULT NULL COMMENT '寮傚父琛屽彿',
  `create_time` datetime NULL DEFAULT NULL COMMENT '璇锋眰鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 97231 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"系统设置-操作日志管理\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"操作日志\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"操作日志\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"操作日志\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_login_log
-- ----------------------------
DROP TABLE IF EXISTS `system_login_log`;
CREATE TABLE `system_login_log`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鐧诲綍鏃ュ織ID',
  `user_id` bigint NOT NULL COMMENT '鐢ㄦ埛ID',
  `platform` int NOT NULL COMMENT '骞冲彴绫诲瀷 1:绠＄悊绔?2:灏忕▼搴忕',
  `login_time` datetime NOT NULL COMMENT '鐧诲綍鏃堕棿',
  `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鐢ㄦ埛IP',
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍦板潃',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_id`(`user_id` ASC) USING BTREE,
  CONSTRAINT `system_login_log_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1000 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"系统设置-登录日志管理\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"登录日志\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"登录日志\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"登录日志\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_permissions
-- ----------------------------
DROP TABLE IF EXISTS `system_permissions`;
CREATE TABLE `system_permissions`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鏉冮檺ID',
  `parent_id` bigint NULL DEFAULT NULL COMMENT '鐖剁骇鏉冮檺ID',
  `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '鍚嶇О',
  `method` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT '' COMMENT '璇锋眰绫诲瀷',
  `uri` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '璇锋眰璺緞',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  `disabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁绂佺敤',
  `seq` int NULL DEFAULT NULL COMMENT '鎺掑簭',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `name`(`name` ASC) USING BTREE,
  UNIQUE INDEX `method`(`method` ASC, `uri` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3456 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"系统设置-权限管理\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"权限\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"权限\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"权限\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_role
-- ----------------------------
DROP TABLE IF EXISTS `system_role`;
CREATE TABLE `system_role`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '瑙掕壊ID',
  `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '鍚嶇О',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  `disabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁绂佺敤',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `name`(`name` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"系统设置-角色管理\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"角色\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"角色\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"角色\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_role_and_permissions
-- ----------------------------
DROP TABLE IF EXISTS `system_role_and_permissions`;
CREATE TABLE `system_role_and_permissions`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '瑙掕壊鏉冮檺ID',
  `role_id` bigint NOT NULL COMMENT '瑙掕壊ID',
  `permissions_id` bigint NOT NULL COMMENT '鏉冮檺ID',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `role_id`(`role_id` ASC) USING BTREE,
  INDEX `permissions_id`(`permissions_id` ASC) USING BTREE,
  CONSTRAINT `system_role_and_permissions_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `system_role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `system_role_and_permissions_ibfk_2` FOREIGN KEY (`permissions_id`) REFERENCES `system_permissions` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 4393 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色与权限' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_user
-- ----------------------------
DROP TABLE IF EXISTS `system_user`;
CREATE TABLE `system_user`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鐢ㄦ埛ID',
  `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬id',
  `username` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '鐢ㄦ埛鍚?',
  `password` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '瀵嗙爜',
  `telephone` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '鎵嬫満鍙?',
  `disabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁绂佺敤',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `username`(`username` ASC) USING BTREE,
  UNIQUE INDEX `telephone`(`telephone` ASC) USING BTREE,
  INDEX `id`(`id` ASC) USING BTREE,
  INDEX `system_user_ibfk_1`(`dept_id` ASC) USING BTREE,
  CONSTRAINT `system_user_ibfk_1` FOREIGN KEY (`dept_id`) REFERENCES `system_dept` (`id`) ON DELETE SET NULL ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 55 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_unicode_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"系统设置-用户管理\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"用户\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"用户\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"用户\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_user_and_role
-- ----------------------------
DROP TABLE IF EXISTS `system_user_and_role`;
CREATE TABLE `system_user_and_role`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鐢ㄦ埛瑙掕壊ID',
  `user_id` bigint NOT NULL COMMENT '鐢ㄦ埛ID',
  `role_id` bigint NOT NULL COMMENT '瑙掕壊ID',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_role_ibfk_1`(`user_id` ASC) USING BTREE,
  INDEX `user_role_ibfk_2`(`role_id` ASC) USING BTREE,
  CONSTRAINT `system_user_and_role_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  CONSTRAINT `system_user_and_role_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `system_role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 55 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '用户与角色' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for system_user_comment
-- ----------------------------
DROP TABLE IF EXISTS `system_user_comment`;
CREATE TABLE `system_user_comment`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id涓婚敭',
  `user_id` bigint NOT NULL COMMENT '璇勪环浜篿d',
  `username` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璇勪环浜哄鍚?',
  `respondent_user_id` bigint NOT NULL COMMENT '琚瘎浠蜂汉id',
  `respondent_username` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '琚瘎浠蜂汉濮撳悕',
  `content` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璇勮鍐呭',
  `images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '璇勮鍥剧墖鍦板潃鏁扮粍',
  `score` int NOT NULL COMMENT '璇勮鍒嗘暟',
  `create_time` datetime NOT NULL COMMENT '璇勮鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"系统设置-用户评价\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"用户评价\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"用户评价\",\r\n    \"prefix\": \"system\",\r\n    \"remarks\": \"用户评价\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for temporary_task
-- ----------------------------
DROP TABLE IF EXISTS `temporary_task`;
CREATE TABLE `temporary_task`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '浠诲姟id',
  `room_id` bigint NOT NULL COMMENT '鎴块棿id',
  `belong_system` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '鎵€灞炵郴缁?',
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '浠诲姟鏍囬',
  `type` int NOT NULL COMMENT '浠诲姟绫诲瀷  1:鑸换鍔?2:杈冩€ヤ换鍔?3:绱ф€ヤ换鍔?',
  `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '浠诲姟鍐呭',
  `user_id` bigint NOT NULL COMMENT '浠诲姟鍒涘缓鐢ㄦ埛id',
  `status` int NOT NULL COMMENT '浠诲姟鐘舵€?1:姝ｅ湪澶勭悊 2:宸茬粡瀹屾垚 3:宸茬粡鍙栨秷 4:瓒呮椂浠诲姟',
  `audit_status` int NULL DEFAULT NULL COMMENT '瀹℃牳鐘舵€?1:鏈彁浜?2:寰呭鏍?3:涓嶉€氳繃',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃牳澶囨敞',
  `feedback_total` int NOT NULL DEFAULT 0 COMMENT '浠诲姟鍙嶉鏁伴噺',
  `publish_time` datetime NOT NULL COMMENT '浠诲姟鍙戝竷鏃堕棿',
  `finish_time` datetime NOT NULL COMMENT '浠诲姟瀹屾垚鏃堕棿',
  `images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '浠诲姟鍥剧墖',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_id`(`user_id` ASC) USING BTREE,
  CONSTRAINT `temporary_task_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 120 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"临时任务-全部临时任务\",\r\n    \"prefix\": \"temporary_task\",\r\n    \"remarks\": \"临时任务\",\r\n    \"version\": \"1.0.2\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"临时任务\",\r\n    \"prefix\": \"temporary_task\",\r\n    \"remarks\": \"临时任务\",\r\n    \"version\": \"1.0.2\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for temporary_task_and_system_user
-- ----------------------------
DROP TABLE IF EXISTS `temporary_task_and_system_user`;
CREATE TABLE `temporary_task_and_system_user`  (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `task_id` bigint NOT NULL COMMENT '浠诲姟id',
  `user_id` bigint NOT NULL COMMENT '鐢ㄦ埛id',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_id`(`user_id` ASC) USING BTREE,
  INDEX `temporary_task_executor_ibfk_1`(`task_id` ASC) USING BTREE,
  CONSTRAINT `temporary_task_and_system_user_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `temporary_task` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `temporary_task_and_system_user_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 148 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '临时任务与用户' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for temporary_task_feedback
-- ----------------------------
DROP TABLE IF EXISTS `temporary_task_feedback`;
CREATE TABLE `temporary_task_feedback`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鍙嶉id',
  `task_id` bigint NOT NULL COMMENT '浠诲姟id',
  `user_id` bigint NOT NULL COMMENT '鍙嶉浜篿d',
  `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍙嶉鍐呭',
  `images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '鍙嶉鍥剧墖',
  `create_time` datetime NOT NULL COMMENT '鍙嶉鍒涘缓鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `temporary_task_feedback_ibfk_1`(`task_id` ASC) USING BTREE,
  INDEX `user_id`(`user_id` ASC) USING BTREE,
  CONSTRAINT `temporary_task_feedback_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `temporary_task` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `temporary_task_feedback_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 99 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"临时任务-临时任务反馈\",\r\n    \"prefix\": \"temporary_task\",\r\n    \"remarks\": \"临时任务反馈\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"临时任务反馈\",\r\n    \"prefix\": \"temporary_task\",\r\n    \"remarks\": \"临时任务反馈\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 1\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for upkeep_plan
-- ----------------------------
DROP TABLE IF EXISTS `upkeep_plan`;
CREATE TABLE `upkeep_plan`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `route_id` bigint NOT NULL COMMENT '宸℃璺嚎id',
  `user_id` bigint NOT NULL COMMENT '鍒涘缓浜篿d',
  `number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '缂栧彿',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍚嶇О',
  `disabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁绂佺敤',
  `type` int NOT NULL COMMENT '绫诲瀷 1鏃ヨ鍒掋€?鍛ㄨ鍒掋€?鏈堣鍒?',
  `run_model` int NOT NULL DEFAULT 1 COMMENT '鎵ц妯″紡 1鍏朵腑涓€浜恒€?姣忎汉鍒嗗埆',
  `begin_date` date NOT NULL COMMENT '璁″垝鎵ц寮€濮嬫棩鏈?',
  `end_date` date NULL DEFAULT NULL COMMENT '璁″垝鎵ц缁撴潫鏃ユ湡锛岀┖浠ｈ〃姘镐笉缁撴潫',
  `begin_time` time NOT NULL COMMENT '浠诲姟鎵ц寮€濮嬫椂闂?',
  `end_time` time NOT NULL COMMENT '浠诲姟鎵ц缁撴潫鏃堕棿',
  `weeks` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍛ㄨ鍒?[1-7]',
  `months` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏈堣鍒?[1-31]',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `plan_no_unique_index`(`number` ASC) USING BTREE,
  UNIQUE INDEX `plan_name_unique_index`(`name` ASC) USING BTREE,
  INDEX `plan_type_index`(`type` ASC) USING BTREE,
  INDEX `plan_status_index`(`disabled` ASC) USING BTREE,
  INDEX `fk_upkeep_plan_check_route_1`(`route_id` ASC) USING BTREE,
  INDEX `fk_upkeep_plan_system_user_1`(`user_id` ASC) USING BTREE,
  CONSTRAINT `upkeep_plan_ibfk_1` FOREIGN KEY (`route_id`) REFERENCES `check_route` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `upkeep_plan_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"保养计划-保养计划查询\",\r\n    \"prefix\": \"upkeep\",\r\n    \"remarks\": \"保养计划\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"保养计划-保养计划查询\",\r\n    \"prefix\": \"upkeep\",\r\n    \"remarks\": \"保养计划\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for upkeep_plan_and_system_user
-- ----------------------------
DROP TABLE IF EXISTS `upkeep_plan_and_system_user`;
CREATE TABLE `upkeep_plan_and_system_user`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
  `plan_id` bigint NOT NULL COMMENT '宸℃璁″垝id',
  `user_id` bigint NOT NULL COMMENT '鎵ц浜篿d',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_upkeep_plan_and_system_user_upkeep_plan_1`(`plan_id` ASC) USING BTREE,
  INDEX `fk_upkeep_plan_and_system_user_system_user_1`(`user_id` ASC) USING BTREE,
  CONSTRAINT `upkeep_plan_and_system_user_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  CONSTRAINT `upkeep_plan_and_system_user_ibfk_2` FOREIGN KEY (`plan_id`) REFERENCES `upkeep_plan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '保养计划与执行人' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for upkeep_task
-- ----------------------------
DROP TABLE IF EXISTS `upkeep_task`;
CREATE TABLE `upkeep_task`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id 涓婚敭',
  `plan_id` bigint NOT NULL COMMENT '璁″垝id',
  `route_id` bigint NOT NULL COMMENT '宸℃璺嚎id',
  `user_id` bigint NOT NULL COMMENT '鍒涘缓浜篿d',
  `number` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '缂栧彿',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍚嶇О',
  `type` int NOT NULL COMMENT '绫诲瀷 1鏃ヨ鍒掋€?鍛ㄨ鍒掋€?鏈堣鍒?',
  `status` int NOT NULL DEFAULT 1 COMMENT '鐘舵€?1鏈紑濮嬨€?杩涜涓€?宸茬粨鏉?',
  `run_model` int NOT NULL DEFAULT 1 COMMENT '鎵ц妯″紡 1鍏朵腑涓€浜恒€?姣忎汉鍒嗗埆',
  `disabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁绂佺敤',
  `begin_time` datetime NOT NULL COMMENT '浠诲姟鎵ц寮€濮嬫椂闂?',
  `end_time` datetime NOT NULL COMMENT '浠诲姟鎵ц缁撴潫鏃堕棿',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_upkeep_task_check_route_1`(`route_id` ASC) USING BTREE,
  INDEX `fk_upkeep_task_system_user_1`(`user_id` ASC) USING BTREE,
  CONSTRAINT `upkeep_task_ibfk_1` FOREIGN KEY (`route_id`) REFERENCES `check_route` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `upkeep_task_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"保养计划-保养任务\",\r\n    \"prefix\": \"upkeep\",\r\n    \"remarks\": \"保养任务\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"保养计划-保养任务\",\r\n    \"prefix\": \"upkeep\",\r\n    \"remarks\": \"保养任务\",\r\n    \"version\": \"1.0.0\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for upkeep_task_and_system_user
-- ----------------------------
DROP TABLE IF EXISTS `upkeep_task_and_system_user`;
CREATE TABLE `upkeep_task_and_system_user`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
  `task_id` bigint NOT NULL COMMENT '宸℃浠诲姟id',
  `user_id` bigint NOT NULL COMMENT '鎵ц浜篿d',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_patrol_task_and_system_user_copy_1_upkeep_task_1`(`task_id` ASC) USING BTREE,
  INDEX `fk_patrol_task_and_system_user_copy_1_system_user_1`(`user_id` ASC) USING BTREE,
  CONSTRAINT `upkeep_task_and_system_user_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `system_user` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  CONSTRAINT `upkeep_task_and_system_user_ibfk_2` FOREIGN KEY (`task_id`) REFERENCES `upkeep_task` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '保养任务与执行人' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for visitor_audit
-- ----------------------------
DROP TABLE IF EXISTS `visitor_audit`;
CREATE TABLE `visitor_audit`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id涓婚敭',
  `openid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鐢ㄦ埛openid',
  `number` int NOT NULL COMMENT '缂栧彿锛屽勾+4浣嶇紪鍙?',
  `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璁垮濮撳悕',
  `user_phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璁垮鎵嬫満鍙?',
  `company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璁垮鍏徃',
  `duration` int NOT NULL COMMENT '璁块棶鏃堕暱锛堝皬鏃讹級',
  `itinerary_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '琛岀▼鐮?',
  `health_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍋ュ悍鐮?',
  `high_risk` tinyint(1) NULL DEFAULT 0 COMMENT '鏄惁楂橀闄?',
  `reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '浜嬬敱',
  `information` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '瀹℃牳璧勬枡',
  `status` int NOT NULL COMMENT '瀹℃牳鐘舵€?1:鏈鏍?2:閫氳繃 3:鎷掔粷',
  `entry_time` datetime NULL DEFAULT NULL COMMENT '瀹℃壒銆佽繘鍏ユ椂闂?',
  `operating_user_id` bigint NULL DEFAULT NULL COMMENT '鎿嶄綔鐢ㄦ埛id',
  `operating_username` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎿嶄綔鐢ㄦ埛濮撳悕',
  `leave_time` datetime NULL DEFAULT NULL COMMENT '绂诲紑鏃堕棿',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍑哄満澶囨敞',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 411 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"访客管理-访客审批\",\r\n    \"prefix\": \"visitor\",\r\n    \"remarks\": \"访客审批\",\r\n    \"version\": \"1.0.1\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"访客审批\",\r\n    \"prefix\": \"visitor\",\r\n    \"remarks\": \"访客审批\",\r\n    \"version\": \"1.0.1\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for visitor_backup
-- ----------------------------
DROP TABLE IF EXISTS `visitor_backup`;
CREATE TABLE `visitor_backup`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id涓婚敭',
  `operating_user_id` bigint NOT NULL COMMENT '鎿嶄綔鐢ㄦ埛id',
  `operating_username` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鎿嶄綔鐢ㄦ埛濮撳悕',
  `username` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璁垮濮撳悕',
  `user_phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璁垮鎵嬫満鍙?',
  `gender` int NOT NULL DEFAULT 0 COMMENT '鎬у埆 1:鐢?2:濂?',
  `idcard` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '韬唤璇佸彿',
  `idcard_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '韬唤璇佺収鐗?',
  `valid_time` datetime NOT NULL COMMENT '鏈夋晥鎴鏃堕棿',
  `company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璁垮鍏徃',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  `update_time` datetime NOT NULL COMMENT '鏇存柊鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `username`(`username` ASC, `user_phone` ASC) USING BTREE,
  INDEX `username_2`(`username` ASC) USING BTREE,
  INDEX `user_phone`(`user_phone` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"访客管理-备案管理\",\r\n    \"prefix\": \"visitor\",\r\n    \"remarks\": \"备案\",\r\n    \"version\": \"1.0.1\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 1,\r\n    \"removes\": 1,\r\n    \"update\": 0,\r\n    \"query\": 1,\r\n    \"queries\": 1\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"备案管理\",\r\n    \"prefix\": \"visitor\",\r\n    \"remarks\": \"备案\",\r\n    \"version\": \"1.0.1\",\r\n    \"ext\": 0,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for visitor_regulation
-- ----------------------------
DROP TABLE IF EXISTS `visitor_regulation`;
CREATE TABLE `visitor_regulation`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id涓婚敭',
  `user_id` bigint NOT NULL COMMENT '缂栬緫鐢ㄦ埛id',
  `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '缂栬緫鐢ㄦ埛鍚嶇О',
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍐呭',
  `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
  `update_time` datetime NOT NULL COMMENT '鏇存柊鏃堕棿',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '[\r\n{\r\n    \"name\": \"patrol-web\",\r\n    \"group\": \"访客管理-制度管理\",\r\n    \"prefix\": \"visitor\",\r\n    \"remarks\": \"制度\",\r\n    \"version\": \"1.0.1\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n},\r\n{\r\n    \"name\": \"patrol-app\",\r\n    \"group\": \"制度管理\",\r\n    \"prefix\": \"visitor\",\r\n    \"remarks\": \"制度\",\r\n    \"version\": \"1.0.1\",\r\n    \"ext\": 1,\r\n    \"add\": 0,\r\n    \"remove\": 0,\r\n    \"removes\": 0,\r\n    \"update\": 0,\r\n    \"query\": 0,\r\n    \"queries\": 0\r\n}\r\n]' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
