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

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

// V1RoadInfoColumns defines and stores column names for the table road_info.
type V1RoadInfoColumns struct {
	Id                     string // 主键，自增
	Status                 string //
	RoadName               string // 通道名称
	RoadUid                string // 通道唯一id
	Remark                 string // 备注
	ProductName            string // 上游产品名称
	ProductUid             string // 上游产品编号
	PayType                string // 支付类型
	BasicFee               string // 基本汇率/成本汇率
	SettleFee              string // 代付手续费
	TotalLimit             string // 通道总额度
	TodayLimit             string // 每日最多额度
	SingleMinLimit         string // 单笔最小金额
	SingleMaxLimit         string // 单笔最大金额
	StarHour               string // 通道开始时间
	EndHour                string // 通道结束时间
	Params                 string // 参数json格式
	TodayIncome            string // 当天的收入
	TotalIncome            string // 通道总收入
	TodayProfit            string // 当天的收益
	TotalProfit            string // 通道总收益
	Balance                string // 通道的余额
	RequestAll             string // 请求总次数
	RequestSuccess         string // 请求成功次数
	UpdateTime             string // 更新时间
	CreateTime             string // 创建时间
	TodayRequestAll        string //
	TodayRequestSuccess    string //
	ProductCode            string // 产品编码
	PaymentHtml            string // 支付页面模板，需要与前段对齐）
	TransactionType        string //
	IsAllowDifferentResend string //
	IsRepeatSubmit         string // 是否允许重复提交
}

// v1RoadInfoColumns holds the columns for the table road_info.
var v1RoadInfoColumns = V1RoadInfoColumns{
	Id:                     "id",
	Status:                 "status",
	RoadName:               "road_name",
	RoadUid:                "road_uid",
	Remark:                 "remark",
	ProductName:            "product_name",
	ProductUid:             "product_uid",
	PayType:                "pay_type",
	BasicFee:               "basic_fee",
	SettleFee:              "settle_fee",
	TotalLimit:             "total_limit",
	TodayLimit:             "today_limit",
	SingleMinLimit:         "single_min_limit",
	SingleMaxLimit:         "single_max_limit",
	StarHour:               "star_hour",
	EndHour:                "end_hour",
	Params:                 "params",
	TodayIncome:            "today_income",
	TotalIncome:            "total_income",
	TodayProfit:            "today_profit",
	TotalProfit:            "total_profit",
	Balance:                "balance",
	RequestAll:             "request_all",
	RequestSuccess:         "request_success",
	UpdateTime:             "update_time",
	CreateTime:             "create_time",
	TodayRequestAll:        "today_request_all",
	TodayRequestSuccess:    "today_request_success",
	ProductCode:            "product_code",
	PaymentHtml:            "payment_html",
	TransactionType:        "transaction_type",
	IsAllowDifferentResend: "is_allow_different_resend",
	IsRepeatSubmit:         "is_repeat_submit",
}

// NewV1RoadInfoDao creates and returns a new DAO object for table data access.
func NewV1RoadInfoDao(handlers ...gdb.ModelHandler) *V1RoadInfoDao {
	return &V1RoadInfoDao{
		group:    "default",
		table:    "road_info",
		columns:  v1RoadInfoColumns,
		handlers: handlers,
	}
}

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

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

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

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