Files
bj_power/bj_power_mes/ent/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

206 lines
6.4 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.
// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/alert"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// Alert 预警消息:规则命中或手动触发后写入,供前端预警中心收件箱展示
type Alert struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// 关联规则ID,0=手动触发
RuleId int `json:"ruleId,omitempty"`
// 预警类型
Type string `json:"type,omitempty"`
// 标题
Title string `json:"title,omitempty"`
// 内容
Content string `json:"content,omitempty"`
// 关联业务类型
RefType string `json:"refType,omitempty"`
// 关联业务ID
RefId string `json:"refId,omitempty"`
// 关联工单号(按工单号查询用)
OrderNo string `json:"orderNo,omitempty"`
// UNREAD/READ
Status string `json:"status,omitempty"`
// 接收人
Receiver string `json:"receiver,omitempty"`
// CreatedAt holds the value of the "createdAt" field.
CreatedAt time.Time `json:"createdAt,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Alert) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case alert.FieldID, alert.FieldRuleId:
values[i] = new(sql.NullInt64)
case alert.FieldType, alert.FieldTitle, alert.FieldContent, alert.FieldRefType, alert.FieldRefId, alert.FieldOrderNo, alert.FieldStatus, alert.FieldReceiver:
values[i] = new(sql.NullString)
case alert.FieldCreatedAt:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Alert fields.
func (_m *Alert) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case alert.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
_m.ID = int(value.Int64)
case alert.FieldRuleId:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field ruleId", values[i])
} else if value.Valid {
_m.RuleId = int(value.Int64)
}
case alert.FieldType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field type", values[i])
} else if value.Valid {
_m.Type = value.String
}
case alert.FieldTitle:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field title", values[i])
} else if value.Valid {
_m.Title = value.String
}
case alert.FieldContent:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field content", values[i])
} else if value.Valid {
_m.Content = value.String
}
case alert.FieldRefType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field refType", values[i])
} else if value.Valid {
_m.RefType = value.String
}
case alert.FieldRefId:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field refId", values[i])
} else if value.Valid {
_m.RefId = value.String
}
case alert.FieldOrderNo:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field orderNo", values[i])
} else if value.Valid {
_m.OrderNo = value.String
}
case alert.FieldStatus:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field status", values[i])
} else if value.Valid {
_m.Status = value.String
}
case alert.FieldReceiver:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field receiver", values[i])
} else if value.Valid {
_m.Receiver = value.String
}
case alert.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field createdAt", values[i])
} else if value.Valid {
_m.CreatedAt = value.Time
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the Alert.
// This includes values selected through modifiers, order, etc.
func (_m *Alert) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this Alert.
// Note that you need to call Alert.Unwrap() before calling this method if this Alert
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *Alert) Update() *AlertUpdateOne {
return NewAlertClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Alert entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (_m *Alert) Unwrap() *Alert {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Alert is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *Alert) String() string {
var builder strings.Builder
builder.WriteString("Alert(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("ruleId=")
builder.WriteString(fmt.Sprintf("%v", _m.RuleId))
builder.WriteString(", ")
builder.WriteString("type=")
builder.WriteString(_m.Type)
builder.WriteString(", ")
builder.WriteString("title=")
builder.WriteString(_m.Title)
builder.WriteString(", ")
builder.WriteString("content=")
builder.WriteString(_m.Content)
builder.WriteString(", ")
builder.WriteString("refType=")
builder.WriteString(_m.RefType)
builder.WriteString(", ")
builder.WriteString("refId=")
builder.WriteString(_m.RefId)
builder.WriteString(", ")
builder.WriteString("orderNo=")
builder.WriteString(_m.OrderNo)
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(_m.Status)
builder.WriteString(", ")
builder.WriteString("receiver=")
builder.WriteString(_m.Receiver)
builder.WriteString(", ")
builder.WriteString("createdAt=")
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
// Alerts is a parsable slice of Alert.
type Alerts []*Alert