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

184 lines
6.1 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/torqueauditlog"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// TorqueAuditLog is the model entity for the TorqueAuditLog schema.
type TorqueAuditLog struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// 拧紧记录ID
TorqueRecordId int `json:"torqueRecordId,omitempty"`
// 审核/补录/修正
Action string `json:"action,omitempty"`
// 字段名
FieldName string `json:"fieldName,omitempty"`
// 改前
OldVal string `json:"oldVal,omitempty"`
// 改后
NewVal string `json:"newVal,omitempty"`
// 操作人
Operator string `json:"operator,omitempty"`
// 备注/原因
Remark string `json:"remark,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 (*TorqueAuditLog) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case torqueauditlog.FieldID, torqueauditlog.FieldTorqueRecordId:
values[i] = new(sql.NullInt64)
case torqueauditlog.FieldAction, torqueauditlog.FieldFieldName, torqueauditlog.FieldOldVal, torqueauditlog.FieldNewVal, torqueauditlog.FieldOperator, torqueauditlog.FieldRemark:
values[i] = new(sql.NullString)
case torqueauditlog.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 TorqueAuditLog fields.
func (_m *TorqueAuditLog) 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 torqueauditlog.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 torqueauditlog.FieldTorqueRecordId:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field torqueRecordId", values[i])
} else if value.Valid {
_m.TorqueRecordId = int(value.Int64)
}
case torqueauditlog.FieldAction:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field action", values[i])
} else if value.Valid {
_m.Action = value.String
}
case torqueauditlog.FieldFieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field fieldName", values[i])
} else if value.Valid {
_m.FieldName = value.String
}
case torqueauditlog.FieldOldVal:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field oldVal", values[i])
} else if value.Valid {
_m.OldVal = value.String
}
case torqueauditlog.FieldNewVal:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field newVal", values[i])
} else if value.Valid {
_m.NewVal = value.String
}
case torqueauditlog.FieldOperator:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field operator", values[i])
} else if value.Valid {
_m.Operator = value.String
}
case torqueauditlog.FieldRemark:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field remark", values[i])
} else if value.Valid {
_m.Remark = value.String
}
case torqueauditlog.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 TorqueAuditLog.
// This includes values selected through modifiers, order, etc.
func (_m *TorqueAuditLog) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this TorqueAuditLog.
// Note that you need to call TorqueAuditLog.Unwrap() before calling this method if this TorqueAuditLog
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *TorqueAuditLog) Update() *TorqueAuditLogUpdateOne {
return NewTorqueAuditLogClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the TorqueAuditLog 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 *TorqueAuditLog) Unwrap() *TorqueAuditLog {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: TorqueAuditLog is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *TorqueAuditLog) String() string {
var builder strings.Builder
builder.WriteString("TorqueAuditLog(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("torqueRecordId=")
builder.WriteString(fmt.Sprintf("%v", _m.TorqueRecordId))
builder.WriteString(", ")
builder.WriteString("action=")
builder.WriteString(_m.Action)
builder.WriteString(", ")
builder.WriteString("fieldName=")
builder.WriteString(_m.FieldName)
builder.WriteString(", ")
builder.WriteString("oldVal=")
builder.WriteString(_m.OldVal)
builder.WriteString(", ")
builder.WriteString("newVal=")
builder.WriteString(_m.NewVal)
builder.WriteString(", ")
builder.WriteString("operator=")
builder.WriteString(_m.Operator)
builder.WriteString(", ")
builder.WriteString("remark=")
builder.WriteString(_m.Remark)
builder.WriteString(", ")
builder.WriteString("createdAt=")
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
// TorqueAuditLogs is a parsable slice of TorqueAuditLog.
type TorqueAuditLogs []*TorqueAuditLog