114 lines
3.8 KiB
Go
114 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"
|
|
)
|
|
|
|
// BizAuditLogDao is the data access object for the table hg_biz_audit_log.
|
|
type BizAuditLogDao 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 BizAuditLogColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// BizAuditLogColumns defines and stores column names for the table hg_biz_audit_log.
|
|
type BizAuditLogColumns struct {
|
|
Id string // 主键
|
|
TenantId string // 租户ID
|
|
AuditNo string // 审计号
|
|
ActorType string // 操作人类型
|
|
ActorId string // 操作人ID
|
|
Module string // 业务模块
|
|
Action string // 操作动作
|
|
TargetType string // 目标类型
|
|
TargetId string // 目标ID
|
|
BeforeDigest string // 变更前摘要
|
|
AfterDigest string // 变更后摘要
|
|
ChangeJson string // 已脱敏差异
|
|
Reason string // 操作原因
|
|
ApprovalNo string // 审批单号
|
|
TraceId string // 链路ID
|
|
PrevHash string // 前一条哈希
|
|
RowHash string // 当前行哈希
|
|
CreatedAt string // 创建时间
|
|
}
|
|
|
|
// bizAuditLogColumns holds the columns for the table hg_biz_audit_log.
|
|
var bizAuditLogColumns = BizAuditLogColumns{
|
|
Id: "id",
|
|
TenantId: "tenant_id",
|
|
AuditNo: "audit_no",
|
|
ActorType: "actor_type",
|
|
ActorId: "actor_id",
|
|
Module: "module",
|
|
Action: "action",
|
|
TargetType: "target_type",
|
|
TargetId: "target_id",
|
|
BeforeDigest: "before_digest",
|
|
AfterDigest: "after_digest",
|
|
ChangeJson: "change_json",
|
|
Reason: "reason",
|
|
ApprovalNo: "approval_no",
|
|
TraceId: "trace_id",
|
|
PrevHash: "prev_hash",
|
|
RowHash: "row_hash",
|
|
CreatedAt: "created_at",
|
|
}
|
|
|
|
// NewBizAuditLogDao creates and returns a new DAO object for table data access.
|
|
func NewBizAuditLogDao(handlers ...gdb.ModelHandler) *BizAuditLogDao {
|
|
return &BizAuditLogDao{
|
|
group: "default",
|
|
table: "hg_biz_audit_log",
|
|
columns: bizAuditLogColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *BizAuditLogDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *BizAuditLogDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *BizAuditLogDao) Columns() BizAuditLogColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *BizAuditLogDao) 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 *BizAuditLogDao) 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 *BizAuditLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|