Files
bj_power/bj_power_mes/schema/torque_audit_log.go
T

42 lines
1.2 KiB
Go
Raw Normal View History

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"
)
// TorqueAuditLog 拧紧记录修改留痕(审核签字 / 补录 / 修正,谁在何时改了什么)
type TorqueAuditLog struct {
ent.Schema
}
func (TorqueAuditLog) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Annotation{Table: "torque_audit_log"}}
}
func (TorqueAuditLog) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive(),
field.Int("torqueRecordId").Comment("拧紧记录ID"),
field.String("action").MaxLen(20).Comment("审核/补录/修正"),
field.String("fieldName").Default("").MaxLen(40).Comment("字段名"),
field.String("oldVal").Default("").MaxLen(255).Comment("改前"),
field.String("newVal").Default("").MaxLen(255).Comment("改后"),
field.String("operator").MaxLen(64).Comment("操作人"),
field.String("remark").Default("").MaxLen(255).Comment("备注/原因"),
field.Time("createdAt").Default(time.Now).Immutable(),
}
}
func (TorqueAuditLog) Indexes() []ent.Index {
return []ent.Index{
index.Fields("torqueRecordId"),
index.Fields("createdAt"),
}
}