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

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

// OrderInfoColumns defines and stores column names for table order_info.
type OrderInfoColumns struct {
	OrderId                string //
	TaskId                 string // 任务id
	TaskName               string // 任务名称(冗余)
	TaskBrandName          string // 品牌名称(冗余)
	ProductName            string // 商品名称(冗余)
	ProductMainImg         string // 商品主图url(冗余)
	TalentId               string // 达人id
	TalentPlatformInfoSnap string // 达人平台信息快照
	TalentPersonalInfoSnap string // 达人个人信息快照
	TalentPostAddrSnap     string // 收货地址快照
	TaskLevelId            string // 报名选择的招募等级id(task_recruit_talent_level表中的id)
	SettleAmount           string // 待结算金额
	ProdSpecificationId    string // 商品规格列表的索引
	ProdNote               string // 商品备注
	OrderStatus            string // 订单状态
	CreateDate             string // 创建时间
	SelectDate             string // 反选时间
	PartnerWay             string // 合作方式
	CompleteStatus         string // 结束方式 1未结束 2正常结束 3反选失败 4达人取消
	CompleteDate           string // 结束时间
}

//  orderInfoColumns holds the columns for table order_info.
var orderInfoColumns = OrderInfoColumns{
	OrderId:                "order_id",
	TaskId:                 "task_id",
	TaskName:               "task_name",
	TaskBrandName:          "task_brand_name",
	ProductName:            "product_name",
	ProductMainImg:         "product_main_img",
	TalentId:               "talent_id",
	TalentPlatformInfoSnap: "talent_platform_info_snap",
	TalentPersonalInfoSnap: "talent_personal_info_snap",
	TalentPostAddrSnap:     "talent_post_addr_snap",
	TaskLevelId:            "task_level_id",
	SettleAmount:           "settle_amount",
	ProdSpecificationId:    "prod_specification_id",
	ProdNote:               "prod_note",
	OrderStatus:            "order_status",
	CreateDate:             "create_date",
	SelectDate:             "select_date",
	PartnerWay:             "partner_way",
	CompleteStatus:         "complete_status",
	CompleteDate:           "complete_date",
}

// NewOrderInfoDao creates and returns a new DAO object for table data access.
func NewOrderInfoDao() *OrderInfoDao {
	return &OrderInfoDao{
		Group:   "default",
		Table:   "order_info",
		Columns: orderInfoColumns,
	}
}

// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *OrderInfoDao) 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 *OrderInfoDao) 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 *OrderInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
	return dao.Ctx(ctx).Transaction(ctx, f)
}
