fix: rebuild MES as compilable go-zero+ent backend (renamed bj_power_mes), restore 3 workstation projects from pristine original, align naming; all Go projects go build clean
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// OkumaData OKUMA 机床采集数据
|
||||
type OkumaData struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (OkumaData) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{Table: "okuma_data"},
|
||||
}
|
||||
}
|
||||
|
||||
func (OkumaData) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("id").Positive(),
|
||||
field.String("machine").MaxLen(30).Comment("机床名称"),
|
||||
field.String("host").MaxLen(50).Comment("机床IP"),
|
||||
field.String("ncType").Default("mc").MaxLen(10).Comment("机床类型(mc/lathe)"),
|
||||
field.Int("ssIndex").Default(0).Comment("子系统索引"),
|
||||
field.JSON("results", []map[string]string{}).SchemaType(map[string]string{
|
||||
dialect.Postgres: "jsonb",
|
||||
}).Comment("采集结果列表"),
|
||||
field.JSON("parsed", map[string]string{}).Optional().SchemaType(map[string]string{
|
||||
dialect.Postgres: "jsonb",
|
||||
}).Comment("解析结果"),
|
||||
field.Time("createdAt").Default(time.Now).Immutable().Comment("采集时间"),
|
||||
}
|
||||
}
|
||||
|
||||
func (OkumaData) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("machine"),
|
||||
index.Fields("createdAt"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user