/*
 Navicat Premium Data Transfer

 Source Server         : 1.14.241.96
 Source Server Type    : MySQL
 Source Server Version : 80025
 Source Host           : 1.14.241.96:3306
 Source Schema         : lockinfo

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

 Date: 13/03/2023 10:56:07
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for iot_dictionaries
-- ----------------------------
DROP TABLE IF EXISTS `iot_dictionaries`;
CREATE TABLE `iot_dictionaries`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键，自动生成',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `remark` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '描述',
  `type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型',
  `value` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1399202561080299521 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for iot_lock
-- ----------------------------
DROP TABLE IF EXISTS `iot_lock`;
CREATE TABLE `iot_lock`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT,
  `accessToken` varchar(520) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '对外UUID',
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门锁名称',
  `lockId` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'mac地址',
  `simNum` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'sim卡号',
  `deviceId` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备id',
  `nodeId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备出厂mesi号',
  `createTime` datetime(0) NULL DEFAULT NULL,
  `location` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地理位置',
  `ownerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `isDel` tinyint(1) NULL DEFAULT NULL,
  `isBind` int(0) NULL DEFAULT NULL COMMENT '0否 1是',
  `type` int(0) NULL DEFAULT NULL COMMENT '锁类型1:公寓 2:学校 3:酒店',
  `electric` int(0) NULL DEFAULT NULL,
  `signalInfo` int(0) NULL DEFAULT NULL,
  `status` int(0) NULL DEFAULT NULL COMMENT '状态 0未注册 1已注册 2已绑定',
  `adminPassword` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `baseCode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `mac` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `bussinessId` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `isOpen` tinyint(1) NULL DEFAULT NULL COMMENT '开门状态 true开门',
  `isDisable` tinyint(1) NULL DEFAULT NULL COMMENT '是否禁用 true是 false否',
  `isSilence` tinyint(1) NULL DEFAULT NULL COMMENT '是否静音 true是 false否',
  `isNormallyOpen` tinyint(1) NULL DEFAULT NULL COMMENT '是否常开 true是 false否',
  `remark` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
  `reportTime` datetime(0) NULL DEFAULT NULL COMMENT '最后更新时间',
  `latitude` float NULL DEFAULT NULL COMMENT '纬度',
  `longitude` float NULL DEFAULT NULL COMMENT '经度',
  `appType` int(0) NULL DEFAULT NULL COMMENT '应用类型（用于推送）',
  `unit` int(0) UNSIGNED NULL DEFAULT NULL COMMENT '单元',
  `floor` int(0) NULL DEFAULT NULL COMMENT '楼层',
  `building` int(0) NULL DEFAULT NULL COMMENT '楼栋',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `t_lock_UN`(`deviceId`, `reportTime`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 452 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for iot_report_log
-- ----------------------------
DROP TABLE IF EXISTS `iot_report_log`;
CREATE TABLE `iot_report_log`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键，自动生成',
  `createTime` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `data` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据内容',
  `deviceId` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '设备id',
  `image_url` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片地址',
  `lockType` int(0) NULL DEFAULT NULL COMMENT '数据类型 1.公寓锁 2.校园锁',
  `nickName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '昵称',
  `phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号',
  `electric` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `merNo` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商家编号',
  `pitNum` int(0) NULL DEFAULT NULL,
  `status` int(0) NULL DEFAULT NULL,
  `random` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '随机数',
  `reportTime` datetime(0) NULL DEFAULT NULL COMMENT '上报时间',
  `type` int(0) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `deviceId_index`(`deviceId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 18891 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for iot_sendcmd_data
-- ----------------------------
DROP TABLE IF EXISTS `iot_sendcmd_data`;
CREATE TABLE `iot_sendcmd_data`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键，自动生成',
  `cmdSeq` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '设备序列号',
  `cmdType` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '命令类型',
  `data` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '数据内容',
  `deviceId` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '设备id',
  `reportContext` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL COMMENT '上报内容',
  `reportTime` datetime(0) NULL DEFAULT NULL COMMENT '上报时间',
  `sendContext` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL COMMENT '发送内容',
  `sendTime` datetime(0) NULL DEFAULT NULL COMMENT '发送时间',
  `serviceType` int(0) NULL DEFAULT NULL COMMENT '服务类型',
  `status` int(0) NULL DEFAULT NULL COMMENT '0已下发等待设备上报 1.上报成功 2.上报失败 3.失效',
  `sendParam` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
  `pitNum` int(0) NULL DEFAULT NULL COMMENT '坑位',
  `random` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '随机数',
  `stamptime` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '时间戳',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `dx_iot_sendcmd_data_deviceId_cmdSeq_uindex`(`deviceId`, `cmdSeq`) USING BTREE,
  UNIQUE INDEX `deviceId_cmdTyp_random_stamptime_index`(`cmdType`, `deviceId`, `random`, `stamptime`) USING BTREE,
  INDEX `deviceId_pitNum_cmdType_index`(`cmdType`, `deviceId`, `pitNum`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1248 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
