diff --git a/model/entity/menu.go b/model/entity/menu.go index 6d49cfe..297c5b0 100644 --- a/model/entity/menu.go +++ b/model/entity/menu.go @@ -7,8 +7,9 @@ import "wechat-robot/pkg/types" type Menu struct { types.BaseDbModel Type types.MenuType `json:"type" gorm:"type:enum('MENU','BUTTON'); default:'MENU'; not null; comment:'菜单类型(菜单或按钮)'"` - Name string `json:"name" gorm:"type:varchar(255);not null;comment:'菜单名称'"` + Name string `json:"name" gorm:"type:varchar(255);not null;comment:'页面组件名称'"` Path string `json:"path" gorm:"type:varchar(255);comment:'路径'"` + Title string `json:"title" gorm:"type:varchar(255);not null;comment:'菜单标题'"` Icon string `json:"icon" gorm:"type:varchar(255);comment:'菜单图标'"` Sort int `json:"sort" gorm:"type:int(3);not null;comment:'排序值(数字越小约靠前)'"` ParentId *string `json:"parentId" gorm:"type:varchar(32);comment:'父级菜单ID(0表示顶级菜单)'"` diff --git a/model/vo/menu/menu.go b/model/vo/menu/menu.go index 8d32656..a3c80c7 100644 --- a/model/vo/menu/menu.go +++ b/model/vo/menu/menu.go @@ -3,10 +3,11 @@ package menu // Item // @description: type Item struct { - Id string `json:"id"` // 菜单Id - Path string `json:"path"` // 访问路径 - Meta ItemMeta `json:"meta"` // 元数据 - Children []Item `json:"children"` // 子菜单 + Id string `json:"id"` // 菜单Id + Path string `json:"path"` // 访问路径 + Name string `json:"name"` // 路由名字(对应不要重复,和页面组件的name保持一致)必填 + Meta ItemMeta `json:"meta"` // 元数据 + Children []Item `json:"children,omitempty"` // 子菜单 } // ItemMeta diff --git a/service/menu/select.go b/service/menu/select.go index a4bb5e5..d551389 100644 --- a/service/menu/select.go +++ b/service/menu/select.go @@ -14,6 +14,7 @@ type menuRecordItem struct { Type types.MenuType Name string Path string + Title string Icon string Sort int ParentId *string