| | |
| | | |
| | | //分片规则配置 |
| | | ShardingRuleConfiguration result1 = new ShardingRuleConfiguration(); |
| | | result1.getTables().add(gettCoursePackagePaymentTableRuleConfiguration()); |
| | | result1.getTables().add(getCoursePackagePaymentTableRuleConfiguration()); |
| | | Properties props1 = new Properties(); |
| | | props1.setProperty("algorithm-expression", "t_course_package_payment$->{appUserId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_course_package_payment-inline", new AlgorithmConfiguration("INLINE", props1)); |
| | |
| | | * 分片算法配置 |
| | | * @return |
| | | */ |
| | | private ShardingTableRuleConfiguration gettCoursePackagePaymentTableRuleConfiguration() { |
| | | private ShardingTableRuleConfiguration getCoursePackagePaymentTableRuleConfiguration() { |
| | | ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_course_package_payment", "m$->{0}.t_course_package_payment$->{1..5}");//50 |
| | | result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("appUserId", "t_course_package_payment-inline")); |
| | | result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_course_package_payment-snowflake")); |