From c452b3b1fed6c53ca234ffb3a4959d7d052d684d Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 05 二月 2026 22:08:49 +0800
Subject: [PATCH] 集成分库分表中间件及添加数据库配置
---
xp-service/pom.xml | 5 --
xp-service/xp-vehicleConvoy/pom.xml | 1
xp-service/xp-vehicleConvoy/src/main/resources/bootstrap.yml | 39 -------------------
pom.xml | 8 +++-
xp-gateway/pom.xml | 8 ----
5 files changed, 6 insertions(+), 55 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8457a99..a14eca7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,13 +39,12 @@
<minio.version>8.2.2</minio.version>
<poi.version>4.1.2</poi.version>
<transmittable-thread-local.version>2.14.2</transmittable-thread-local.version>
+ <shardingsphere.version>5.5.2</shardingsphere.version>
</properties>
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies>
-
- <!-- SpringCloud 微服务 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
@@ -216,6 +215,11 @@
<artifactId>xp-api-account</artifactId>
<version>${xp.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-jdbc</artifactId>
+ <version>${shardingsphere.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
diff --git a/xp-gateway/pom.xml b/xp-gateway/pom.xml
index 6b88862..4eb0421 100644
--- a/xp-gateway/pom.xml
+++ b/xp-gateway/pom.xml
@@ -19,14 +19,6 @@
</properties>
<dependencies>
-
-
- <!-- SpringBoot Web容器 -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
-
<!-- SpringCloud Gateway -->
<dependency>
<groupId>org.springframework.cloud</groupId>
diff --git a/xp-service/pom.xml b/xp-service/pom.xml
index 628c267..4feab5d 100644
--- a/xp-service/pom.xml
+++ b/xp-service/pom.xml
@@ -66,11 +66,6 @@
<artifactId>unified-verification</artifactId>
<version>1.5.2-v2</version>
</dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-jdbc</artifactId>
- <version>5.5.2</version>
- </dependency>
</dependencies>
</project>
diff --git a/xp-service/xp-vehicleConvoy/pom.xml b/xp-service/xp-vehicleConvoy/pom.xml
index cc2f11e..d21f926 100644
--- a/xp-service/xp-vehicleConvoy/pom.xml
+++ b/xp-service/xp-vehicleConvoy/pom.xml
@@ -125,5 +125,4 @@
</resource>
</resources>
</build>
-
</project>
diff --git a/xp-service/xp-vehicleConvoy/src/main/resources/bootstrap.yml b/xp-service/xp-vehicleConvoy/src/main/resources/bootstrap.yml
index e9444cc..3e68e58 100644
--- a/xp-service/xp-vehicleConvoy/src/main/resources/bootstrap.yml
+++ b/xp-service/xp-vehicleConvoy/src/main/resources/bootstrap.yml
@@ -159,42 +159,3 @@
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
----
-#shardingSphere-jdbc
-databaseName: xprt_operation
-#
-mode:
- type: Standalone # 运行模式类型。可选配置:Standalone、Cluster
- repository:
- type: JDBC # 持久化仓库类型 单机版:JDBC 集群版:ZooKeeper
-# props: # 持久化仓库所需属性
-# namespace: governance # 注册中心命名空间
-# server-lists: localhost:2181 # 注册中心连接地址
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-dataSources: # 数据源配置,可配置多个
- xp_0: # 数据源名称
- dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
- driverClassName: com.mysql.jdbc.Driver
- standardJdbcUrl: jdbc:mysql://192.168.110.34:3306/xprt_operation?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
- username: root
- password: 123456
-# 分片规则
-rules:
- - !SHARDING
- tables: # 数据分片规则配置
- xp_whitelist_operlog: # 逻辑表名称
- actualDataNodes: xp_${0}.xp_whitelist_operlog_${0..1} # 由数据源名 + 表名组成(参考 Inline 语法规则)
- tableStrategy: # 分库策略,缺省表示使用默认分库策略,以下的分片策略只能选其一
- standard:
- shardingColumn: operation_account_id
- shardingAlgorithmName: t_vehicle_convoy_inline
-
- keyGenerateStrategy: # 分布式序列策略
- column: id # 自增列名称,缺省表示不使用自增主键生成器
- keyGeneratorName: snowflake # 分布式序列算法名称
- shardingAlgorithms: # 分库算法
- t_vehicle_convoy_inline: # 分库算法名称
- type: INLINE # 分库算法类型
- props: # 分库算法属性
- algorithm-expression: t_vehicle_convoy_${operation_account_id % 2}
\ No newline at end of file
--
Gitblit v1.7.1