132 lines
4.6 KiB
Go
132 lines
4.6 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"
|
|
)
|
|
|
|
// AppMemberDao is the data access object for the table hg_app_member.
|
|
type AppMemberDao 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 AppMemberColumns // columns contains all the column names of Table for convenient usage.
|
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
|
}
|
|
|
|
// AppMemberColumns defines and stores column names for the table hg_app_member.
|
|
type AppMemberColumns struct {
|
|
Id string // 主键
|
|
TenantId string // 租户ID
|
|
MemberNo string // 会员编号
|
|
Username string // 用户名
|
|
Mobile string //
|
|
PasswordHash string // 登录密码哈希(bcrypt)
|
|
TradePasswordHash string // 交易密码哈希
|
|
LevelId string // 会员等级ID
|
|
ParentId string // 上级会员ID
|
|
Level string // 团队层级
|
|
Tree string // 关系树
|
|
InviteCode string // 邀请码
|
|
MemberStatus string // 会员状态
|
|
RiskStatus string // 风控状态
|
|
AutoDispatch string // 自动派单
|
|
CreditScore string // 信用分
|
|
IsTestAccount string // 测试账号
|
|
LastLoginAt string // 最后登录时间
|
|
LastLoginIpCipher string // 最后登录IP密文
|
|
LastLoginIpMask string // 最后登录IP脱敏值
|
|
LastLoginRegion string // 最后登录地区
|
|
CreatedBy string // 创建者
|
|
UpdatedBy string // 更新者
|
|
DeletedBy string // 删除者
|
|
CreatedAt string // 创建时间
|
|
UpdatedAt string // 更新时间
|
|
DeletedAt string // 注销时间
|
|
}
|
|
|
|
// appMemberColumns holds the columns for the table hg_app_member.
|
|
var appMemberColumns = AppMemberColumns{
|
|
Id: "id",
|
|
TenantId: "tenant_id",
|
|
MemberNo: "member_no",
|
|
Username: "username",
|
|
Mobile: "mobile",
|
|
PasswordHash: "password_hash",
|
|
TradePasswordHash: "trade_password_hash",
|
|
LevelId: "level_id",
|
|
ParentId: "parent_id",
|
|
Level: "level",
|
|
Tree: "tree",
|
|
InviteCode: "invite_code",
|
|
MemberStatus: "member_status",
|
|
RiskStatus: "risk_status",
|
|
AutoDispatch: "auto_dispatch",
|
|
CreditScore: "credit_score",
|
|
IsTestAccount: "is_test_account",
|
|
LastLoginAt: "last_login_at",
|
|
LastLoginIpCipher: "last_login_ip_cipher",
|
|
LastLoginIpMask: "last_login_ip_mask",
|
|
LastLoginRegion: "last_login_region",
|
|
CreatedBy: "created_by",
|
|
UpdatedBy: "updated_by",
|
|
DeletedBy: "deleted_by",
|
|
CreatedAt: "created_at",
|
|
UpdatedAt: "updated_at",
|
|
DeletedAt: "deleted_at",
|
|
}
|
|
|
|
// NewAppMemberDao creates and returns a new DAO object for table data access.
|
|
func NewAppMemberDao(handlers ...gdb.ModelHandler) *AppMemberDao {
|
|
return &AppMemberDao{
|
|
group: "default",
|
|
table: "hg_app_member",
|
|
columns: appMemberColumns,
|
|
handlers: handlers,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
|
func (dao *AppMemberDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of the current DAO.
|
|
func (dao *AppMemberDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns all column names of the current DAO.
|
|
func (dao *AppMemberDao) Columns() AppMemberColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the database configuration group name of the current DAO.
|
|
func (dao *AppMemberDao) 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 *AppMemberDao) 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 *AppMemberDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|