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

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

// TaskBaseInfoColumns defines and stores column names for table task_base_info.
type TaskBaseInfoColumns struct {
	TaskId         string // 任务基础信息id
	TaskName       string // 任务名称
	TaskPlatform   string // 任务平台id,取third_platform_info表id
	TaskMode       string // 任务模式 1置换任务 2稿费任务 3折扣任务
	BusinessType   string // 业务类型 1实物 2虚拟 3线下
	ContentForm    string // 内容形式 低4位为图片和视频类型，0001原创图片 0010指定图片 0100原创视频 1000指定视频 5~6位为文案类型 010000为原创文案 100000为指定文案 第7位为是否直播01000000为直播00000000为非直播
	OtherForm      string // 其他形式 1不限 2仅单品 3仅合辑
	StartTime      string // 作品发布时间
	EndTime        string // 作品结束时间
	DeadlineTime   string // 任务报名截至日期
	TaskStatus     string // 任务状态：1待支付（待上线）  2执行中  3已结案
	TaskCreateFlag string // 创建任务时提交状态
	BrandId        string // 品牌id
	ProductId      string // 任务商品id
	CreatedAt      string // 创建时间
	OnlineTime     string // 上线时间
	BrandName      string // 品牌名称
}

//  taskBaseInfoColumns holds the columns for table task_base_info.
var taskBaseInfoColumns = TaskBaseInfoColumns{
	TaskId:         "task_id",
	TaskName:       "task_name",
	TaskPlatform:   "task_platform",
	TaskMode:       "task_mode",
	BusinessType:   "business_type",
	ContentForm:    "content_form",
	OtherForm:      "other_form",
	StartTime:      "start_time",
	EndTime:        "end_time",
	DeadlineTime:   "deadline_time",
	TaskStatus:     "task_status",
	TaskCreateFlag: "task_create_flag",
	BrandId:        "brand_id",
	ProductId:      "product_id",
	CreatedAt:      "created_at",
	OnlineTime:     "online_time",
	BrandName:      "brand_name",
}

// NewTaskBaseInfoDao creates and returns a new DAO object for table data access.
func NewTaskBaseInfoDao() *TaskBaseInfoDao {
	return &TaskBaseInfoDao{
		Group:   "default",
		Table:   "task_base_info",
		Columns: taskBaseInfoColumns,
	}
}

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