hlf 1 anno fa
parent
commit
ff4d115e37

+ 1 - 0
build.gradle.kts

@@ -26,6 +26,7 @@ dependencies {
     testImplementation("org.springframework.boot:spring-boot-starter-test")
     implementation("org.springframework.boot:spring-boot-starter-websocket")
     implementation("com.baomidou:mybatis-plus-boot-starter:3.5.3.1")
+    implementation("com.baomidou:dynamic-datasource-spring-boot-starter:3.3.2")
     implementation("com.alibaba:druid-spring-boot-starter:1.2.15")
     //implementation("mysql:mysql-connector-java:8.0.31")
     implementation("com.alibaba:fastjson:2.0.23")

+ 3 - 0
src/main/java/com/gyee/table/controller/ElectricalTestingPointController.java

@@ -10,6 +10,9 @@ import org.springframework.web.bind.annotation.*;
 import java.util.ArrayList;
 import java.util.List;
 
+/**
+ * 测点信息操作接口
+ */
 @RestController
 @RequestMapping("/electrical")
 @CrossOrigin

+ 21 - 13
src/main/resources/application.yml

@@ -9,20 +9,28 @@ spring:
         force: true
         charset: UTF-8
         enabled: true
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-    #driver-class-name: com.mysql.cj.jdbc.Driver
-    #url: jdbc:mysql://49.234.50.218:3306/list
-    #url: jdbc:mysql://123.60.219.66:3306/configuration_software?default-character-set=utf8
-    #url: jdbc:mysql://192.168.1.69/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
-    #username: root
-    #password: gyeepd@123
-    driver-class-name: org.postgresql.Driver
-    url: jdbc:postgresql://123.60.219.66:5432/configuration_software
-    username: postgres
-    password: gyeepd@123
-    #url: jdbc:postgresql://10.81.3.151:5432/configuration_software
-    #username: postgres
-    #password: postgres
+    dynamic:
+      primary: databasefirst
+      datasource:
+        databasefirst:
+          #driver-class-name: com.mysql.cj.jdbc.Driver
+          #url: jdbc:mysql://49.234.50.218:3306/list
+          #url: jdbc:mysql://123.60.219.66:3306/configuration_software?default-character-set=utf8
+          #url: jdbc:mysql://192.168.1.69/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
+          #username: root
+          #password: gyeepd@123
+          driver-class-name: org.postgresql.Driver
+          url: jdbc:postgresql://123.60.219.66:5432/configuration_software
+          username: postgres
+          password: gyeepd@123
+        databasesecond:
+          driver-class-name: org.postgresql.Driver
+          url: jdbc:postgresql://10.81.3.151:5432/configuration_software
+          username: postgres
+          password: postgres
 
 mybatis-plus:
   typeAliasesPackage: com.gyee.table.entity