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

// V2OrderInfoDao is the data access object for table order_info.
type V2OrderInfoDao struct {
	table   string             // table is the underlying table name of the DAO.
	group   string             // group is the database configuration group name of current DAO.
	columns V2OrderInfoColumns // columns contains all the column names of Table for convenient usage.
}

// V2OrderInfoColumns defines and stores column names for table order_info.
type V2OrderInfoColumns struct {
	Id              string // 主键，自增
	MerchantOrderId string // 下游商户提交过来的订单id
	ShopName        string // 商品名称
	OrderPeriod     string // 订单有效时间，小时制
	BankOrderId     string // 平台自身的订单id
	BankTransId     string // 上游返回的订单id
	OrderAmount     string // 订单提交金额
	ShowAmount      string // 展示在用户面前待支付的金额
	FactAmount      string // 实际支付金额
	RollPoolCode    string // 轮询产品编码
	RollPoolName    string // 轮询产品名称
	RoadUid         string // 通道uid
	RoadName        string // 通道名称
	PayProductCode  string // 支付产品编码
	PayProductName  string // 支付产品名称
	PayTypeCode     string // 支付类型编码
	PayTypeName     string // 支付类型名称
	OsType          string // 平台类型，苹果app-0， 安卓app-1，苹果H5-3，安卓H5-4，pc-5
	Status          string // 等待支付-wait,支付成功-success, 支付失败-failed
	Refund          string // 退款-yes， 没有退款-no
	RefundTime      string // 退款时间
	Freeze          string // 冻结-yes， 没有-no
	FreezeTime      string // 冻结时间
	Unfreeze        string // 解冻-yes，没有-no
	UnfreezeTime    string // 解冻时间
	NotifyUrl       string // 订单回调给下游的地址
	MerchantUid     string // 商户uid，表示订单是哪个商户的
	MerchantName    string // 商户名称
	AgentUid        string // 代理uid，表示该商户是谁的代理
	AgentName       string // 代理名称
	Response        string // 上游返回的结果
	UpdateTime      string // 更新时间
	CreateTime      string // 创建时间
	ExValue         string //
	CardData        string //
	Operator        string //
	CardReturnData  string //
}

// v2OrderInfoColumns holds the columns for table order_info.
var v2OrderInfoColumns = V2OrderInfoColumns{
	Id:              "id",
	MerchantOrderId: "merchant_order_id",
	ShopName:        "shop_name",
	OrderPeriod:     "order_period",
	BankOrderId:     "bank_order_id",
	BankTransId:     "bank_trans_id",
	OrderAmount:     "order_amount",
	ShowAmount:      "show_amount",
	FactAmount:      "fact_amount",
	RollPoolCode:    "roll_pool_code",
	RollPoolName:    "roll_pool_name",
	RoadUid:         "road_uid",
	RoadName:        "road_name",
	PayProductCode:  "pay_product_code",
	PayProductName:  "pay_product_name",
	PayTypeCode:     "pay_type_code",
	PayTypeName:     "pay_type_name",
	OsType:          "os_type",
	Status:          "status",
	Refund:          "refund",
	RefundTime:      "refund_time",
	Freeze:          "freeze",
	FreezeTime:      "freeze_time",
	Unfreeze:        "unfreeze",
	UnfreezeTime:    "unfreeze_time",
	NotifyUrl:       "notify_url",
	MerchantUid:     "merchant_uid",
	MerchantName:    "merchant_name",
	AgentUid:        "agent_uid",
	AgentName:       "agent_name",
	Response:        "response",
	UpdateTime:      "update_time",
	CreateTime:      "create_time",
	ExValue:         "ex_value",
	CardData:        "card_data",
	Operator:        "operator",
	CardReturnData:  "card_return_data",
}

// NewV2OrderInfoDao creates and returns a new DAO object for table data access.
func NewV2OrderInfoDao() *V2OrderInfoDao {
	return &V2OrderInfoDao{
		group:   "default",
		table:   "order_info",
		columns: v2OrderInfoColumns,
	}
}

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

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

// Columns returns all column names of current dao.
func (dao *V2OrderInfoDao) Columns() V2OrderInfoColumns {
	return dao.columns
}

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

// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *V2OrderInfoDao) Ctx(ctx context.Context) *gdb.Model {
	return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}

// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *V2OrderInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
	return dao.Ctx(ctx).Transaction(ctx, f)
}
