126 lines
4.5 KiB
Go
126 lines
4.5 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"
|
|
)
|
|
|
|
// ApprovalRequestDao is the data access object for the table hg_approval_request.
|
|
type ApprovalRequestDao 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 ApprovalRequestColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// ApprovalRequestColumns defines and stores column names for the table hg_approval_request.
|
|
type ApprovalRequestColumns struct {
|
|
Id string // 主键
|
|
TenantId string // 租户ID
|
|
ApprovalNo string // 审批单号
|
|
ApprovalType string // 审批类型
|
|
TargetType string // 目标类型
|
|
TargetId string // 目标ID
|
|
Action string // 拟执行动作
|
|
Title string // 审批标题
|
|
PayloadJson string // 待执行数据快照
|
|
DiffJson string // 前后差异
|
|
RiskLevel string // 风险级别
|
|
RequiredApprovals string // 需要通过数
|
|
ApprovalStatus string // 审批状态
|
|
ApplicantId string // 申请人
|
|
SubmittedAt string // 提交时间
|
|
DecidedAt string // 决定时间
|
|
ExecutedAt string // 执行时间
|
|
ExpireAt string // 超时时间
|
|
Version string // 乐观锁
|
|
Remark string // 备注
|
|
CreatedBy string // 创建者
|
|
UpdatedBy string // 更新者
|
|
CreatedAt string // 创建时间
|
|
UpdatedAt string // 更新时间
|
|
}
|
|
|
|
// approvalRequestColumns holds the columns for the table hg_approval_request.
|
|
var approvalRequestColumns = ApprovalRequestColumns{
|
|
Id: "id",
|
|
TenantId: "tenant_id",
|
|
ApprovalNo: "approval_no",
|
|
ApprovalType: "approval_type",
|
|
TargetType: "target_type",
|
|
TargetId: "target_id",
|
|
Action: "action",
|
|
Title: "title",
|
|
PayloadJson: "payload_json",
|
|
DiffJson: "diff_json",
|
|
RiskLevel: "risk_level",
|
|
RequiredApprovals: "required_approvals",
|
|
ApprovalStatus: "approval_status",
|
|
ApplicantId: "applicant_id",
|
|
SubmittedAt: "submitted_at",
|
|
DecidedAt: "decided_at",
|
|
ExecutedAt: "executed_at",
|
|
ExpireAt: "expire_at",
|
|
Version: "version",
|
|
Remark: "remark",
|
|
CreatedBy: "created_by",
|
|
UpdatedBy: "updated_by",
|
|
CreatedAt: "created_at",
|
|
UpdatedAt: "updated_at",
|
|
}
|
|
|
|
// NewApprovalRequestDao creates and returns a new DAO object for table data access.
|
|
func NewApprovalRequestDao(handlers ...gdb.ModelHandler) *ApprovalRequestDao {
|
|
return &ApprovalRequestDao{
|
|
group: "default",
|
|
table: "hg_approval_request",
|
|
columns: approvalRequestColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *ApprovalRequestDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *ApprovalRequestDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *ApprovalRequestDao) Columns() ApprovalRequestColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *ApprovalRequestDao) 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 *ApprovalRequestDao) 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 *ApprovalRequestDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|