Files
bj_power/bj_power_wms/schema/permission.go
T
SunYF 1f7a42fc38 refactor(mes): 移除工位接驳台绑定逻辑,改为独立dock主数据
- 移除station表的hasDock、dockCode字段及相关代码
- 新增dock表注释及关联逻辑,支持一个工位绑定多个接驳台
- 更新工位相关的seed、logic、schema及前端代码,适配新的接驳台管理方式
- 新增SQL注释固化脚本,完善MES表注释
2026-10-08 13:09:53 +08:00

43 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// Permission 权限/菜单
// 模型移植自 MES(schema/permission.go),按 WMS 约定调整字段命名与时间类型。
// type 区分两类:
// - MENU 菜单权限:对应侧栏菜单项,path 为前端路由
// - BUTTON 按钮权限:对应页面内的操作按钮,无 path
type Permission struct {
ent.Schema
}
func (Permission) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Table("permissions"), entsql.WithComments(true), schema.Comment("Permission 权限/菜单")}
}
func (Permission) Fields() []ent.Field {
return []ent.Field{
field.String("code").Unique().MaxLen(64).Comment("权限编码,如 inbound:view"),
field.String("name").MaxLen(64).Comment("名称"),
field.String("type").Default("MENU").MaxLen(20).Comment("类型 MENU菜单/BUTTON按钮"),
field.String("parent_code").Default("").MaxLen(64).Optional().
Comment("所属菜单编码(BUTTON 填其所属 MENU 的 code;全局按钮填空)"),
field.String("path").Default("").MaxLen(128).Optional().Comment("前端路由(菜单类)"),
field.String("icon").Default("").MaxLen(64).Optional().Comment("图标(菜单类)"),
field.Int("sort").Default(0).Optional().Comment("排序"),
field.String("remark").Default("").MaxLen(255).Optional().Comment("备注"),
field.Int64("created_at").DefaultFunc(nowUnix).Comment("创建时间"),
field.Int64("updated_at").DefaultFunc(nowUnix).Comment("更新时间"),
}
}
func (Permission) Indexes() []ent.Index {
return []ent.Index{index.Fields("code").Unique()}
}