| | |
| | | |
| | | //分片规则配置 |
| | | ShardingRuleConfiguration result1 = new ShardingRuleConfiguration(); |
| | | |
| | | result1.getTables().add(getCoursePackagePaymentTableRuleConfiguration()); |
| | | Properties props1 = new Properties(); |
| | | props1.setProperty("algorithm-expression", "t_course_package_payment$->{appUserId % 5 + 1}"); |
| | |
| | | //分片规则配置 |
| | | result1.getTables().add(getCoursePackageOrderTableRuleConfiguration()); |
| | | Properties props6 = new Properties(); |
| | | props1.setProperty("algorithm-expression", "t_course_package_order$->{appUserId % 5 + 1}"); |
| | | props6.setProperty("algorithm-expression", "t_course_package_order$->{appUserId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_course_package_order-inline", new AlgorithmConfiguration("INLINE", props6)); |
| | | result1.getKeyGenerators().put("t_course_package_order-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | |