Files
bj_power/bj_power_mes/schema/alert.go
T
SunYF 1f7a42fc38 refactor(mes): 移除工位接驳台绑定逻辑,改为独立dock主数据
- 移除station表的hasDock、dockCode字段及相关代码
- 新增dock表注释及关联逻辑,支持一个工位绑定多个接驳台
- 更新工位相关的seed、logic、schema及前端代码,适配新的接驳台管理方式
- 新增SQL注释固化脚本,完善MES表注释
2026-10-08 13:09:53 +08:00

46 lines
1.6 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"}, entsql.WithComments(true), schema.Comment("Alert 预警消息:规则命中或手动触发后写入,供前端预警中心收件箱展示")}
}
func (Alert) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive(),
field.Int("ruleId").Default(0).Comment("关联规则ID,0=手动触发"),
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"),
// 关联工单号(客户第12条「记录查看加一项看工单号查询」):预警中心按工单号检索用,可空。
field.String("orderNo").Default("").MaxLen(64).Comment("关联工单号(按工单号查询用)"),
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"),
}
}