diff --git a/src/main/resources/gaswellwatch.sql b/src/main/resources/gaswellwatch.sql index 3776e57..577d954 100644 --- a/src/main/resources/gaswellwatch.sql +++ b/src/main/resources/gaswellwatch.sql @@ -11,7 +11,7 @@ Target Server Version : 80034 File Encoding : 65001 - Date: 23/11/2024 18:48:09 + Date: 25/11/2024 01:42:17 */ SET NAMES utf8mb4; @@ -25,8 +25,8 @@ CREATE TABLE `block` ( `id` bigint NOT NULL COMMENT '主键', `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '名称', `details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='区块管理'; @@ -131,6 +131,31 @@ INSERT INTO `department` (`id`, `name`, `description`, `create_time`, `update_ti INSERT INTO `department` (`id`, `name`, `description`, `create_time`, `update_time`, `code`) VALUES (1859299142728155136, 'dasd', '2', '2024-11-21 02:13:54', '2024-11-21 02:13:54', '2'); COMMIT; +-- ---------------------------- +-- Table structure for device +-- ---------------------------- +DROP TABLE IF EXISTS `device`; +CREATE TABLE `device` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键(取真实设备id)', + `device_type` bigint NOT NULL COMMENT '设备类型', + `code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '设备编号', + `gas_station` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '集气站', + `product` bigint DEFAULT NULL COMMENT '设备品牌', + `gateway_sn` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '网关通讯地址', + `gas_well` bigint DEFAULT NULL COMMENT '气井ID', + `details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', + `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE, + KEY `gas_well_index` (`gas_well`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='设备列表'; + +-- ---------------------------- +-- Records of device +-- ---------------------------- +BEGIN; +COMMIT; + -- ---------------------------- -- Table structure for device_types -- ---------------------------- @@ -147,38 +172,6 @@ CREATE TABLE `device_types` ( BEGIN; COMMIT; --- ---------------------------- --- Table structure for devices --- ---------------------------- -DROP TABLE IF EXISTS `devices`; -CREATE TABLE `devices` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', - `device_type_id` bigint NOT NULL COMMENT '设备类型', - `code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '设备编号', - `group_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '分组名称', - `product_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '设备品牌', - `address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '通讯地址', - `collection_flag` bit(1) NOT NULL COMMENT '是否采集标志', - `collection_frequency` int NOT NULL DEFAULT '30' COMMENT '采集频率,默认30秒。', - `control_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '控制类型', - `running_mode` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '生产模式,计时器;间开电压', - `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '状态', - `status_time` datetime NOT NULL COMMENT '状态时间', - `details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已删除', - `create_by` bigint NOT NULL COMMENT '创建人', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_by` bigint NOT NULL COMMENT '更新人', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='设备列表'; - --- ---------------------------- --- Records of devices --- ---------------------------- -BEGIN; -COMMIT; - -- ---------------------------- -- Table structure for dictionary -- ---------------------------- @@ -201,31 +194,36 @@ CREATE TABLE `dictionary` ( -- Records of dictionary -- ---------------------------- BEGIN; -INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) VALUES (1859896918377758720, 'testType', 'code1', 'name1', '1', 1, '2024-11-22 17:49:15', '2024-11-22 17:49:15'); -INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) VALUES (1859897057574125568, 'testType', 'code2', 'name2', '2', 2, '2024-11-22 17:49:48', '2024-11-22 17:49:48'); -INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) VALUES (1859897370766999552, 'testType1', 'code1', 'name1', '1', 1, '2024-11-22 17:51:03', '2024-11-22 17:51:03'); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) VALUES (1, 'deviceType', 'zsqj', '柱塞气举', '1', 1, '2024-11-24 17:31:24', '2024-11-24 17:31:24'); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) VALUES (2, 'deviceType', 'zdjk', '自动间开', '2', 2, '2024-11-24 17:32:23', '2024-11-24 17:32:23'); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) VALUES (3, 'deviceType', 'znpp', '智能泡排', '3', 3, '2024-11-24 17:32:48', '2024-11-24 17:32:48'); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) VALUES (4, 'deviceProduct', 'knpc', 'KNPC', '1', 1, '2024-11-24 17:39:52', '2024-11-24 17:39:52'); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) VALUES (5, 'deviceProduct', 'etc', 'ETC', '2', 2, '2024-11-24 17:40:32', '2024-11-24 17:40:32'); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) VALUES (6, 'deviceProduct', 'scss', '四川双晟', '3', 3, '2024-11-24 17:41:41', '2024-11-24 17:41:41'); COMMIT; -- ---------------------------- --- Table structure for gas_wells +-- Table structure for gas_well -- ---------------------------- -DROP TABLE IF EXISTS `gas_wells`; -CREATE TABLE `gas_wells` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', - `company_id` bigint DEFAULT NULL COMMENT '关联公司', - `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '气井名称', - `details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', - `create_by` bigint NOT NULL COMMENT '创建人', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_by` bigint NOT NULL COMMENT '更新人', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE +DROP TABLE IF EXISTS `gas_well`; +CREATE TABLE `gas_well` ( + `id` bigint NOT NULL COMMENT '主键', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '气井名称', + `device_id` bigint DEFAULT NULL COMMENT '关联设备', + `block_id` bigint DEFAULT NULL COMMENT '所属区块ID', + `details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', + `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='气井管理'; -- ---------------------------- --- Records of gas_wells +-- Records of gas_well -- ---------------------------- BEGIN; +INSERT INTO `gas_well` (`id`, `name`, `device_id`, `block_id`, `details`, `create_time`, `update_time`) VALUES (1860586124699762688, '桃43', NULL, 1860217436825976832, '测试123', '2024-11-24 15:28:01', '2024-11-24 15:28:01'); +INSERT INTO `gas_well` (`id`, `name`, `device_id`, `block_id`, `details`, `create_time`, `update_time`) VALUES (1860588309223309312, '桃47', NULL, 1860217436825976832, '测试13323', '2024-11-24 15:36:35', '2024-11-24 15:36:35'); +INSERT INTO `gas_well` (`id`, `name`, `device_id`, `block_id`, `details`, `create_time`, `update_time`) VALUES (1860592296991391744, '苏64', NULL, 1860217990331498496, 'ceshi', '2024-11-24 15:52:26', '2024-11-24 15:52:26'); COMMIT; -- ----------------------------