Files
iotlcm/app/server/internal/dao/internal/t_warn_log.go
T

126 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"
)
// TWarnLogDao is the data access object for the table t_warn_log.
type TWarnLogDao 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 TWarnLogColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// TWarnLogColumns defines and stores column names for the table t_warn_log.
type TWarnLogColumns struct {
Id string // 主键ID
TenantId string // 租户ID
ConfigId string // 预警配置ID
ItemType string // 对象类型:1单卡,2流量池
ItemId string // 对象ID:单卡为t_sim_card_info.id,流量池为t_sim_flow_pool.id
ItemCode string // 对象编码快照:ICCID/MSISDN/流量池编码
WarnStage string // 触发档位:1第一档,2第二档,3第三档
WarnLevel string // 预警级别:1提示,2注意,3警告,4危险,5紧急
WarnUnit string // 预警单位/维度:1MB,2百分比,3天数,4月数
ThresholdValue string // 触发阈值,单位由warn_unit决定
ActualValue string // 触发时实际值,单位由warn_unit决定
TotalFlowMb string // 触发时总流量MB;流量类预警使用
RemainFlowMb string // 触发时剩余流量MB;流量类预警使用
WarnMethods string // 实际预警方式快照
WarnPhones string // 实际预警手机号快照
WarnEmails string // 实际预警邮箱快照
MessageLogId string // 平台消息ID;聚合通知时可能为空
WarnTime string // 预警时间
Remark string // 备注
CreatedDept string // 创建部门
CreatedBy string // 创建者
CreatedAt string // 创建时间
UpdatedBy string // 更新者
UpdatedAt string // 更新时间
}
// tWarnLogColumns holds the columns for the table t_warn_log.
var tWarnLogColumns = TWarnLogColumns{
Id: "id",
TenantId: "tenant_id",
ConfigId: "config_id",
ItemType: "item_type",
ItemId: "item_id",
ItemCode: "item_code",
WarnStage: "warn_stage",
WarnLevel: "warn_level",
WarnUnit: "warn_unit",
ThresholdValue: "threshold_value",
ActualValue: "actual_value",
TotalFlowMb: "total_flow_mb",
RemainFlowMb: "remain_flow_mb",
WarnMethods: "warn_methods",
WarnPhones: "warn_phones",
WarnEmails: "warn_emails",
MessageLogId: "message_log_id",
WarnTime: "warn_time",
Remark: "remark",
CreatedDept: "created_dept",
CreatedBy: "created_by",
CreatedAt: "created_at",
UpdatedBy: "updated_by",
UpdatedAt: "updated_at",
}
// NewTWarnLogDao creates and returns a new DAO object for table data access.
func NewTWarnLogDao(handlers ...gdb.ModelHandler) *TWarnLogDao {
return &TWarnLogDao{
group: "default",
table: "t_warn_log",
columns: tWarnLogColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *TWarnLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *TWarnLogDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *TWarnLogDao) Columns() TWarnLogColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *TWarnLogDao) 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 *TWarnLogDao) 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 *TWarnLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}