修正返回目录
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
type AdminMenuDto struct {
|
||||
MenuId string `json:"menu_id"`
|
||||
MenuName string `json:"menu_name"` // 菜单名称
|
||||
MenuTitle string `json:"menu_title"` // 菜单名称
|
||||
ParentId string `json:"parent_id"` // 父菜单ID(0表示一级)
|
||||
MenuStatus int `json:"menu_status"` // 菜单状态(0:隐藏 1:正常)此优先级最高
|
||||
MenuType int `json:"menu_type"` // 菜单类型(1:模块 2:菜单 3:按钮)
|
||||
Permission string `json:"permission"` // 标识
|
||||
OrderNum int `json:"order_num"` // 显示顺序
|
||||
Icon string `json:"icon"` // 图标地址
|
||||
Path string `json:"path"` // 页面地址(#表示当前页)
|
||||
Component string `json:"component"` // 组件名称
|
||||
Api []*AdminMenuApiDto `json:"api"` // 接口数据
|
||||
Apis []string `json:"apis"` // 接口数据
|
||||
Children []*AdminMenuDto `json:"children"` // 下级页面
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
|
||||
func GetAdminMenuDto(m *model.AdminMenu) *AdminMenuDto {
|
||||
return &AdminMenuDto{
|
||||
MenuId: fmt.Sprintf("%d", m.MenuId),
|
||||
MenuName: m.MenuName,
|
||||
MenuTitle: m.MenuTitle,
|
||||
ParentId: fmt.Sprintf("%d", m.ParentId),
|
||||
MenuStatus: m.MenuStatus,
|
||||
MenuType: m.MenuType,
|
||||
Permission: m.Permission,
|
||||
OrderNum: m.OrderNum,
|
||||
Icon: m.Icon,
|
||||
Path: m.Path,
|
||||
Component: m.Component,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
// LoadAdminMenuApi 加载菜单api
|
||||
func (r *AdminMenuDto) LoadAdminMenuApi(m []*model.AdminMenuApi) *AdminMenuDto {
|
||||
if len(m) > 0 {
|
||||
r.Api = GetAdminMenuApiListDto(m)
|
||||
|
||||
apis := make([]string, 0, len(r.Api))
|
||||
|
||||
for _, v := range r.Api {
|
||||
apis = append(apis, v.ApiId)
|
||||
}
|
||||
|
||||
r.Apis = apis
|
||||
}
|
||||
return r
|
||||
}
|
||||
Reference in New Issue
Block a user