39 lines
994 B
Go
39 lines
994 B
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"time"
|
|
)
|
|
|
|
type Menu struct {
|
|
ID uint `json:"id" gorm:"primary_key"`
|
|
Name string `json:"name"` // 路由名称 英文名
|
|
Title string `json:"title"` // 菜单名称
|
|
GroupName string `json:"group_name"` // 项目名称
|
|
Role []*Role `json:"role" gorm:"many2many:role_menus"`
|
|
//ParentID uint `json:"parent_id"` // 父菜单ID
|
|
//Sort uint `json:"sort"`
|
|
//Children []*Menu `json:"children" gorm:"foreignkey:ParentID"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"-"`
|
|
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
|
}
|
|
|
|
type MenuForLeader struct {
|
|
GroupName string `json:"group_name"` // 项目名称
|
|
Menus []*Menus `json:"menus"` // 菜单
|
|
}
|
|
|
|
type Menus struct {
|
|
ID uint `json:"id"`
|
|
Name string `json:"name"` // 路由名称
|
|
Title string `json:"title"` // 菜单名称
|
|
}
|
|
|
|
/*
|
|
resp:
|
|
{
|
|
roles:["name", "name"] // Menu.Name
|
|
}
|
|
*/
|