# 设置输出编码为UTF-8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# 数据库连接信息 - 修改了URL格式
$DB_URL = "bdrp:d7X7E1KSxrZC@(127.0.0.1:21001)/bdrp"
$OUTPUT_DIR = "./model"
$TEMPLATE_DIR = "../template"

# 表名列表
$tables = @(
    # "agent"
    # "agent_active_stat",
    # "agent_audit",
    # "agent_closure",
    # "agent_commission"
    # "agent_wallet_transaction"
    # "agent_commission_deduction"
    # "agent_link",
    # "agent_membership_config",
    # "agent_membership_recharge_order"
    # "agent_membership_user_config",
    # "agent_order",
    # "agent_platform_deduction"
    # "agent_product_config",
    # "agent_rewards",
    # "agent_wallet",
    # "agent_real_name"
    # "agent_withdrawal"
    # "agent_withdrawal_tax"
    # "agent_withdrawal_tax_exemption"
    # "feature"
    # "global_notifications"
    # "order"
    # "order_refund"
    # "product",
    # "product_feature"
    # "query",
    # "query_user_record"   # 查询用户记录表：姓名、身份证、手机号、支付订单号等
    # "query_cleanup_log"
    # "query_cleanup_detail"
    # "query_cleanup_config"
    "user"
    # "user_auth"
    # "user_temp"
    # "example"
    # "admin_user"
    # "admin_user_role"
    # "admin_api",
    # "admin_menu"
    # "admin_role",
    # "admin_role_api",
    # "admin_role_menu",
    # "admin_dict_data"
    # "admin_dict_type"
    # "admin_promotion_link"
    # "admin_promotion_link_stats_total"
    # "admin_promotion_link_stats_history"
    # "admin_promotion_order"

)

# 为每个表生成模型
foreach ($table in $tables) {
    goctl model mysql datasource -url="bdrp:d7X7E1KSxrZC@tcp(127.0.0.1:21001)/bdrp" -table="$table" -dir="./model" --home="../template" -cache=true --style=goZero
}
