| | |
| | | props1.setProperty("algorithm-expression", "t_user_coupon$->{userId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_user_coupon-inline", new AlgorithmConfiguration("INLINE", props1)); |
| | | result1.getKeyGenerators().put("t_user_coupon-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result1); |
| | | |
| | | //分片规则配置 |
| | | result1.getTables().add(getUserPointsMerchandiseTableRuleConfiguration()); |
| | | ShardingRuleConfiguration result2 = new ShardingRuleConfiguration(); |
| | | result2.getTables().add(getUserPointsMerchandiseTableRuleConfiguration()); |
| | | Properties props2 = new Properties(); |
| | | props2.setProperty("algorithm-expression", "t_user_points_merchandise$->{userId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_user_points_merchandise-inline", new AlgorithmConfiguration("INLINE", props2)); |
| | | result1.getKeyGenerators().put("t_user_points_merchandise-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | |
| | | linkedList.add(result1); |
| | | result2.getShardingAlgorithms().put("t_user_points_merchandise-inline", new AlgorithmConfiguration("INLINE", props2)); |
| | | result2.getKeyGenerators().put("t_user_points_merchandise-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result2); |
| | | |
| | | return linkedList; |
| | | } |