修正返回目录
This commit is contained in:
+7
-7
@@ -4,9 +4,9 @@ import (
|
||||
"errors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/roleResponse"
|
||||
"hospital-admin-api/global"
|
||||
"strconv"
|
||||
)
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
type RoleService struct{}
|
||||
|
||||
// GetRoleMenuList 获取角色菜单
|
||||
func (r *RoleService) GetRoleMenuList(roleId int64, isAdmin bool) ([]*roleResponse.GetRoleMenuList, error) {
|
||||
func (r *RoleService) GetRoleMenuList(roleId int64, isAdmin bool) ([]*dto.AdminRoleMenuDto, error) {
|
||||
// 获取角色菜单
|
||||
adminRoleMenuDao := dao.AdminRoleMenuDao{}
|
||||
adminMenuDao := dao.AdminMenuDao{}
|
||||
@@ -41,7 +41,7 @@ func (r *RoleService) GetRoleMenuList(roleId int64, isAdmin bool) ([]*roleRespon
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var getRoleMenuListResponse []*roleResponse.GetRoleMenuList
|
||||
var getRoleMenuListResponse []*dto.AdminRoleMenuDto
|
||||
|
||||
if len(menuIDs) > 0 {
|
||||
// 构建菜单树
|
||||
@@ -81,15 +81,15 @@ func (r *RoleService) GetRoleMenuButtonList(roleId int64) ([]string, error) {
|
||||
}
|
||||
|
||||
// 获取角色菜单-构建菜单树
|
||||
func buildMenuTree(menuIds []int64, menuData []*model.AdminMenu) []*roleResponse.GetRoleMenuList {
|
||||
menuMap := make(map[int64]*roleResponse.GetRoleMenuList)
|
||||
rootNodes := make([]*roleResponse.GetRoleMenuList, 0)
|
||||
func buildMenuTree(menuIds []int64, menuData []*model.AdminMenu) []*dto.AdminRoleMenuDto {
|
||||
menuMap := make(map[int64]*dto.AdminRoleMenuDto)
|
||||
rootNodes := make([]*dto.AdminRoleMenuDto, 0)
|
||||
|
||||
// 构建菜单映射
|
||||
for _, menu := range menuData {
|
||||
for _, v := range menuIds {
|
||||
if v == menu.MenuId {
|
||||
node := &roleResponse.GetRoleMenuList{
|
||||
node := &dto.AdminRoleMenuDto{
|
||||
MenuId: strconv.FormatInt(menu.MenuId, 10),
|
||||
MenuName: menu.MenuName,
|
||||
MenuTitle: menu.MenuTitle,
|
||||
|
||||
Reference in New Issue
Block a user