server:
  port: 8082

spring:
  application:
    name: hzhub-erp

  datasource:
    dynamic:
      primary: master  # 设置默认数据源为master（MySQL）
      strict: false    # 允许非严格匹配
      datasource:
        # MySQL数据源 - 用于存储API配置、参数、统计信息
        master:
          url: jdbc:mysql://${MYSQL_HOST:192.168.120.60}:${MYSQL_PORT:3306}/hzhub?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
          username: ${MYSQL_USERNAME:root}
          password: ${MYSQL_PASSWORD:hzhub123}
          driver-class-name: com.mysql.cj.jdbc.Driver
        # SQL Server数据源 - 用于执行ERP动态SQL查询（只读）
        erp:
          url: jdbc:sqlserver://${ERP_DB_HOST:192.168.120.10}:${ERP_DB_PORT:8042};databaseName=${ERP_DB_NAME:DMPF_HY};encrypt=false;trustServerCertificate=true
          username: ${ERP_DB_USERNAME:aiuser}
          password: ${ERP_DB_PASSWORD:aiuser123}
          driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver

  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    serialization:
      indent_output: false
      fail_on_empty_beans: false
    deserialization:
      fail_on_unknown_properties: false

  profiles:
    active: dev

# MyBatis-Plus 配置
mybatis-plus:
  global-config:
    db-config:
      logic-delete-field: deleted
      logic-delete-value: 1
      logic-not-delete-value: 0
  mapper-locations: classpath*:mapper/**/*.xml
  configuration:
    map-underscore-to-camel-case: true

# Sa-Token 配置（JWT secret 需与 hzhub-ai 一致以支持跨服务 Token 验证）
sa-token:
  token-name: Authorization
  timeout: 86400
  activity-timeout: -1
  is-concurrent: true
  is-share: false
  token-style: uuid
  is-log: false
  jwt-secret-key: ${ERP_JWT_SECRET:abcdefghijklmnopqrstuvwxyz}
  token-prefix: "Bearer"
  is-read-header: true
  is-read-cookie: false
  # 开发阶段：关闭认证检查
  is-read-body: false
  check-id-token: false
  is-token-header: false
  is-token-cookie: false

# Actuator 健康检查
management:
  endpoints:
    web:
      exposure:
        include: health,info
  endpoint:
    health:
      show-details: always
