危化品全生命周期管理后端
heheng
2025-04-18 5b18c5a8c26194474b65b180c6e87e180a03c646
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 数据源
dataSources:
  sharding:
    dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
    driverClassName: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://192.168.2.29:7006/hazmat_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
    username: root
    password: 2farwL3yPXfbH2AP
    maxTotal: 100
#  ds_1:
#    dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
#    driverClassName: com.mysql.cj.jdbc.Driver
#    url: jdbc:mysql://localhost:3306/ry-order2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#    username: root
#    password: root
#    maxTotal: 100
rules:
  - !SHARDING
    tables:
      hz_hazmat:
        actualDataNodes: sharding.hz_hazmat_$->{0..19}
        tableStrategy:
          standard:
            shardingColumn: company_id
            shardingAlgorithmName: hz_hazmat_inline
      hz_hazmat_flow:
        actualDataNodes: sharding.hz_hazmat_flow_$->{0..19}
        tableStrategy:
          standard:
            shardingColumn: company_id
            shardingAlgorithmName: hz_hazmat_flow_inline
      hz_product:
        actualDataNodes: sharding.hz_product_$->{0..19}
        tableStrategy:
          standard:
            shardingColumn: company_id
            shardingAlgorithmName: hz_product_inline
      hz_product_flow:
        actualDataNodes: sharding.hz_product_flow_$->{0..19}
        tableStrategy:
          standard:
            shardingColumn: company_id
            shardingAlgorithmName: hz_product_flow_inline
    shardingAlgorithms:
      hz_hazmat_inline:
        type: INLINE
        props:
          algorithm-expression: hz_hazmat_$->{company_id % 20}
      hz_hazmat_flow_inline:
        type: INLINE
        props:
          algorithm-expression: hz_hazmat_flow_$->{company_id % 20}
      hz_product_inline:
        type: INLINE
        props:
          algorithm-expression: hz_product_$->{company_id % 20}
      hz_product_flow_inline:
        type: INLINE
        props:
          algorithm-expression: hz_product_flow_$->{company_id % 20}
    keyGenerators:
      snowflake:
        type: SNOWFLAKE
props:
  sql-show: true  # 是否打印sql