Files
bj_power/bj_power_mes/schema/alert.go
T
SunYF 5c3b747a20 feat: 新增预警与附件模块,优化工位派工功能
1. 新增预警规则、预警消息、业务附件数据库表与CRUD逻辑
2. 为拧紧记录添加审核人、审核时间字段及审核留痕功能
3. 优化产线点位类型与编号描述,更新工位组合下发菜单名称为工艺路线派工
4. 新增上传文件获取原文件名与大小的工具方法
5. 在系统管理菜单新增预警中心与附件中心入口
2026-09-14 16:31:08 +08:00

44 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// Alert 预警消息:规则命中或手动触发后写入,供前端预警中心收件箱展示
type Alert struct {
ent.Schema
}
func (Alert) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Annotation{Table: "alert"}}
}
func (Alert) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive(),
field.Int("ruleId").Default(0).Comment("关联规则ID0=手动触发"),
field.String("type").MaxLen(40).Comment("预警类型"),
field.String("title").MaxLen(120).Comment("标题"),
field.String("content").Default("").MaxLen(500).Comment("内容"),
field.String("refType").Default("").MaxLen(40).Comment("关联业务类型"),
field.String("refId").Default("").MaxLen(64).Comment("关联业务ID"),
field.String("status").Default("UNREAD").MaxLen(10).Comment("UNREAD/READ"),
field.String("receiver").Default("").MaxLen(255).Comment("接收人"),
field.Time("createdAt").Default(time.Now).Immutable(),
}
}
func (Alert) Indexes() []ent.Index {
return []ent.Index{
index.Fields("status"),
index.Fields("type"),
index.Fields("createdAt"),
}
}