1. 新增预警规则、预警消息、业务附件数据库表与CRUD逻辑 2. 为拧紧记录添加审核人、审核时间字段及审核留痕功能 3. 优化产线点位类型与编号描述,更新工位组合下发菜单名称为工艺路线派工 4. 新增上传文件获取原文件名与大小的工具方法 5. 在系统管理菜单新增预警中心与附件中心入口
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
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"
|
|
)
|
|
|
|
// Attachment 业务附件:图纸 / 照片 / 文档等,按 bizType+bizId 关联业务单据
|
|
type Attachment struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (Attachment) Annotations() []schema.Annotation {
|
|
return []schema.Annotation{entsql.Annotation{Table: "attachment"}}
|
|
}
|
|
|
|
func (Attachment) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Int("id").Positive(),
|
|
field.String("bizType").MaxLen(40).Comment("业务类型 work_order/material/process_flow/inspection"),
|
|
field.String("bizId").MaxLen(64).Comment("业务ID"),
|
|
field.String("fileName").MaxLen(255).Comment("原始文件名"),
|
|
field.String("filePath").MaxLen(255).Comment("上传目录相对路径"),
|
|
field.Int("fileSize").Default(0).Comment("字节数"),
|
|
field.String("uploader").Default("").MaxLen(64).Comment("上传人"),
|
|
field.Time("createdAt").Default(time.Now).Immutable(),
|
|
}
|
|
}
|
|
|
|
func (Attachment) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("bizType", "bizId"),
|
|
index.Fields("createdAt"),
|
|
}
|
|
}
|