From 4dad3d9a5bfc1b08c5338640e1f1d18c2b86ef45 Mon Sep 17 00:00:00 2001 From: lisy <linlangsur163@163.com> Date: 星期三, 26 七月 2023 18:05:19 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- cloud-server-account/src/main/java/com/dsh/config/Sharding_jdbc/ShardingConfig.java | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 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 6a62577..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; } -- Gitblit v1.7.1