116 lines
4.4 KiB
Go
116 lines
4.4 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"
|
|
)
|
|
|
|
// WalletAdjustmentRequestDao is the data access object for the table hg_wallet_adjustment_request.
|
|
type WalletAdjustmentRequestDao 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 WalletAdjustmentRequestColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// WalletAdjustmentRequestColumns defines and stores column names for the table hg_wallet_adjustment_request.
|
|
type WalletAdjustmentRequestColumns struct {
|
|
Id string // 主键
|
|
TenantId string // 租户ID
|
|
RequestNo string // 申请单号
|
|
MemberId string // 会员ID
|
|
AccountId string // 钱包账户ID
|
|
AdjustType string // 调整类型
|
|
Direction string // 方向 1收入 2支出
|
|
Amount string // 金额(分)
|
|
ReasonCode string // 原因编码
|
|
ReasonText string // 原因说明
|
|
EvidenceJson string // 凭证附件
|
|
IdempotencyKey string // 幂等键
|
|
RequestStatus string // 状态 1待审批 2已通过 3已拒绝 4已执行
|
|
ApprovalRequestId string // 审批单ID
|
|
LedgerId string // 账变流水ID
|
|
CreatedBy string // 创建者
|
|
UpdatedBy string // 更新者
|
|
CreatedAt string // 创建时间
|
|
UpdatedAt string // 更新时间
|
|
}
|
|
|
|
// walletAdjustmentRequestColumns holds the columns for the table hg_wallet_adjustment_request.
|
|
var walletAdjustmentRequestColumns = WalletAdjustmentRequestColumns{
|
|
Id: "id",
|
|
TenantId: "tenant_id",
|
|
RequestNo: "request_no",
|
|
MemberId: "member_id",
|
|
AccountId: "account_id",
|
|
AdjustType: "adjust_type",
|
|
Direction: "direction",
|
|
Amount: "amount",
|
|
ReasonCode: "reason_code",
|
|
ReasonText: "reason_text",
|
|
EvidenceJson: "evidence_json",
|
|
IdempotencyKey: "idempotency_key",
|
|
RequestStatus: "request_status",
|
|
ApprovalRequestId: "approval_request_id",
|
|
LedgerId: "ledger_id",
|
|
CreatedBy: "created_by",
|
|
UpdatedBy: "updated_by",
|
|
CreatedAt: "created_at",
|
|
UpdatedAt: "updated_at",
|
|
}
|
|
|
|
// NewWalletAdjustmentRequestDao creates and returns a new DAO object for table data access.
|
|
func NewWalletAdjustmentRequestDao(handlers ...gdb.ModelHandler) *WalletAdjustmentRequestDao {
|
|
return &WalletAdjustmentRequestDao{
|
|
group: "default",
|
|
table: "hg_wallet_adjustment_request",
|
|
columns: walletAdjustmentRequestColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *WalletAdjustmentRequestDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *WalletAdjustmentRequestDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *WalletAdjustmentRequestDao) Columns() WalletAdjustmentRequestColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *WalletAdjustmentRequestDao) 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 *WalletAdjustmentRequestDao) 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 *WalletAdjustmentRequestDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|