// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================

package internal

import (
	"context"

	"github.com/gogf/gf/v2/database/gdb"
	"github.com/gogf/gf/v2/frame/g"
)

// V1MerchantDeployInfoDao is the data access object for the table merchant_deploy_info.
type V1MerchantDeployInfoDao struct {
	table    string                      // table is the underlying table name of the DAO.
	group    string                      // group is the database configuration group name of the current DAO.
	columns  V1MerchantDeployInfoColumns // columns contains all the column names of Table for convenient usage.
	handlers []gdb.ModelHandler          // handlers for customized model modification.
}

// V1MerchantDeployInfoColumns defines and stores column names for the table merchant_deploy_info.
type V1MerchantDeployInfoColumns struct {
	Id                     string // 主键，自增
	Status                 string // 商户状态状态
	MerchantUid            string // 商户uid
	PayType                string // 支付配置
	SingleRoadUid          string // 单通道uid
	SingleRoadName         string // 单通道名称
	SingleRoadPlatformRate string // 单通到平台净利率（关系映射）
	SingleRoadAgentRate    string // 单通到代理净利率
	RollRoadCode           string // 轮询通道编码
	RollRoadName           string // 轮询通道名称
	RollRoadPlatformRate   string // 轮询通道平台净利率
	RollRoadAgentRate      string // 轮询通道代理净利率
	RestrictArea           string // 限制地区
	IsLoan                 string // 是否押款
	LoanRate               string // 押款比例，默认是0
	LoanDays               string // 押款的天数，默认0天
	UnfreezeHour           string // 每天解款的时间点，默认是凌晨
	WaitUnfreezeAmount     string // 等待解款的金额
	LoanAmount             string // 押款中的金额
	UpdateTime             string // 更新时间
	CreateTime             string // 创建时间
	AutoSettle             string //
	AutoPayfor             string //
	IsRestrictAgent        string // 是否检测代理
	IsRestrictCardPass     string // 是否限制卡密
	IsRestrictDevice       string // 是否限制设备
	IsRestrictIp           string // 是否限制IP
	IsRestrictInternalIp   string // 是否限制局域网IP
	SubmitStrategy         string // 订单提交策略：DIRECT-直接提交，POOL-缓存在订单池中二次提交
}

// v1MerchantDeployInfoColumns holds the columns for the table merchant_deploy_info.
var v1MerchantDeployInfoColumns = V1MerchantDeployInfoColumns{
	Id:                     "id",
	Status:                 "status",
	MerchantUid:            "merchant_uid",
	PayType:                "pay_type",
	SingleRoadUid:          "single_road_uid",
	SingleRoadName:         "single_road_name",
	SingleRoadPlatformRate: "single_road_platform_rate",
	SingleRoadAgentRate:    "single_road_agent_rate",
	RollRoadCode:           "roll_road_code",
	RollRoadName:           "roll_road_name",
	RollRoadPlatformRate:   "roll_road_platform_rate",
	RollRoadAgentRate:      "roll_road_agent_rate",
	RestrictArea:           "restrict_area",
	IsLoan:                 "is_loan",
	LoanRate:               "loan_rate",
	LoanDays:               "loan_days",
	UnfreezeHour:           "unfreeze_hour",
	WaitUnfreezeAmount:     "wait_unfreeze_amount",
	LoanAmount:             "loan_amount",
	UpdateTime:             "update_time",
	CreateTime:             "create_time",
	AutoSettle:             "auto_settle",
	AutoPayfor:             "auto_payfor",
	IsRestrictAgent:        "is_restrict_agent",
	IsRestrictCardPass:     "is_restrict_card_pass",
	IsRestrictDevice:       "is_restrict_device",
	IsRestrictIp:           "is_restrict_ip",
	IsRestrictInternalIp:   "is_restrict_internal_ip",
	SubmitStrategy:         "submit_strategy",
}

// NewV1MerchantDeployInfoDao creates and returns a new DAO object for table data access.
func NewV1MerchantDeployInfoDao(handlers ...gdb.ModelHandler) *V1MerchantDeployInfoDao {
	return &V1MerchantDeployInfoDao{
		group:    "default",
		table:    "merchant_deploy_info",
		columns:  v1MerchantDeployInfoColumns,
		handlers: handlers,
	}
}

// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *V1MerchantDeployInfoDao) DB() gdb.DB {
	return g.DB(dao.group)
}

// Table returns the table name of the current DAO.
func (dao *V1MerchantDeployInfoDao) Table() string {
	return dao.table
}

// Columns returns all column names of the current DAO.
func (dao *V1MerchantDeployInfoDao) Columns() V1MerchantDeployInfoColumns {
	return dao.columns
}

// Group returns the database configuration group name of the current DAO.
func (dao *V1MerchantDeployInfoDao) Group() string {
	return dao.group
}

// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *V1MerchantDeployInfoDao) Ctx(ctx context.Context) *gdb.Model {
	model := dao.DB().Model(dao.table)
	for _, handler := range dao.handlers {
		model = handler(model)
	}
	return model.Safe().Ctx(ctx)
}

// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *V1MerchantDeployInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
	return dao.Ctx(ctx).Transaction(ctx, f)
}
