/*
 Navicat Premium Data Transfer

 Source Server         : 192.168.10.211mysql
 Source Server Type    : MySQL
 Source Server Version : 80029
 Source Host           : 192.168.10.211:3306
 Source Schema         : dev_cloud_test

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

 Date: 30/06/2022 14:33:35
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for dev_bind_relation
-- ----------------------------
DROP TABLE IF EXISTS `dev_bind_relation`;
CREATE TABLE `dev_bind_relation`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT,
  `dev_id` bigint(0) NULL DEFAULT NULL COMMENT '设备id',
  `tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
  `server_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '服务编码',
  `application_id` bigint(0) NULL DEFAULT NULL COMMENT '应用id',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1541718160747065347 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备-应用-关联表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for dev_info
-- ----------------------------
DROP TABLE IF EXISTS `dev_info`;
CREATE TABLE `dev_info`  (
  `id` bigint(0) NOT NULL COMMENT 'id',
  `access_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备接入id',
  `sn` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备sn',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备名称',
  `template_id` bigint(0) NULL DEFAULT NULL COMMENT '设备模板id',
  `tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '所属租户',
  `location_json` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '位置json',
  `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  `online` tinyint(1) NULL DEFAULT NULL COMMENT '设备在线状态(0-离线,1-在线)',
  `online_change_time` datetime(0) NULL DEFAULT NULL COMMENT '状态变更时间',
  `firmware_ver` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '固件版本',
  `auth_conf` json NULL COMMENT '认证配置',
  `work_info` json NULL COMMENT '工况信息',
  `creator_id` bigint(0) NULL DEFAULT NULL COMMENT '创建人id',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `dev_picture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备图片',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for dev_log
-- ----------------------------
DROP TABLE IF EXISTS `dev_log`;
CREATE TABLE `dev_log`  (
  `id` int(0) NOT NULL AUTO_INCREMENT,
  `dev_id` bigint(0) NULL DEFAULT NULL COMMENT '设备id',
  `creator_id` bigint(0) NULL DEFAULT NULL COMMENT '操作人',
  `log_type` int(0) NULL DEFAULT NULL COMMENT '日志类型',
  `log_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '日志内容',
  `month` int(0) NULL DEFAULT NULL COMMENT '年月',
  `log_time` datetime(0) NULL DEFAULT NULL COMMENT '日志时间',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '入库时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 30 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备日志' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for dev_product
-- ----------------------------
DROP TABLE IF EXISTS `dev_product`;
CREATE TABLE `dev_product`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `product_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品名称',
  `product_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品型号',
  `product_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品类型',
  `industry` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '所属行业',
  `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品说明',
  `pic_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品图片',
  `status` tinyint(1) NULL DEFAULT NULL COMMENT '状态(0-未发布,1-已发布)',
  `creator_id` bigint(0) NULL DEFAULT NULL COMMENT '创建人id',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1541970423893766146 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '产品信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for dev_protocol
-- ----------------------------
DROP TABLE IF EXISTS `dev_protocol`;
CREATE TABLE `dev_protocol`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '协议名称',
  `type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '协议类型',
  `version` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最新版本号',
  `protocol_version_id` bigint(0) NULL DEFAULT NULL COMMENT '最新协议版本号id',
  `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '协议说明',
  `creator_id` bigint(0) NULL DEFAULT NULL COMMENT '创建人id',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1541987886794604546 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '协议信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for dev_protocol_version
-- ----------------------------
DROP TABLE IF EXISTS `dev_protocol_version`;
CREATE TABLE `dev_protocol_version`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `protocol_id` bigint(0) NOT NULL COMMENT '协议id',
  `version` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '版本号',
  `status` tinyint(1) NULL DEFAULT NULL COMMENT '协议状态(0-未发布,1-已发布)',
  `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '协议说明',
  `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '协议文件路径',
  `content` json NULL COMMENT '协议内容',
  `creator_id` bigint(0) NULL DEFAULT NULL COMMENT '创建人id',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1542061004229804034 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '协议历史版本表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for dev_sys_dict
-- ----------------------------
DROP TABLE IF EXISTS `dev_sys_dict`;
CREATE TABLE `dev_sys_dict`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT,
  `type_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '类型标识符',
  `type_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '类型名称',
  `order_no` int(0) NULL DEFAULT 0 COMMENT '排序号',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '数据字典类型表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of dev_sys_dict
-- ----------------------------
INSERT INTO `dev_sys_dict` VALUES (2, 'product_type', '产品类型', 2, '2022-06-14 10:08:56', '2022-06-14 10:08:58');
INSERT INTO `dev_sys_dict` VALUES (3, 'industry', '所属行业', 3, '2022-06-14 10:09:32', '2022-06-14 10:09:35');

-- ----------------------------
-- Table structure for dev_sys_dict_item
-- ----------------------------
DROP TABLE IF EXISTS `dev_sys_dict_item`;
CREATE TABLE `dev_sys_dict_item`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT,
  `type_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '类型标识符',
  `value_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '字典值标识符',
  `value_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '字典值显示名称',
  `order_no` int(0) NULL DEFAULT 0 COMMENT '排序号',
  `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 46 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '数据字典值表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of dev_sys_dict_item
-- ----------------------------
INSERT INTO `dev_sys_dict_item` VALUES (20, 'product_type', 'DTU', 'DTU', 1, NULL, '2022-06-14 10:12:41', '2022-06-14 10:12:44');
INSERT INTO `dev_sys_dict_item` VALUES (21, 'product_type', 'RTU', 'RTU', 2, NULL, '2022-06-14 10:12:41', '2022-06-14 10:12:44');
INSERT INTO `dev_sys_dict_item` VALUES (22, 'product_type', 'router', '路由器', 3, NULL, '2022-06-14 10:12:41', '2022-06-14 10:12:44');
INSERT INTO `dev_sys_dict_item` VALUES (23, 'product_type', 'sensor', '传感器', 4, NULL, '2022-06-14 10:12:41', '2022-06-14 10:12:44');
INSERT INTO `dev_sys_dict_item` VALUES (30, 'industry', 'iot', '物联网', 1, NULL, '2022-06-14 10:13:44', '2022-06-14 10:13:48');
INSERT INTO `dev_sys_dict_item` VALUES (31, 'industry', 'fileControl', '消防', 2, NULL, '2022-06-14 10:13:44', '2022-06-14 10:13:48');
INSERT INTO `dev_sys_dict_item` VALUES (32, 'industry', 'electricity', '电力', 3, NULL, '2022-06-14 10:13:44', '2022-06-14 10:13:48');
INSERT INTO `dev_sys_dict_item` VALUES (33, 'industry', 'waterAffairs', '水务', 4, NULL, '2022-06-14 10:13:44', '2022-06-14 10:13:48');
INSERT INTO `dev_sys_dict_item` VALUES (34, 'industry', 'communication', '通信', 5, NULL, '2022-06-14 10:13:44', '2022-06-14 10:13:48');

-- ----------------------------
-- Table structure for dev_template
-- ----------------------------
DROP TABLE IF EXISTS `dev_template`;
CREATE TABLE `dev_template`  (
  `id` bigint(0) NOT NULL COMMENT 'id',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模板名称',
  `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模板说明',
  `product_id` bigint(0) NULL DEFAULT NULL COMMENT '所属产品',
  `protocol_id` bigint(0) NULL DEFAULT NULL COMMENT '协议id',
  `protocol_version_id` bigint(0) NULL DEFAULT NULL COMMENT '协议版本id',
  `status` tinyint(1) NULL DEFAULT NULL COMMENT '状态(0-未发布,1-已发布)',
  `publish_time` datetime(0) NULL DEFAULT NULL COMMENT '发布时间',
  `creator_id` bigint(0) NULL DEFAULT NULL COMMENT '创建人id',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备模板表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for dev_template_factor_conf_release
-- ----------------------------
DROP TABLE IF EXISTS `dev_template_factor_conf_release`;
CREATE TABLE `dev_template_factor_conf_release`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `template_id` bigint(0) NULL DEFAULT NULL COMMENT '设备模板id',
  `identifier` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '要素标识符',
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '要素名称',
  `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '计量单位',
  `data_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '数据类型',
  `accuracy` int(0) NULL DEFAULT NULL COMMENT '精度',
  `range_start` double NULL DEFAULT NULL COMMENT '量程开始',
  `range_end` double NULL DEFAULT NULL COMMENT '量程结束',
  `length` int(0) NULL DEFAULT NULL COMMENT '长度',
  `publish_time` datetime(0) NULL DEFAULT NULL COMMENT '发布时间',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1539543243312418820 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备模板监测要素配置-发布版' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for dev_template_factor_conf_snap
-- ----------------------------
DROP TABLE IF EXISTS `dev_template_factor_conf_snap`;
CREATE TABLE `dev_template_factor_conf_snap`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `template_id` bigint(0) NULL DEFAULT NULL COMMENT '设备模板id',
  `identifier` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '要素标识符',
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '要素名称',
  `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '计量单位',
  `data_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '数据类型',
  `accuracy` int(0) NULL DEFAULT NULL COMMENT '精度',
  `range_start` double NULL DEFAULT NULL COMMENT '量程开始',
  `range_end` double NULL DEFAULT NULL COMMENT '量程结束',
  `length` int(0) NULL DEFAULT NULL COMMENT '长度',
  `used` tinyint(1) NULL DEFAULT 0 COMMENT '是否配置(0-否,1-是)',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `custom` tinyint(1) NULL DEFAULT 0 COMMENT '是否自定义（0否不可修改 1是可修改）',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1539900910759137284 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备模板监测要素配置-快照版' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
