112 lines
3.8 KiB
Go
112 lines
3.8 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"
|
|
)
|
|
|
|
// SysJobDao is the data access object for the table sys_job.
|
|
type SysJobDao 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 SysJobColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// SysJobColumns defines and stores column names for the table sys_job.
|
|
type SysJobColumns struct {
|
|
JobId string // 任务ID
|
|
JobName string // 任务名称
|
|
JobParams string // 参数
|
|
JobGroup string // 任务组名
|
|
InvokeTarget string // 调用目标字符串
|
|
CronExpression string // cron执行表达式
|
|
MisfirePolicy string // 计划执行策略(1多次执行 2执行一次)
|
|
Concurrent string // 是否并发执行(0允许 1禁止)
|
|
Status string // 状态(0正常 1暂停)
|
|
Remark string // 备注信息
|
|
CreatedDept string // 创建部门
|
|
CreatedBy string // 创建者
|
|
CreatedAt string // 创建时间
|
|
UpdatedBy string // 更新者
|
|
UpdatedAt string // 更新时间
|
|
DeletedBy string // 删除人
|
|
DeletedAt string // 删除时间
|
|
}
|
|
|
|
// sysJobColumns holds the columns for the table sys_job.
|
|
var sysJobColumns = SysJobColumns{
|
|
JobId: "job_id",
|
|
JobName: "job_name",
|
|
JobParams: "job_params",
|
|
JobGroup: "job_group",
|
|
InvokeTarget: "invoke_target",
|
|
CronExpression: "cron_expression",
|
|
MisfirePolicy: "misfire_policy",
|
|
Concurrent: "concurrent",
|
|
Status: "status",
|
|
Remark: "remark",
|
|
CreatedDept: "created_dept",
|
|
CreatedBy: "created_by",
|
|
CreatedAt: "created_at",
|
|
UpdatedBy: "updated_by",
|
|
UpdatedAt: "updated_at",
|
|
DeletedBy: "deleted_by",
|
|
DeletedAt: "deleted_at",
|
|
}
|
|
|
|
// NewSysJobDao creates and returns a new DAO object for table data access.
|
|
func NewSysJobDao(handlers ...gdb.ModelHandler) *SysJobDao {
|
|
return &SysJobDao{
|
|
group: "default",
|
|
table: "sys_job",
|
|
columns: sysJobColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *SysJobDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *SysJobDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *SysJobDao) Columns() SysJobColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *SysJobDao) 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 *SysJobDao) 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 *SysJobDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|