From 79fa7196afd7ea5fdc36d005e59c5bccb2fd7ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Thu, 1 Feb 2024 17:59:59 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E7=9A=84=E8=8F=9C=E5=8D=95=E6=95=B0=E6=8D=AE=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/entity/menu.go | 3 ++- model/vo/menu/menu.go | 9 +++++---- service/menu/select.go | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/model/entity/menu.go b/model/entity/menu.go index 6d49cfe3..297c5b08 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 8d326569..a3c80c77 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 a4bb5e5a..d5513893 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