Files
epic-go/internal/dao/internal/system_notify_message.go
hu xiaotong 85e3a6540b init
2025-06-20 17:17:02 +08:00

112 lines
4.1 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"
)
// SystemNotifyMessageDao is the data access object for the table system_notify_message.
type SystemNotifyMessageDao 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 SystemNotifyMessageColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SystemNotifyMessageColumns defines and stores column names for the table system_notify_message.
type SystemNotifyMessageColumns struct {
Id string // 用户ID
UserId string // 用户id
UserType string // 用户类型
TemplateId string // 模版编号
TemplateCode string // 模板编码
TemplateNickname string // 模版发送人名称
TemplateContent string // 模版内容
TemplateType string // 模版类型
TemplateParams string // 模版参数
ReadStatus string // 是否已读
ReadTime string // 阅读时间
Creator string // 创建者
CreateTime string // 创建时间
Updater string // 更新者
UpdateTime string // 更新时间
Deleted string // 是否删除
TenantId string // 租户编号
}
// systemNotifyMessageColumns holds the columns for the table system_notify_message.
var systemNotifyMessageColumns = SystemNotifyMessageColumns{
Id: "id",
UserId: "user_id",
UserType: "user_type",
TemplateId: "template_id",
TemplateCode: "template_code",
TemplateNickname: "template_nickname",
TemplateContent: "template_content",
TemplateType: "template_type",
TemplateParams: "template_params",
ReadStatus: "read_status",
ReadTime: "read_time",
Creator: "creator",
CreateTime: "create_time",
Updater: "updater",
UpdateTime: "update_time",
Deleted: "deleted",
TenantId: "tenant_id",
}
// NewSystemNotifyMessageDao creates and returns a new DAO object for table data access.
func NewSystemNotifyMessageDao(handlers ...gdb.ModelHandler) *SystemNotifyMessageDao {
return &SystemNotifyMessageDao{
group: "default",
table: "system_notify_message",
columns: systemNotifyMessageColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *SystemNotifyMessageDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *SystemNotifyMessageDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *SystemNotifyMessageDao) Columns() SystemNotifyMessageColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *SystemNotifyMessageDao) 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 *SystemNotifyMessageDao) 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 *SystemNotifyMessageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}