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:
@@ -10,41 +10,40 @@ import (
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// Permission 权限资源,定义系统中可受控的功能点和菜单项
|
||||
// Permission holds the schema definition for the Permission entity.
|
||||
type Permission struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (Permission) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{
|
||||
Table: "permission",
|
||||
Options: "COMMENT='权限资源表,定义系统可受控的功能点和菜单项,支持树形层级结构和RBAC授权'",
|
||||
},
|
||||
entsql.Annotation{Table: "permission"},
|
||||
entsql.WithComments(true),
|
||||
}
|
||||
}
|
||||
|
||||
// Fields of the Permission.
|
||||
func (Permission) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("id").Positive().Comment("主键ID"),
|
||||
field.String("name").MaxLen(20).NotEmpty().Comment("权限名称,如 用户管理、工单查询"),
|
||||
field.String("code").MaxLen(40).NotEmpty().Comment("权限代码,唯一标识,如 user:read"),
|
||||
field.Int("parentId").Optional().Nillable().Comment("父权限ID,用于构建权限树形层级结构"),
|
||||
field.String("sort").Default("0").Comment("排序号,控制同级权限的展示顺序"),
|
||||
field.Bool("isMenu").Default(false).Comment("是否菜单项,true=可在导航菜单中展示"),
|
||||
field.String("description").MaxLen(60).Optional().Comment("权限描述,说明该权限的控制范围"),
|
||||
field.Time("createdAt").Default(time.Now).Immutable().Comment("创建时间"),
|
||||
field.Int("id").Positive(),
|
||||
field.String("name").MaxLen(20).NotEmpty().Comment("权限名称"),
|
||||
field.String("code").MaxLen(40).NotEmpty().Comment("权限代码"),
|
||||
field.Int("parentId").Optional().Nillable().Comment("父权限ID"),
|
||||
field.String("sort").Default("0").Comment("排序号"),
|
||||
field.Bool("isMenu").Default(false).Comment("是否菜单"),
|
||||
field.String("description").MaxLen(60).Optional().Comment("权限描述"),
|
||||
field.Time("createdAt").Default(time.Now).Immutable().Comment("创建时间"), // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Permission.
|
||||
func (Permission) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("roles", Role.Type).Ref("permissions").Comment("拥有该权限的角色列表"),
|
||||
edge.To("apis", Api.Type).Comment("关联的API接口"),
|
||||
edge.From("roles", Role.Type).Ref("permissions"),
|
||||
edge.To("apis", Api.Type),
|
||||
edge.To("children", Permission.Type).
|
||||
From("parent").
|
||||
Field("parentId").
|
||||
Unique().Comment("子权限列表"),
|
||||
Unique(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user