// ==========================================================================
// 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"
)

// V1PayforInfoDao is the data access object for the table payfor_info.
type V1PayforInfoDao 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  V1PayforInfoColumns // columns contains all the column names of Table for convenient usage.
	handlers []gdb.ModelHandler  // handlers for customized model modification.
}

// V1PayforInfoColumns defines and stores column names for the table payfor_info.
type V1PayforInfoColumns struct {
	Id                 string // 主键，自增
	PayforUid          string // 代付唯一uid
	MerchantUid        string // 发起代付的商户uid
	MerchantName       string // 发起代付的商户名称
	MerchantOrderId    string // 下游代付订单id
	BankOrderId        string // 系统代付订单id
	BankTransId        string // 上游返回的代付订单id
	RoadUid            string // 所用的代付通道uid
	RoadName           string // 所有通道的名称
	RollPoolCode       string // 所用轮询池编码
	RollPoolName       string // 所用轮询池的名称
	PayforFee          string // 代付手续费
	PayforAmount       string // 代付到账金额
	PayforTotalAmount  string // 代付总金额
	BankCode           string // 银行编码
	BankName           string // 银行名称
	BankAccountName    string // 银行开户名称
	BankAccountNo      string // 银行开户账号
	BankAccountType    string // 银行卡类型，对私-private，对公-public
	Country            string // 开户所属国家
	Province           string // 银行卡开户所属省
	City               string // 银行卡开户所属城市
	Ares               string // 所属地区
	BankAccountAddress string // 银行开户具体街道
	PhoneNo            string // 开户所用手机号
	GiveType           string // 下发类型，payfor_road-通道打款，payfor_hand-手动打款，payfor_refuse-拒绝打款
	Type               string // 代付类型，self_api-系统发下， 管理员手动下发给商户-self_merchant，管理自己提现-self_help
	NotifyUrl          string // 代付结果回调给下游的地址
	Status             string // 审核-payfor_confirm,系统处理中-payfor_solving，银行处理中-payfor_banking，代付成功-success, 代付失败-failed
	IsSend             string // 未发送-no，已经发送-yes
	RequestTime        string // 发起请求时间
	ResponseTime       string // 上游做出响应的时间
	ResponseContent    string // 代付的最终结果
	Remark             string // 代付备注
	UpdateTime         string // 更新时间
	CreateTime         string // 创建时间
	Attach             string //
}

// v1PayforInfoColumns holds the columns for the table payfor_info.
var v1PayforInfoColumns = V1PayforInfoColumns{
	Id:                 "id",
	PayforUid:          "payfor_uid",
	MerchantUid:        "merchant_uid",
	MerchantName:       "merchant_name",
	MerchantOrderId:    "merchant_order_id",
	BankOrderId:        "bank_order_id",
	BankTransId:        "bank_trans_id",
	RoadUid:            "road_uid",
	RoadName:           "road_name",
	RollPoolCode:       "roll_pool_code",
	RollPoolName:       "roll_pool_name",
	PayforFee:          "payfor_fee",
	PayforAmount:       "payfor_amount",
	PayforTotalAmount:  "payfor_total_amount",
	BankCode:           "bank_code",
	BankName:           "bank_name",
	BankAccountName:    "bank_account_name",
	BankAccountNo:      "bank_account_no",
	BankAccountType:    "bank_account_type",
	Country:            "country",
	Province:           "province",
	City:               "city",
	Ares:               "ares",
	BankAccountAddress: "bank_account_address",
	PhoneNo:            "phone_no",
	GiveType:           "give_type",
	Type:               "type",
	NotifyUrl:          "notify_url",
	Status:             "status",
	IsSend:             "is_send",
	RequestTime:        "request_time",
	ResponseTime:       "response_time",
	ResponseContent:    "response_content",
	Remark:             "remark",
	UpdateTime:         "update_time",
	CreateTime:         "create_time",
	Attach:             "attach",
}

// NewV1PayforInfoDao creates and returns a new DAO object for table data access.
func NewV1PayforInfoDao(handlers ...gdb.ModelHandler) *V1PayforInfoDao {
	return &V1PayforInfoDao{
		group:    "default",
		table:    "payfor_info",
		columns:  v1PayforInfoColumns,
		handlers: handlers,
	}
}

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

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

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

// Group returns the database configuration group name of the current DAO.
func (dao *V1PayforInfoDao) 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 *V1PayforInfoDao) 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 *V1PayforInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
	return dao.Ctx(ctx).Transaction(ctx, f)
}
