databaseName: mall4cloud_order

dataSources:
  ds:
    url: jdbc:mysql://192.168.193.128:3306/mall4cloud_order?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true&useAffectedRows=true
    username: root
    password: hn02le.34lkdLKD
    minPoolSize: 0
    maxPoolSize: 100
    idleTimeoutMilliseconds: 25000

rules:
  - !SHARDING
    tables:
      # 正向订单业务表
      order:
        actualDataNodes: ds.order_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,user_id,refund_id,order_item_id,order_item_lang_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_item:
        actualDataNodes: ds.order_item_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,user_id,refund_id,order_item_id,order_item_lang_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_item_lang:
        actualDataNodes: ds.order_item_lang_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,user_id,refund_id,order_item_id,order_item_lang_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_settlement:
        actualDataNodes: ds.order_settlement_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,user_id,refund_id,order_item_id,settlement_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_pre_sale_info:
        actualDataNodes: ds.order_pre_sale_info_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,order_pre_sale_info_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_addr:
        actualDataNodes: ds.order_addr_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,user_id,refund_id,order_item_id,order_addr_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_invoice:
        actualDataNodes: ds.order_invoice_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,user_id,refund_id,order_item_id,order_invoice_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_self_station:
        actualDataNodes: ds.order_self_station_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,user_id,order_self_station_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_virtual_info:
        actualDataNodes: ds.order_virtual_info_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,order_virtual_info_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      #       退款业务表
      order_refund:
        actualDataNodes: ds.order_refund_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,user_id,refund_id,order_item_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_refund_addr:
        actualDataNodes: ds.order_refund_addr_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,user_id,refund_id,order_item_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_refund_intervention:
        actualDataNodes: ds.order_refund_intervention_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: refund_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      order_refund_settlement:
        actualDataNodes: ds.order_refund_settlement_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: order_id,user_id,refund_id,order_item_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      # 采购订单业务表
      purchase_order:
        actualDataNodes: ds.purchase_order_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: purchase_order_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      purchase_order_item:
        actualDataNodes: ds.purchase_order_item_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: purchase_item_id,purchase_order_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      purchase_order_item_lang:
        actualDataNodes: ds.purchase_order_item_lang_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: purchase_item_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      purchase_order_lang:
        actualDataNodes: ds.purchase_order_lang_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: purchase_order_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      purchase_order_addr:
        actualDataNodes: ds.purchase_order_addr_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: purchase_order_addr_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      delivery_order:
        actualDataNodes: ds.delivery_order_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: delivery_order_id,order_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
      delivery_order_item:
        actualDataNodes: ds.delivery_order_item_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: delivery_order_id,delivery_order_item_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
       # 调拨订单
      allot_order:
        actualDataNodes: ds.allot_order_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: allot_order_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
        # 调拨订单项
      allot_order_item:
        actualDataNodes: ds.allot_order_item_$->{0..49}
        tableStrategy:
          complex:
            shardingColumns: allot_order_item_id,allot_order_id
            shardingAlgorithmName: customTableComplexKeysShardingAlgorithm
    # 绑定表配置
    bindingTables:
      - order,order_item,order_addr,order_item_lang,order_settlement,order_invoice,order_refund,order_refund_addr,order_refund_intervention,order_refund_settlement,order_pre_sale_info,purchase_order,purchase_order_item,purchase_order_item_lang,purchase_order_lang,purchase_order_addr,order_self_station,order_virtual_info,delivery_order,delivery_order_item,allot_order,allot_order_item
    shardingAlgorithms:
      customTableComplexKeysShardingAlgorithm : # 分片算法名称
        type: class_based
        props:
          strategy: complex
          algorithmClassName: com.mall4j.cloud.common.sharding.proxy.order.CustomTableComplexKeysShardingAlgorithm
  - !SINGLE
    tables:
      - ds.*
    defaultDataSource: ds