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

package internal

import (
	"context"
	"github.com/gogf/gf/database/gdb"
	"github.com/gogf/gf/frame/g"
)

// WxPayOrderDao is the manager for logic model data accessing and custom defined data operations functions management.
type WxPayOrderDao 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 WxPayOrderColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
}

// WxPayOrderColumns defines and stores column names for table wx_pay_order.
type WxPayOrderColumns struct {
	OrderId                   string //
	OutTradeNo                string // 本平台的订单号
	WxOrderNo                 string // 微信产生的订单号
	PayAmount                 string // 支付金额
	TaskName                  string // 任务名称
	PayReason                 string // 支付用途 1拍单
	TalentId                  string // 达人id
	TalentWxNickname          string // 达人微信昵称
	TalentPlatformAccountName string // 达人平台账号昵称
	TaskId                    string // 任务id
	TaskPlatform              string // 任务的社媒平台id
	Success                   string // 是否成功
	CreateAt                  string // 订单生成时间
	Desc                      string // 描述
}

//  wxPayOrderColumns holds the columns for table wx_pay_order.
var wxPayOrderColumns = WxPayOrderColumns{
	OrderId:                   "order_id",
	OutTradeNo:                "out_trade_no",
	WxOrderNo:                 "wx_order_no",
	PayAmount:                 "pay_amount",
	TaskName:                  "task_name",
	PayReason:                 "pay_reason",
	TalentId:                  "talent_id",
	TalentWxNickname:          "talent_wx_nickname",
	TalentPlatformAccountName: "talent_platform_account_name",
	TaskId:                    "task_id",
	TaskPlatform:              "task_platform",
	Success:                   "success",
	CreateAt:                  "create_at",
	Desc:                      "desc",
}

// NewWxPayOrderDao creates and returns a new DAO object for table data access.
func NewWxPayOrderDao() *WxPayOrderDao {
	return &WxPayOrderDao{
		Group:   "default",
		Table:   "wx_pay_order",
		Columns: wxPayOrderColumns,
	}
}

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

// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *WxPayOrderDao) 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 *WxPayOrderDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
	return dao.Ctx(ctx).Transaction(ctx, f)
}
