lisy
2023-07-06 aa0413f95fffba39cabcc78d147595da96b10b32
cloud-server-course/src/main/java/com/dsh/config/Sharding_jdbc/ShardingConfig.java
@@ -68,7 +68,7 @@
        //分片规则配置
        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));
@@ -90,7 +90,7 @@
     * 分片算法配置
     * @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"));