53 lines
1.5 KiB
Go
53 lines
1.5 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"
|
|
)
|
|
|
|
// InspectionImage 检测图片——内窥镜设备推送的检测照片,绑定工件
|
|
type InspectionImage struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (InspectionImage) Annotations() []schema.Annotation {
|
|
return []schema.Annotation{
|
|
entsql.Annotation{Table: "inspection_image"},
|
|
}
|
|
}
|
|
|
|
func (InspectionImage) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Int("id").Positive(),
|
|
field.Int("jobId").Comment("关联工件ID"),
|
|
field.String("workpieceNo").Default("").Comment("工件编号"),
|
|
field.Int("workOrderId").Comment("关联工单ID"),
|
|
field.String("workOrderNo").Default("").Comment("工单号"),
|
|
field.String("palletCode").Default("").Comment("托盘码"),
|
|
field.String("deviceId").Optional().Comment("拍摄设备ID"),
|
|
field.String("fileName").Default("").Comment("原始文件名"),
|
|
field.String("filePath").Comment("磁盘相对路径"),
|
|
field.Int64("fileSize").Default(0).Comment("文件大小(字节)"),
|
|
field.Time("capturedAt").Default(time.Now).Optional().Nillable().Comment("拍照时间"),
|
|
field.Time("createdAt").Default(time.Now).Immutable().Comment("记录创建时间"),
|
|
}
|
|
}
|
|
|
|
func (InspectionImage) Edges() []ent.Edge {
|
|
return nil
|
|
}
|
|
|
|
func (InspectionImage) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("jobId"),
|
|
index.Fields("workOrderId"),
|
|
index.Fields("palletCode"),
|
|
index.Fields("capturedAt"),
|
|
}
|
|
}
|