70 lines
3.9 KiB
Go
70 lines
3.9 KiB
Go
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
|
||
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
|
||
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
|
||
|
||
package models
|
||
|
||
import (
|
||
"context"
|
||
"time"
|
||
|
||
"quyun/v2/pkg/consts"
|
||
|
||
"go.ipao.vip/gen"
|
||
)
|
||
|
||
const TableNamePayoutAccount = "payout_accounts"
|
||
|
||
// PayoutAccount mapped from table <payout_accounts>
|
||
type PayoutAccount struct {
|
||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
|
||
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null" json:"tenant_id"`
|
||
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
|
||
Type consts.PayoutAccountType `gorm:"column:type;type:character varying(32);not null" json:"type"`
|
||
Name string `gorm:"column:name;type:character varying(128);not null" json:"name"`
|
||
Account string `gorm:"column:account;type:character varying(128);not null" json:"account"`
|
||
Realname string `gorm:"column:realname;type:character varying(128);not null" json:"realname"`
|
||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
|
||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;default:now()" json:"updated_at"`
|
||
Status consts.PayoutAccountStatus `gorm:"column:status;type:character varying(32);not null;default:pending;comment:结算账户审核状态;用途:控制提现账户可用性;默认 pending。" json:"status"` // 结算账户审核状态;用途:控制提现账户可用性;默认 pending。
|
||
ReviewedBy int64 `gorm:"column:reviewed_by;type:bigint;not null;comment:结算账户审核操作者ID;用途:审计追踪;默认 0 表示未审核。" json:"reviewed_by"` // 结算账户审核操作者ID;用途:审计追踪;默认 0 表示未审核。
|
||
ReviewedAt time.Time `gorm:"column:reviewed_at;type:timestamp with time zone;comment:结算账户审核时间;用途:记录审核完成时间;未审核为空。" json:"reviewed_at"` // 结算账户审核时间;用途:记录审核完成时间;未审核为空。
|
||
ReviewReason string `gorm:"column:review_reason;type:character varying(255);not null;comment:结算账户审核说明;用途:驳回原因或备注;默认空字符串。" json:"review_reason"` // 结算账户审核说明;用途:驳回原因或备注;默认空字符串。
|
||
}
|
||
|
||
// Quick operations without importing query package
|
||
// Update applies changed fields to the database using the default DB.
|
||
func (m *PayoutAccount) Update(ctx context.Context) (gen.ResultInfo, error) {
|
||
return Q.PayoutAccount.WithContext(ctx).Updates(m)
|
||
}
|
||
|
||
// Save upserts the model using the default DB.
|
||
func (m *PayoutAccount) Save(ctx context.Context) error {
|
||
return Q.PayoutAccount.WithContext(ctx).Save(m)
|
||
}
|
||
|
||
// Create inserts the model using the default DB.
|
||
func (m *PayoutAccount) Create(ctx context.Context) error {
|
||
return Q.PayoutAccount.WithContext(ctx).Create(m)
|
||
}
|
||
|
||
// Delete removes the row represented by the model using the default DB.
|
||
func (m *PayoutAccount) Delete(ctx context.Context) (gen.ResultInfo, error) {
|
||
return Q.PayoutAccount.WithContext(ctx).Delete(m)
|
||
}
|
||
|
||
// ForceDelete permanently deletes the row (ignores soft delete) using the default DB.
|
||
func (m *PayoutAccount) ForceDelete(ctx context.Context) (gen.ResultInfo, error) {
|
||
return Q.PayoutAccount.WithContext(ctx).Unscoped().Delete(m)
|
||
}
|
||
|
||
// Reload reloads the model from database by its primary key and overwrites current fields.
|
||
func (m *PayoutAccount) Reload(ctx context.Context) error {
|
||
fresh, err := Q.PayoutAccount.WithContext(ctx).GetByID(m.ID)
|
||
if err != nil {
|
||
return err
|
||
}
|
||
*m = *fresh
|
||
return nil
|
||
}
|