From b153a2d99f0cd368b9d565983094a83234803852 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Wed, 21 Feb 2024 09:55:15 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E9=80=9F=E5=BA=A6=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/init.sql | 41 +++++++++++++++++++ .../com/xydl/cac/CacBackendApplication.java | 2 + .../java/com/xydl/cac/entity/N103Point.java | 2 +- .../service/impl/N103SensorServiceImpl.java | 2 + 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/sql/init.sql b/sql/init.sql index 6f644c7..b2bcf6a 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -23,3 +23,44 @@ CREATE TABLE `icd_config_type_inst` ( `inst` varchar(45) NOT NULL COMMENT '实例', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='ICD配置类型实例表'; + +CREATE TABLE `n_103_point` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `npoint_id` int(11) DEFAULT NULL COMMENT '监测装置属性点ID', + `sensor_103_id` int(11) DEFAULT NULL COMMENT '103和sensor表的关联ID', + `sadr` varchar(45) DEFAULT NULL COMMENT '信息体地址', + `item_no` varchar(45) DEFAULT NULL COMMENT '条目号', + `paramindex` varchar(200) DEFAULT NULL COMMENT '61850对象参引', + `part_name` varchar(200) DEFAULT NULL COMMENT '名称后半部分', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='103和point表的关联'; +CREATE TABLE `n_103_sensor` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `nsensor_id` int(11) DEFAULT NULL COMMENT '监测装置ID', + `grp_no` int(11) DEFAULT NULL COMMENT '组号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='103和sensor表的关联'; +CREATE TABLE `n_point` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `sensor_id` int(11) DEFAULT NULL COMMENT '监测装置ID', + `field` varchar(45) DEFAULT NULL COMMENT '对应tablename表的字段名', + `field_desc` varchar(200) DEFAULT NULL COMMENT '对应tablename表的字段名称描述', + `point_id` int(11) DEFAULT NULL COMMENT '对应的点位编号', + `type` int(11) DEFAULT NULL COMMENT '点位类型 1:遥信 2:遥测', + PRIMARY KEY (`id`), + KEY `idxField` (`sensor_id`,`field`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='监测装置属性点表'; +CREATE TABLE `n_sensor` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(200) DEFAULT NULL COMMENT '名称', + `phase` varchar(45) DEFAULT NULL COMMENT '相别', + `table_name` varchar(45) DEFAULT NULL COMMENT '表名', + `sensor_code` varchar(45) DEFAULT NULL COMMENT '传感器的唯一标识', + `equipment_code` varchar(45) DEFAULT NULL COMMENT '被监测设备的唯一标识', + `dev_id` int(11) DEFAULT NULL COMMENT '装置ID', + `status` int(11) DEFAULT '1' COMMENT '状态 1-正常 0-删除', + `zsb_id` int(11) DEFAULT NULL, + `icd_id` int(11) DEFAULT NULL COMMENT '关联icd表中的id', + PRIMARY KEY (`id`), + KEY `idxSensor` (`sensor_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='监测装置表'; \ No newline at end of file diff --git a/src/main/java/com/xydl/cac/CacBackendApplication.java b/src/main/java/com/xydl/cac/CacBackendApplication.java index cc8dd0d..cfe3887 100644 --- a/src/main/java/com/xydl/cac/CacBackendApplication.java +++ b/src/main/java/com/xydl/cac/CacBackendApplication.java @@ -5,6 +5,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import springfox.documentation.swagger2.annotations.EnableSwagger2; @@ -13,6 +14,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 @SpringBootApplication @EnableCaching +@EnableAsync public class CacBackendApplication { @Bean(name = "passwordEncoder") diff --git a/src/main/java/com/xydl/cac/entity/N103Point.java b/src/main/java/com/xydl/cac/entity/N103Point.java index fab8183..f3fe6be 100644 --- a/src/main/java/com/xydl/cac/entity/N103Point.java +++ b/src/main/java/com/xydl/cac/entity/N103Point.java @@ -19,7 +19,7 @@ import java.util.List; @AllArgsConstructor @NoArgsConstructor @Entity -@Table(name = "n_point") +@Table(name = "n_103_point") @ApiModel("装置点表") public class N103Point { diff --git a/src/main/java/com/xydl/cac/service/impl/N103SensorServiceImpl.java b/src/main/java/com/xydl/cac/service/impl/N103SensorServiceImpl.java index 5a65688..ddeebff 100644 --- a/src/main/java/com/xydl/cac/service/impl/N103SensorServiceImpl.java +++ b/src/main/java/com/xydl/cac/service/impl/N103SensorServiceImpl.java @@ -9,6 +9,7 @@ import com.xydl.cac.service.N103PointService; import com.xydl.cac.service.N103SensorService; import com.xydl.cac.service.NSensorService; import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -28,6 +29,7 @@ public class N103SensorServiceImpl implements N103SensorService { N103PointService n103PointService; + @Async @Override public void importFrom(Collection collection) { for (N103Sensor item : collection) {