/*
 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         : hj_trajectory

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

 Date: 05/01/2024 17:03:36
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_dismantle
-- ----------------------------
DROP TABLE IF EXISTS `t_dismantle`;
CREATE TABLE `t_dismantle`  (
  `dismantleId` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '拆除Id',
  `deviceName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备名称',
  `deviceId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备ID',
  `deviceType` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备类型',
  `imei` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备imei',
  `imsi` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备imsi',
  `longitude` double(16, 0) NULL DEFAULT NULL COMMENT '经度',
  `latitude` double(16, 0) NULL DEFAULT NULL COMMENT '纬度',
  `areaId` int(11) NULL DEFAULT NULL COMMENT '地区Id',
  `deptId` int(11) NULL DEFAULT NULL COMMENT '部门id',
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '详细地址',
  `taskId` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `dismantleName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拆除人',
  `dismantleTime` datetime NULL DEFAULT NULL COMMENT '拆除完成时间',
  `createName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '派单人',
  `createTime` datetime NULL DEFAULT NULL COMMENT '记录时间',
  PRIMARY KEY (`dismantleId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_task
-- ----------------------------
DROP TABLE IF EXISTS `t_task`;
CREATE TABLE `t_task`  (
  `taskId` int(11) NOT NULL AUTO_INCREMENT COMMENT '任务ID',
  `taskNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务编号',
  `taskName` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务名称',
  `taskType` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务类型',
  `parentId` int(11) NULL DEFAULT NULL COMMENT '父级ID',
  `orderType` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工单类型',
  `receiveName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '派发人员ID',
  `telephone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话',
  `deptId` int(11) NULL DEFAULT NULL COMMENT '所属机构ID',
  `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '说明',
  `status` int(11) NULL DEFAULT NULL COMMENT '状态：-1:未发布0:未开始1:进行中2:中止3:验收通过4:验收不通过5:待验收',
  `releaseName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发布任务者',
  `checkName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '验收人',
  `applyTime` datetime NULL DEFAULT NULL COMMENT '申请验收时间',
  `startTime` datetime NULL DEFAULT NULL COMMENT '开始时间',
  `deadline` datetime NULL DEFAULT NULL COMMENT '截止时间',
  `finishTime` datetime NULL DEFAULT NULL COMMENT '完成时间',
  `acceptanceTime` datetime NULL DEFAULT NULL COMMENT '验收时间',
  `createTime` datetime NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`taskId`) USING BTREE,
  UNIQUE INDEX `taskNum`(`taskNum`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '任务表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_task_device
-- ----------------------------
DROP TABLE IF EXISTS `t_task_device`;
CREATE TABLE `t_task_device`  (
  `tdId` int(11) NOT NULL AUTO_INCREMENT COMMENT '关系ID',
  `taskId` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `deviceType` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备类型',
  `deviceId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备ID',
  `deviceName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备名称',
  `alarmId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '告警编号',
  `longitude` double(16, 8) NULL DEFAULT NULL COMMENT '经度',
  `latitude` double(16, 8) NULL DEFAULT NULL COMMENT '纬度',
  `areaId` int(11) NULL DEFAULT NULL COMMENT '区域ID',
  `streetId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '街道ID',
  PRIMARY KEY (`tdId`) USING BTREE,
  INDEX `fk_t_task_device_taskId`(`taskId`) USING BTREE,
  CONSTRAINT `fk_t_task_device_taskId` FOREIGN KEY (`taskId`) REFERENCES `t_task` (`taskId`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '工单设备关系表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_trajectory
-- ----------------------------
DROP TABLE IF EXISTS `t_trajectory`;
CREATE TABLE `t_trajectory`  (
  `trackId` int(11) NOT NULL AUTO_INCREMENT COMMENT '历史轨迹ID',
  `deviceType` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备类型',
  `deviceId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备ID',
  `deviceName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备名称',
  `taskId` int(11) NULL DEFAULT NULL COMMENT '任务单ID',
  `trackType` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '轨迹类型',
  `checkStatus` int(11) NULL DEFAULT NULL COMMENT '验收结果0：验收不通过1：验收通过',
  `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '轨迹说明',
  `picAnnex` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '图片附件',
  `videoAnnex` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '视频附件',
  `audioAnnex` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '音频附件',
  `longitude` double(16, 8) NULL DEFAULT NULL COMMENT '经度',
  `latitude` double(16, 8) NULL DEFAULT NULL COMMENT '纬度',
  `distance` double(16, 8) NULL DEFAULT NULL COMMENT '距离',
  `createName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '处理人员',
  `createTime` datetime NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`trackId`) USING BTREE,
  INDEX `fk_t_trajectory_taskId`(`taskId`) USING BTREE,
  CONSTRAINT `fk_t_trajectory_taskId` FOREIGN KEY (`taskId`) REFERENCES `t_task` (`taskId`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '设备历史轨迹表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
