feat: 新增预警与附件模块,优化工位派工功能

1. 新增预警规则、预警消息、业务附件数据库表与CRUD逻辑
2. 为拧紧记录添加审核人、审核时间字段及审核留痕功能
3. 优化产线点位类型与编号描述,更新工位组合下发菜单名称为工艺路线派工
4. 新增上传文件获取原文件名与大小的工具方法
5. 在系统管理菜单新增预警中心与附件中心入口
This commit is contained in:
SunYF
2026-09-14 16:31:08 +08:00
parent 0ab21b1234
commit 5c3b747a20
399 changed files with 147674 additions and 2213 deletions
+120
View File
@@ -0,0 +1,120 @@
// Code generated by ent, DO NOT EDIT.
package alertrule
import (
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the alertrule type in the database.
Label = "alert_rule"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldType holds the string denoting the type field in the database.
FieldType = "type"
// FieldThreshold holds the string denoting the threshold field in the database.
FieldThreshold = "threshold"
// FieldReceiver holds the string denoting the receiver field in the database.
FieldReceiver = "receiver"
// FieldEnabled holds the string denoting the enabled field in the database.
FieldEnabled = "enabled"
// FieldCreatedBy holds the string denoting the createdby field in the database.
FieldCreatedBy = "created_by"
// FieldCreatedAt holds the string denoting the createdat field in the database.
FieldCreatedAt = "created_at"
// Table holds the table name of the alertrule in the database.
Table = "alert_rule"
)
// Columns holds all SQL columns for alertrule fields.
var Columns = []string{
FieldID,
FieldName,
FieldType,
FieldThreshold,
FieldReceiver,
FieldEnabled,
FieldCreatedBy,
FieldCreatedAt,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
// TypeValidator is a validator for the "type" field. It is called by the builders before save.
TypeValidator func(string) error
// DefaultThreshold holds the default value on creation for the "threshold" field.
DefaultThreshold float64
// DefaultReceiver holds the default value on creation for the "receiver" field.
DefaultReceiver string
// ReceiverValidator is a validator for the "receiver" field. It is called by the builders before save.
ReceiverValidator func(string) error
// DefaultEnabled holds the default value on creation for the "enabled" field.
DefaultEnabled bool
// DefaultCreatedBy holds the default value on creation for the "createdBy" field.
DefaultCreatedBy string
// CreatedByValidator is a validator for the "createdBy" field. It is called by the builders before save.
CreatedByValidator func(string) error
// DefaultCreatedAt holds the default value on creation for the "createdAt" field.
DefaultCreatedAt func() time.Time
// IDValidator is a validator for the "id" field. It is called by the builders before save.
IDValidator func(int) error
)
// OrderOption defines the ordering options for the AlertRule queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldType, opts...).ToFunc()
}
// ByThreshold orders the results by the threshold field.
func ByThreshold(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldThreshold, opts...).ToFunc()
}
// ByReceiver orders the results by the receiver field.
func ByReceiver(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldReceiver, opts...).ToFunc()
}
// ByEnabled orders the results by the enabled field.
func ByEnabled(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEnabled, opts...).ToFunc()
}
// ByCreatedBy orders the results by the createdBy field.
func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
}
// ByCreatedAt orders the results by the createdAt field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
+455
View File
@@ -0,0 +1,455 @@
// Code generated by ent, DO NOT EDIT.
package alertrule
import (
"bj_power_mes/ent/predicate"
"time"
"entgo.io/ent/dialect/sql"
)
// ID filters vertices based on their ID field.
func ID(id int) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int) predicate.AlertRule {
return predicate.AlertRule(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLTE(FieldID, id))
}
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
func Name(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldName, v))
}
// Type applies equality check predicate on the "type" field. It's identical to TypeEQ.
func Type(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldType, v))
}
// Threshold applies equality check predicate on the "threshold" field. It's identical to ThresholdEQ.
func Threshold(v float64) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldThreshold, v))
}
// Receiver applies equality check predicate on the "receiver" field. It's identical to ReceiverEQ.
func Receiver(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldReceiver, v))
}
// Enabled applies equality check predicate on the "enabled" field. It's identical to EnabledEQ.
func Enabled(v bool) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldEnabled, v))
}
// CreatedBy applies equality check predicate on the "createdBy" field. It's identical to CreatedByEQ.
func CreatedBy(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldCreatedBy, v))
}
// CreatedAt applies equality check predicate on the "createdAt" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldCreatedAt, v))
}
// NameEQ applies the EQ predicate on the "name" field.
func NameEQ(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldName, v))
}
// NameNEQ applies the NEQ predicate on the "name" field.
func NameNEQ(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNEQ(FieldName, v))
}
// NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldIn(FieldName, vs...))
}
// NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNotIn(FieldName, vs...))
}
// NameGT applies the GT predicate on the "name" field.
func NameGT(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGT(FieldName, v))
}
// NameGTE applies the GTE predicate on the "name" field.
func NameGTE(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGTE(FieldName, v))
}
// NameLT applies the LT predicate on the "name" field.
func NameLT(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLT(FieldName, v))
}
// NameLTE applies the LTE predicate on the "name" field.
func NameLTE(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLTE(FieldName, v))
}
// NameContains applies the Contains predicate on the "name" field.
func NameContains(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldContains(FieldName, v))
}
// NameHasPrefix applies the HasPrefix predicate on the "name" field.
func NameHasPrefix(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldHasPrefix(FieldName, v))
}
// NameHasSuffix applies the HasSuffix predicate on the "name" field.
func NameHasSuffix(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldHasSuffix(FieldName, v))
}
// NameEqualFold applies the EqualFold predicate on the "name" field.
func NameEqualFold(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEqualFold(FieldName, v))
}
// NameContainsFold applies the ContainsFold predicate on the "name" field.
func NameContainsFold(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldContainsFold(FieldName, v))
}
// TypeEQ applies the EQ predicate on the "type" field.
func TypeEQ(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldType, v))
}
// TypeNEQ applies the NEQ predicate on the "type" field.
func TypeNEQ(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNEQ(FieldType, v))
}
// TypeIn applies the In predicate on the "type" field.
func TypeIn(vs ...string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldIn(FieldType, vs...))
}
// TypeNotIn applies the NotIn predicate on the "type" field.
func TypeNotIn(vs ...string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNotIn(FieldType, vs...))
}
// TypeGT applies the GT predicate on the "type" field.
func TypeGT(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGT(FieldType, v))
}
// TypeGTE applies the GTE predicate on the "type" field.
func TypeGTE(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGTE(FieldType, v))
}
// TypeLT applies the LT predicate on the "type" field.
func TypeLT(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLT(FieldType, v))
}
// TypeLTE applies the LTE predicate on the "type" field.
func TypeLTE(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLTE(FieldType, v))
}
// TypeContains applies the Contains predicate on the "type" field.
func TypeContains(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldContains(FieldType, v))
}
// TypeHasPrefix applies the HasPrefix predicate on the "type" field.
func TypeHasPrefix(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldHasPrefix(FieldType, v))
}
// TypeHasSuffix applies the HasSuffix predicate on the "type" field.
func TypeHasSuffix(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldHasSuffix(FieldType, v))
}
// TypeEqualFold applies the EqualFold predicate on the "type" field.
func TypeEqualFold(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEqualFold(FieldType, v))
}
// TypeContainsFold applies the ContainsFold predicate on the "type" field.
func TypeContainsFold(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldContainsFold(FieldType, v))
}
// ThresholdEQ applies the EQ predicate on the "threshold" field.
func ThresholdEQ(v float64) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldThreshold, v))
}
// ThresholdNEQ applies the NEQ predicate on the "threshold" field.
func ThresholdNEQ(v float64) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNEQ(FieldThreshold, v))
}
// ThresholdIn applies the In predicate on the "threshold" field.
func ThresholdIn(vs ...float64) predicate.AlertRule {
return predicate.AlertRule(sql.FieldIn(FieldThreshold, vs...))
}
// ThresholdNotIn applies the NotIn predicate on the "threshold" field.
func ThresholdNotIn(vs ...float64) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNotIn(FieldThreshold, vs...))
}
// ThresholdGT applies the GT predicate on the "threshold" field.
func ThresholdGT(v float64) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGT(FieldThreshold, v))
}
// ThresholdGTE applies the GTE predicate on the "threshold" field.
func ThresholdGTE(v float64) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGTE(FieldThreshold, v))
}
// ThresholdLT applies the LT predicate on the "threshold" field.
func ThresholdLT(v float64) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLT(FieldThreshold, v))
}
// ThresholdLTE applies the LTE predicate on the "threshold" field.
func ThresholdLTE(v float64) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLTE(FieldThreshold, v))
}
// ReceiverEQ applies the EQ predicate on the "receiver" field.
func ReceiverEQ(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldReceiver, v))
}
// ReceiverNEQ applies the NEQ predicate on the "receiver" field.
func ReceiverNEQ(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNEQ(FieldReceiver, v))
}
// ReceiverIn applies the In predicate on the "receiver" field.
func ReceiverIn(vs ...string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldIn(FieldReceiver, vs...))
}
// ReceiverNotIn applies the NotIn predicate on the "receiver" field.
func ReceiverNotIn(vs ...string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNotIn(FieldReceiver, vs...))
}
// ReceiverGT applies the GT predicate on the "receiver" field.
func ReceiverGT(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGT(FieldReceiver, v))
}
// ReceiverGTE applies the GTE predicate on the "receiver" field.
func ReceiverGTE(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGTE(FieldReceiver, v))
}
// ReceiverLT applies the LT predicate on the "receiver" field.
func ReceiverLT(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLT(FieldReceiver, v))
}
// ReceiverLTE applies the LTE predicate on the "receiver" field.
func ReceiverLTE(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLTE(FieldReceiver, v))
}
// ReceiverContains applies the Contains predicate on the "receiver" field.
func ReceiverContains(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldContains(FieldReceiver, v))
}
// ReceiverHasPrefix applies the HasPrefix predicate on the "receiver" field.
func ReceiverHasPrefix(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldHasPrefix(FieldReceiver, v))
}
// ReceiverHasSuffix applies the HasSuffix predicate on the "receiver" field.
func ReceiverHasSuffix(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldHasSuffix(FieldReceiver, v))
}
// ReceiverEqualFold applies the EqualFold predicate on the "receiver" field.
func ReceiverEqualFold(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEqualFold(FieldReceiver, v))
}
// ReceiverContainsFold applies the ContainsFold predicate on the "receiver" field.
func ReceiverContainsFold(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldContainsFold(FieldReceiver, v))
}
// EnabledEQ applies the EQ predicate on the "enabled" field.
func EnabledEQ(v bool) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldEnabled, v))
}
// EnabledNEQ applies the NEQ predicate on the "enabled" field.
func EnabledNEQ(v bool) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNEQ(FieldEnabled, v))
}
// CreatedByEQ applies the EQ predicate on the "createdBy" field.
func CreatedByEQ(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldCreatedBy, v))
}
// CreatedByNEQ applies the NEQ predicate on the "createdBy" field.
func CreatedByNEQ(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNEQ(FieldCreatedBy, v))
}
// CreatedByIn applies the In predicate on the "createdBy" field.
func CreatedByIn(vs ...string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldIn(FieldCreatedBy, vs...))
}
// CreatedByNotIn applies the NotIn predicate on the "createdBy" field.
func CreatedByNotIn(vs ...string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNotIn(FieldCreatedBy, vs...))
}
// CreatedByGT applies the GT predicate on the "createdBy" field.
func CreatedByGT(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGT(FieldCreatedBy, v))
}
// CreatedByGTE applies the GTE predicate on the "createdBy" field.
func CreatedByGTE(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGTE(FieldCreatedBy, v))
}
// CreatedByLT applies the LT predicate on the "createdBy" field.
func CreatedByLT(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLT(FieldCreatedBy, v))
}
// CreatedByLTE applies the LTE predicate on the "createdBy" field.
func CreatedByLTE(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLTE(FieldCreatedBy, v))
}
// CreatedByContains applies the Contains predicate on the "createdBy" field.
func CreatedByContains(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldContains(FieldCreatedBy, v))
}
// CreatedByHasPrefix applies the HasPrefix predicate on the "createdBy" field.
func CreatedByHasPrefix(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldHasPrefix(FieldCreatedBy, v))
}
// CreatedByHasSuffix applies the HasSuffix predicate on the "createdBy" field.
func CreatedByHasSuffix(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldHasSuffix(FieldCreatedBy, v))
}
// CreatedByEqualFold applies the EqualFold predicate on the "createdBy" field.
func CreatedByEqualFold(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEqualFold(FieldCreatedBy, v))
}
// CreatedByContainsFold applies the ContainsFold predicate on the "createdBy" field.
func CreatedByContainsFold(v string) predicate.AlertRule {
return predicate.AlertRule(sql.FieldContainsFold(FieldCreatedBy, v))
}
// CreatedAtEQ applies the EQ predicate on the "createdAt" field.
func CreatedAtEQ(v time.Time) predicate.AlertRule {
return predicate.AlertRule(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "createdAt" field.
func CreatedAtNEQ(v time.Time) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "createdAt" field.
func CreatedAtIn(vs ...time.Time) predicate.AlertRule {
return predicate.AlertRule(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "createdAt" field.
func CreatedAtNotIn(vs ...time.Time) predicate.AlertRule {
return predicate.AlertRule(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "createdAt" field.
func CreatedAtGT(v time.Time) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "createdAt" field.
func CreatedAtGTE(v time.Time) predicate.AlertRule {
return predicate.AlertRule(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "createdAt" field.
func CreatedAtLT(v time.Time) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "createdAt" field.
func CreatedAtLTE(v time.Time) predicate.AlertRule {
return predicate.AlertRule(sql.FieldLTE(FieldCreatedAt, v))
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.AlertRule) predicate.AlertRule {
return predicate.AlertRule(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.AlertRule) predicate.AlertRule {
return predicate.AlertRule(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.AlertRule) predicate.AlertRule {
return predicate.AlertRule(sql.NotPredicates(p))
}