108 lines
4.0 KiB
Go
108 lines
4.0 KiB
Go
// ==========================================================================
|
||
// 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"
|
||
)
|
||
|
||
// UserTaskRewardsDao is the data access object for the table user_task_rewards.
|
||
type UserTaskRewardsDao 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 UserTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
|
||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||
}
|
||
|
||
// UserTaskRewardsColumns defines and stores column names for the table user_task_rewards.
|
||
type UserTaskRewardsColumns struct {
|
||
Id string // 用户任务奖励记录唯一标识符
|
||
UserTaskId string // 关联用户任务记录ID
|
||
RewardId string // 奖励ID
|
||
RewardName string // 奖励名称冗余字段
|
||
Status string // 状态:1=待用户完成任务,2=待领取,3=已领取, 待兑换,4=已过期,5=发放失败, 6=结束
|
||
Remark string // 备注或失败原因
|
||
ExternalOrderId string // 第三方发放平台的订单ID
|
||
InnerOrderId string // 系统内部订单ID
|
||
CreatedAt string // 创建时间
|
||
UpdatedAt string // 更新时间
|
||
DeletedAt string // 软删除时间
|
||
ExpiredAt string // 奖励过期时间
|
||
IssueQuantity string //
|
||
Source string // 来源 1:系统 2:门店
|
||
RewardTypeId string // 奖励类型 id
|
||
}
|
||
|
||
// userTaskRewardsColumns holds the columns for the table user_task_rewards.
|
||
var userTaskRewardsColumns = UserTaskRewardsColumns{
|
||
Id: "id",
|
||
UserTaskId: "user_task_id",
|
||
RewardId: "reward_id",
|
||
RewardName: "reward_name",
|
||
Status: "status",
|
||
Remark: "remark",
|
||
ExternalOrderId: "external_order_id",
|
||
InnerOrderId: "inner_order_id",
|
||
CreatedAt: "created_at",
|
||
UpdatedAt: "updated_at",
|
||
DeletedAt: "deleted_at",
|
||
ExpiredAt: "expired_at",
|
||
IssueQuantity: "issue_quantity",
|
||
Source: "source",
|
||
RewardTypeId: "reward_type_id",
|
||
}
|
||
|
||
// NewUserTaskRewardsDao creates and returns a new DAO object for table data access.
|
||
func NewUserTaskRewardsDao(handlers ...gdb.ModelHandler) *UserTaskRewardsDao {
|
||
return &UserTaskRewardsDao{
|
||
group: "default",
|
||
table: "user_task_rewards",
|
||
columns: userTaskRewardsColumns,
|
||
handlers: handlers,
|
||
}
|
||
}
|
||
|
||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||
func (dao *UserTaskRewardsDao) DB() gdb.DB {
|
||
return g.DB(dao.group)
|
||
}
|
||
|
||
// Table returns the table name of the current DAO.
|
||
func (dao *UserTaskRewardsDao) Table() string {
|
||
return dao.table
|
||
}
|
||
|
||
// Columns returns all column names of the current DAO.
|
||
func (dao *UserTaskRewardsDao) Columns() UserTaskRewardsColumns {
|
||
return dao.columns
|
||
}
|
||
|
||
// Group returns the database configuration group name of the current DAO.
|
||
func (dao *UserTaskRewardsDao) 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 *UserTaskRewardsDao) 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 *UserTaskRewardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||
}
|