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", Options: "COMMENT='检测图片表,存储内窥镜等检测设备推送的工件检测照片,绑定工件、工单'", }, entsql.WithComments(true), } } func (InspectionImage) Fields() []ent.Field { return []ent.Field{ field.Int("id").Positive().Comment("主键ID"), field.Int("jobId").Comment("关联工件ID"), field.Int("workOrderId").Comment("关联工单ID"), field.String("workOrderNo").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("capturedAt"), } }