dataSources:
  cpp:
    dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
    driverClassName: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://192.168.1.205:3306/cpp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
    username: root
    password: '!QAZ2root'
    # 初始连接数
    initialSize: 5
    # 最小连接池数量
    minIdle: 10
    # 最大连接池数量
    maxActive: 20
    # 配置获取连接等待超时的时间
    maxWait: 60000
    # 配置连接超时时间
    connectTimeout: 30000
    # 配置网络超时时间
    socketTimeout: 60000
    # 配置间隔多久才进行一次检测，检测需要关闭的空闲连接，单位是毫秒
    timeBetweenEvictionRunsMillis: 60000
    # 配置一个连接在池中最小生存的时间，单位是毫秒
    minEvictableIdleTimeMillis: 300000
    # 配置一个连接在池中最大生存的时间，单位是毫秒
    maxEvictableIdleTimeMillis: 900000
    # 配置检测连接是否有效
    validationQuery: SELECT 1 FROM DUAL
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    webStatFilter:
      enabled: true
    statViewServlet:
      enabled: true
      # 设置白名单，不填则允许所有访问
      allow:
      url-pattern: /druid/*
      # 控制台管理用户名和密码
      login-username: ruoyi
      login-password: 123456
    filter:
      stat:
        enabled: true
        # 慢SQL记录
        log-slow-sql: true
        slow-sql-millis: 1000
        merge-sql: true
      wall:
        config:
          multi-statement-allow: true
#  cpp:
#    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
#    driverClassName: com.mysql.jdbc.Driver
#    jdbcUrl: jdbc:mysql://192.168.1.205:3306/cpp?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
#    username: root
#    password: '!QAZ2root'
#    hikari:
#      minimum-idle: 5 # 最小空闲连接数量
#      idle-timeout: 600000 # 空闲连接存活最大时间，默认为10分钟（600000毫秒），此处设置为3分钟（180000毫秒）
#      maximum-pool-size: 20 # 连接池最大连接数，默认为10
#      auto-commit: true # 自动提交事务，默认为true
#      max-lifetime: 1800000 # 连接最大生命周期，默认为30分钟（1800000毫秒）
#      connection-timeout: 30000 # 数据库连接超时时间，默认为30秒（30000毫秒）
rules:
- !SHARDING
  tables:
    cpp_forecast_power_ultra_short_term_regulation:
      actualDataNodes: cpp.cpp_forecast_power_ultra_short_term_regulation
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_forecast_power_ultra_short_term_station:
      actualDataNodes: cpp.cpp_forecast_power_ultra_short_term_station
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_forecast_power_ultra_short_term_cloud:
      actualDataNodes: cpp.cpp_forecast_power_ultra_short_term_cloud
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_forecast_power_short_term_station:
      actualDataNodes: cpp.cpp_forecast_power_short_term_station
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_forecast_power_short_term_send:
      actualDataNodes: cpp.cpp_forecast_power_short_term_send
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_forecast_power_short_term_regulation:
      actualDataNodes: cpp.cpp_forecast_power_short_term_regulation
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_forecast_power_short_term_cloud:
      actualDataNodes: cpp.cpp_forecast_power_short_term_cloud
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_power_station_status_data:
      actualDataNodes: cpp.cpp_power_station_status_data
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_parsing_log:
      actualDataNodes: cpp.cpp_parsing_log
      tableStrategy:
        standard:
          shardingColumn: create_time
          shardingAlgorithmName: auto-custom
    cpp_weather_station_status_data:
      actualDataNodes: cpp.cpp_weather_station_status_data
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_wind_tower_status_data:
      actualDataNodes: cpp.cpp_wind_tower_status_data
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_wind_turbine_status_data:
      actualDataNodes: cpp.cpp_wind_turbine_status_data
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_inverter_status_data:
      actualDataNodes: cpp.cpp_inverter_status_data
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_nwp_cloud:
      actualDataNodes: cpp.cpp_nwp_cloud
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
    cpp_nwp_station:
      actualDataNodes: cpp.cpp_nwp_station
      tableStrategy:
        standard:
          shardingColumn: time
          shardingAlgorithmName: auto-custom
  shardingAlgorithms:
    auto-custom:
      type: CLASS_BASED
      props:
        strategy: standard
        algorithmClassName: com.cpp.web.core.config.sharding.TimeShardingAlgorithm
    interval:
      type: INTERVAL
      props:
        datetime-pattern: 'yyyy-MM'
        datetime-lower: '2024-01'
        datetime-upper: '2025-12'
        sharding-suffix-pattern: 'yyyyMM'
        # 间隔大小
        datetime-interval-amount: 1
        datetime-interval-unit: 'Months'

props:
  sql-show: false
  allow-range-query-with-inline-sharding: true