/*
 Navicat Premium Data Transfer

 Source Server         : hj-106
 Source Server Type    : MySQL
 Source Server Version : 50723
 Source Host           : 116.236.50.106:33306
 Source Schema         : tp_device

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

 Date: 05/01/2024 17:11:28
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sys_cabinet
-- ----------------------------
DROP TABLE IF EXISTS `sys_cabinet`;
CREATE TABLE `sys_cabinet`  (
  `cabinetId` int(11) NOT NULL AUTO_INCREMENT COMMENT '综合柜ID',
  `deviceCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '综合柜Code',
  `cabinetType` int(11) NULL DEFAULT NULL COMMENT '柜体类型',
  `sysNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '系统编号',
  `serialNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '序列号',
  `assetNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资产编号',
  `photo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '照片',
  `proTime` datetime NULL DEFAULT NULL COMMENT '生产日期',
  `installTime` datetime NULL DEFAULT NULL COMMENT '安装日期',
  PRIMARY KEY (`cabinetId`) USING BTREE,
  INDEX `dcode`(`deviceCode`) USING BTREE,
  CONSTRAINT `dcode` FOREIGN KEY (`deviceCode`) REFERENCES `sys_device` (`deviceCode`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_device
-- ----------------------------
DROP TABLE IF EXISTS `sys_device`;
CREATE TABLE `sys_device`  (
  `deviceId` int(11) NOT NULL AUTO_INCREMENT COMMENT '设备Id',
  `deviceName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备名称',
  `deviceCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备Code',
  `typeCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备类型Code',
  `cabinetCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '综合柜Code',
  `sort` int(11) NULL DEFAULT 1 COMMENT '柜内序号',
  `deptId` int(11) NULL DEFAULT NULL COMMENT '地区Id',
  `factory` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '厂家',
  `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '型号',
  `director` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '负责人',
  `owner` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业主',
  `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系方式',
  `online` int(11) NULL DEFAULT 0 COMMENT '在线状态',
  `alarmStatus` int(11) NULL DEFAULT 0 COMMENT '设备状态 1：故障  0：正常 2:告警',
  `createTime` datetime NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`deviceId`) USING BTREE,
  INDEX `deviceCode`(`deviceCode`) USING BTREE,
  INDEX `cabinetCode`(`cabinetCode`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 191 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_device_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_device_log`;
CREATE TABLE `sys_device_log`  (
  `deviceLogId` int(11) NOT NULL AUTO_INCREMENT COMMENT '设备操作ID',
  `deviceCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备ID',
  `userName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作人',
  `operation` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作',
  `enOperation` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '英文操作',
  `params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '参数',
  `createTime` datetime NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`deviceLogId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 356 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_dictionary
-- ----------------------------
DROP TABLE IF EXISTS `sys_dictionary`;
CREATE TABLE `sys_dictionary`  (
  `dictionaryId` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '信号Id',
  `signId` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '信号编码ID',
  `signName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '信号标准名',
  `enSignName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '英文信号标准名',
  `unit` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位',
  `signType` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '信号量类型',
  `typeCode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备类型Code',
  `deviceCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备Code',
  `moveCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '动环模块设备Code',
  `factor` int(11) NULL DEFAULT NULL COMMENT '比例系数',
  `sort` int(11) NULL DEFAULT NULL COMMENT '柜内同类设备排序',
  `showFlag` int(11) NULL DEFAULT NULL COMMENT '显示 0：不显示  1：简介  2：详情',
  `signCondition` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '条件',
  `mean` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '含义',
  PRIMARY KEY (`dictionaryId`) USING BTREE,
  INDEX `index_signType`(`signType`) USING BTREE,
  INDEX `deviceCode`(`deviceCode`) USING BTREE,
  CONSTRAINT `deviceCode` FOREIGN KEY (`deviceCode`) REFERENCES `sys_device` (`deviceCode`) ON DELETE SET NULL ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 49627 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_dictionary_record
-- ----------------------------
DROP TABLE IF EXISTS `sys_dictionary_record`;
CREATE TABLE `sys_dictionary_record`  (
  `ddId` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `dictionaryId` int(11) NULL DEFAULT NULL COMMENT '字典ID',
  `value` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数值',
  `recordTime` datetime NULL DEFAULT NULL COMMENT '记录时间',
  PRIMARY KEY (`ddId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7757414 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_electricity
-- ----------------------------
DROP TABLE IF EXISTS `sys_electricity`;
CREATE TABLE `sys_electricity`  (
  `eleId` int(11) NOT NULL AUTO_INCREMENT COMMENT '电价策略ID',
  `ployId` int(11) NULL DEFAULT NULL COMMENT '策略ID',
  `eleTypeId` int(11) NULL DEFAULT NULL COMMENT '用电类型ID',
  `volLevelId` int(11) NULL DEFAULT NULL COMMENT '电压等级ID',
  `chargeType` int(11) NULL DEFAULT NULL COMMENT '计费方式 1：单一 2：两部',
  `spikePrice` float(10, 2) NULL DEFAULT NULL COMMENT '尖峰电价',
  `peakPrice` float(10, 2) NULL DEFAULT NULL COMMENT '高峰电价',
  `lowPrice` float(10, 2) NULL DEFAULT NULL COMMENT '谷时电价',
  `flatPrice` float(10, 2) NULL DEFAULT NULL COMMENT '平时电价',
  `price` float(10, 2) NULL DEFAULT NULL COMMENT '基础电价',
  `demandPrice` float(10, 2) NULL DEFAULT NULL COMMENT '需量',
  `capacityPrice` float(10, 2) NULL DEFAULT NULL COMMENT '容量',
  PRIMARY KEY (`eleId`) USING BTREE,
  INDEX `ployId`(`ployId`) USING BTREE,
  CONSTRAINT `sys_electricity_ibfk_1` FOREIGN KEY (`ployId`) REFERENCES `sys_electricity_ploy` (`ployId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_electricity_level
-- ----------------------------
DROP TABLE IF EXISTS `sys_electricity_level`;
CREATE TABLE `sys_electricity_level`  (
  `volLevelId` int(11) NOT NULL AUTO_INCREMENT COMMENT '电压等级Id',
  `volLevelName` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电压等级名称',
  PRIMARY KEY (`volLevelId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_electricity_ploy
-- ----------------------------
DROP TABLE IF EXISTS `sys_electricity_ploy`;
CREATE TABLE `sys_electricity_ploy`  (
  `ployId` int(11) NOT NULL AUTO_INCREMENT COMMENT '策略Id',
  `ployName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '策略名称',
  `deptId` int(11) NULL DEFAULT NULL COMMENT '机构Id',
  `status` int(11) NULL DEFAULT NULL COMMENT '状态',
  `startTime` datetime NULL DEFAULT NULL COMMENT '电价有效开始时间',
  `endTime` datetime NULL DEFAULT NULL COMMENT '电价有效结束时间',
  `createTime` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `createUser` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
  PRIMARY KEY (`ployId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_electricity_time
-- ----------------------------
DROP TABLE IF EXISTS `sys_electricity_time`;
CREATE TABLE `sys_electricity_time`  (
  `timeId` int(11) NOT NULL AUTO_INCREMENT COMMENT '时间段Id',
  `eleId` int(11) NULL DEFAULT NULL COMMENT '电价策略ID',
  `startTime` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '开始时间段',
  `endTime` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '结束时间段',
  `typeId` int(11) NULL DEFAULT NULL COMMENT '峰谷类型 1：尖峰 2：高峰 3：谷时 4：平时',
  PRIMARY KEY (`timeId`) USING BTREE,
  INDEX `eleId`(`eleId`) USING BTREE,
  CONSTRAINT `sys_electricity_time_ibfk_1` FOREIGN KEY (`eleId`) REFERENCES `sys_electricity` (`eleId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 92 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_electricity_type
-- ----------------------------
DROP TABLE IF EXISTS `sys_electricity_type`;
CREATE TABLE `sys_electricity_type`  (
  `eleTypeId` int(11) NOT NULL AUTO_INCREMENT COMMENT '用电类型ID',
  `eleTypeName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用电类型名称',
  PRIMARY KEY (`eleTypeId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_energy
-- ----------------------------
DROP TABLE IF EXISTS `sys_energy`;
CREATE TABLE `sys_energy`  (
  `energyId` int(11) NOT NULL COMMENT '能耗记录Id',
  `deviceCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备Code',
  `year` int(11) NULL DEFAULT NULL COMMENT '年',
  `month` int(11) NULL DEFAULT NULL COMMENT '月',
  `day` int(11) NULL DEFAULT NULL COMMENT '日',
  `energy` float(10, 2) NULL DEFAULT NULL COMMENT '总能耗值',
  `maxEnergy` float(10, 2) NULL DEFAULT NULL COMMENT '最大能耗记录',
  `minEnergy` float(10, 2) NULL DEFAULT NULL COMMENT '最小能耗记录',
  `spikeEnergy` float(10, 2) NULL DEFAULT NULL COMMENT '尖峰电能耗',
  `peakEnergy` float(10, 2) NULL DEFAULT NULL COMMENT '高峰电能耗',
  `lowEnergy` float(10, 2) NULL DEFAULT NULL COMMENT '谷时电能耗',
  `flatEnergy` float(10, 2) NULL DEFAULT NULL COMMENT '平时电能耗',
  `energyType` int(11) NULL DEFAULT NULL COMMENT '1:市电 2：储蓄电',
  `timeType` int(11) NULL DEFAULT NULL COMMENT '0: 时间点  1：当天   2：当月   3：季   4：年',
  PRIMARY KEY (`energyId`) USING BTREE,
  INDEX `energyType`(`energyType`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_fun_record
-- ----------------------------
DROP TABLE IF EXISTS `sys_fun_record`;
CREATE TABLE `sys_fun_record`  (
  `recordId` int(11) NOT NULL AUTO_INCREMENT COMMENT '值ID',
  `deviceCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备Code',
  `funTypeId` int(11) NULL DEFAULT NULL COMMENT '参数ID',
  `funTypeValue` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数值',
  PRIMARY KEY (`recordId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_gateway
-- ----------------------------
DROP TABLE IF EXISTS `sys_gateway`;
CREATE TABLE `sys_gateway`  (
  `gateId` int(11) NOT NULL AUTO_INCREMENT COMMENT '网关Id',
  `deviceCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备Code',
  `moveCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'FSUCode',
  `ratedPower` int(11) NULL DEFAULT NULL COMMENT '额定功耗',
  `serialNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备序列号SN',
  `assetNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备资产编号',
  `installTime` datetime NULL DEFAULT NULL COMMENT '安装日期',
  `netMethod` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联网方式',
  `gateIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'IP',
  `gatePort` int(11) NULL DEFAULT NULL COMMENT '访问端口',
  `snmpPort` int(11) NULL DEFAULT NULL COMMENT 'SNMP访问端口',
  `operator` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '运营商',
  `SIM` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用来管理SIM卡号资源',
  `IMEI` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'IMEI',
  `IMSI` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'IMSI',
  `company` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '运维公司名称',
  `agent` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '运维人员名称',
  `mobile` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '运维人员Mobile',
  `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '运维人员email',
  `weChat` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '运维人员微信号',
  `softVer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '软件版本号',
  `softTime` datetime NULL DEFAULT NULL COMMENT '软件上次升级时间',
  `hardVer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '硬件版本号',
  `hardTime` datetime NULL DEFAULT NULL COMMENT '硬件上次升级时间',
  `online` int(11) NULL DEFAULT NULL COMMENT '在线状态',
  `network` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网络信号强度',
  PRIMARY KEY (`gateId`) USING BTREE,
  INDEX `deviceCode`(`deviceCode`) USING BTREE,
  CONSTRAINT `sys_gateway_ibfk_1` FOREIGN KEY (`deviceCode`) REFERENCES `sys_device` (`deviceCode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_monitor
-- ----------------------------
DROP TABLE IF EXISTS `sys_monitor`;
CREATE TABLE `sys_monitor`  (
  `monitorId` int(11) NOT NULL AUTO_INCREMENT COMMENT '监控Id',
  `deviceCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备Code',
  `deviceSerial` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '直播源',
  `channelNo` int(11) NULL DEFAULT NULL COMMENT '通道号',
  `path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '监控地址',
  `photoName` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '抓拍照片名称',
  PRIMARY KEY (`monitorId`) USING BTREE,
  INDEX `deviceCode`(`deviceCode`) USING BTREE,
  CONSTRAINT `sys_monitor_ibfk_1` FOREIGN KEY (`deviceCode`) REFERENCES `sys_device` (`deviceCode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 40 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_move
-- ----------------------------
DROP TABLE IF EXISTS `sys_move`;
CREATE TABLE `sys_move`  (
  `moveId` int(11) NOT NULL AUTO_INCREMENT COMMENT '动环Id',
  `deviceCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '动环模块Code',
  `software` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '软件信息',
  `hardware` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '硬件信息',
  `power` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '功率',
  `RSSI` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '信号强度',
  `portCount` int(11) NULL DEFAULT NULL COMMENT '接口数量',
  `IMEI` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'IMEI',
  `IMSI` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'IMSI',
  `logonTime` datetime NULL DEFAULT NULL COMMENT '注册时间',
  `network` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网络状态',
  `operator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '运营商信息',
  `company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代维公司信息',
  `agent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '代维人员姓名',
  `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系方式',
  `trapIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'TRAP Ip 地址',
  `host` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'VPN Ip 地址',
  `port` int(11) NULL DEFAULT NULL COMMENT 'port',
  `fsuCode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'FsuCode，用于网关对接',
  PRIMARY KEY (`moveId`) USING BTREE,
  INDEX `scode`(`deviceCode`) USING BTREE,
  CONSTRAINT `scode` FOREIGN KEY (`deviceCode`) REFERENCES `sys_device` (`deviceCode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_ploy_area
-- ----------------------------
DROP TABLE IF EXISTS `sys_ploy_area`;
CREATE TABLE `sys_ploy_area`  (
  `paId` int(11) NOT NULL AUTO_INCREMENT COMMENT '策略地区Id',
  `ployId` int(11) NULL DEFAULT NULL COMMENT '策略Id',
  `areaId` int(11) NULL DEFAULT NULL COMMENT '地区Id',
  PRIMARY KEY (`paId`) USING BTREE,
  INDEX `ployId`(`ployId`) USING BTREE,
  CONSTRAINT `ployId` FOREIGN KEY (`ployId`) REFERENCES `sys_electricity_ploy` (`ployId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 35 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_site
-- ----------------------------
DROP TABLE IF EXISTS `sys_site`;
CREATE TABLE `sys_site`  (
  `siteId` int(11) NOT NULL AUTO_INCREMENT COMMENT '站址ID',
  `siteName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站址名称',
  `siteCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站址编码',
  `deptId` int(11) NULL DEFAULT NULL COMMENT '机构Id',
  `areaId` int(11) NULL DEFAULT NULL COMMENT '地区Id',
  `longitude` float(10, 5) NULL DEFAULT NULL COMMENT '经度',
  `latitude` float(10, 5) NULL DEFAULT NULL COMMENT '纬度',
  `address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站址地址',
  `picture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站址照片',
  `director` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '负责人',
  `createTime` datetime NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`siteId`) USING BTREE,
  INDEX `siteCode`(`siteCode`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_site_device
-- ----------------------------
DROP TABLE IF EXISTS `sys_site_device`;
CREATE TABLE `sys_site_device`  (
  `sdId` int(11) NOT NULL AUTO_INCREMENT COMMENT '设备站址ID',
  `deviceCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备Code',
  `siteCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站址Code',
  PRIMARY KEY (`sdId`) USING BTREE,
  INDEX `deviceId`(`deviceCode`) USING BTREE,
  INDEX `siteId`(`siteCode`) USING BTREE,
  CONSTRAINT `deviceId` FOREIGN KEY (`deviceCode`) REFERENCES `sys_device` (`deviceCode`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `siteId` FOREIGN KEY (`siteCode`) REFERENCES `sys_site` (`siteCode`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_type
-- ----------------------------
DROP TABLE IF EXISTS `sys_type`;
CREATE TABLE `sys_type`  (
  `typeId` int(11) NOT NULL AUTO_INCREMENT COMMENT '设备类型Id',
  `typeCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备类型Code',
  `typeName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备类型名称',
  `parentId` int(11) NULL DEFAULT NULL COMMENT '父级Id',
  `icon` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备类型图片',
  `createTime` datetime NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`typeId`) USING BTREE,
  INDEX `parentId`(`parentId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
