From 8e2d31e804cd7fd5736c9c2e7b755b153b462f7a Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期五, 13 十月 2023 14:02:20 +0800
Subject: [PATCH] 10.12
---
cloud-server-account/src/main/java/com/dsh/config/Sharding_jdbc/ShardingConfig.java | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/cloud-server-account/src/main/java/com/dsh/config/Sharding_jdbc/ShardingConfig.java b/cloud-server-account/src/main/java/com/dsh/config/Sharding_jdbc/ShardingConfig.java
index 7597609..2022653 100644
--- a/cloud-server-account/src/main/java/com/dsh/config/Sharding_jdbc/ShardingConfig.java
+++ b/cloud-server-account/src/main/java/com/dsh/config/Sharding_jdbc/ShardingConfig.java
@@ -73,25 +73,21 @@
props1.setProperty("algorithm-expression", "t_payment_history$->{appUserId % 5 + 1}");
result1.getShardingAlgorithms().put("t_payment_history-inline", new AlgorithmConfiguration("INLINE", props1));
result1.getKeyGenerators().put("t_payment_history-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties()));
- linkedList.add(result1);
//分片规则配置
- ShardingRuleConfiguration result2 = new ShardingRuleConfiguration();
- result2.getTables().add(getRechargeRecordsTableRuleConfiguration());
+ result1.getTables().add(getRechargeRecordsTableRuleConfiguration());
Properties props2 = new Properties();
props2.setProperty("algorithm-expression", "t_recharge_records$->{appUserId % 5 + 1}");
- result2.getShardingAlgorithms().put("t_recharge_records-inline", new AlgorithmConfiguration("INLINE", props2));
- result2.getKeyGenerators().put("t_recharge_records-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties()));
- linkedList.add(result2);
+ result1.getShardingAlgorithms().put("t_recharge_records-inline", new AlgorithmConfiguration("INLINE", props2));
+ result1.getKeyGenerators().put("t_recharge_records-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties()));
//分片规则配置
- ShardingRuleConfiguration result3 = new ShardingRuleConfiguration();
- result3.getTables().add(getUserIntegralChangesTableRuleConfiguration());
+ result1.getTables().add(getUserIntegralChangesTableRuleConfiguration());
Properties props3 = new Properties();
props3.setProperty("algorithm-expression", "t_user_integral_changes$->{appUserId % 5 + 1}");
- result3.getShardingAlgorithms().put("t_user_integral_changes-inline", new AlgorithmConfiguration("INLINE", props3));
- result3.getKeyGenerators().put("t_user_integral_changes-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties()));
- linkedList.add(result3);
+ result1.getShardingAlgorithms().put("t_user_integral_changes-inline", new AlgorithmConfiguration("INLINE", props3));
+ result1.getKeyGenerators().put("t_user_integral_changes-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties()));
+ linkedList.add(result1);
return linkedList;
}
@@ -101,7 +97,7 @@
* @return
*/
private ShardingTableRuleConfiguration getPaymentHistoryTableRuleConfiguration() {
- ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_payment_history", "m_$->{0}.t_payment_history->{1..5}");//50
+ ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_payment_history", "m_$->{0}.t_payment_history$->{1..5}");//50
result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("appUserId", "t_payment_history-inline"));
result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_payment_history-snowflake"));
return result;
--
Gitblit v1.7.1