- 移除station表的hasDock、dockCode字段及相关代码 - 新增dock表注释及关联逻辑,支持一个工位绑定多个接驳台 - 更新工位相关的seed、logic、schema及前端代码,适配新的接驳台管理方式 - 新增SQL注释固化脚本,完善MES表注释
39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
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"
|
|
)
|
|
|
|
// Role 角色:承载菜单/按钮权限
|
|
type Role struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (Role) Annotations() []schema.Annotation {
|
|
return []schema.Annotation{entsql.Annotation{Table: "role"}, entsql.WithComments(true), schema.Comment("Role 角色:承载菜单/按钮权限")}
|
|
}
|
|
|
|
func (Role) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Int("id").Positive(),
|
|
field.String("name").MaxLen(64).Comment("角色名称"),
|
|
field.String("code").Unique().MaxLen(64).Comment("角色编码"),
|
|
field.String("remark").Default("").MaxLen(255),
|
|
field.JSON("permissionCodes", []string{}).Optional().SchemaType(map[string]string{
|
|
dialect.Postgres: "jsonb",
|
|
}).Comment("权限编码列表,如 produce.workorder:view"),
|
|
field.Time("createdAt").Default(time.Now).Immutable(),
|
|
}
|
|
}
|
|
|
|
func (Role) Indexes() []ent.Index {
|
|
return []ent.Index{index.Fields("code").Unique()}
|
|
}
|