Przeglądaj źródła

修改角色获取

tags/24080901
WendyYang 1 rok temu
rodzic
commit
e82470b110
1 zmienionych plików z 4 dodań i 6 usunięć
  1. +4
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/MenuManage.java

+ 4
- 6
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/MenuManage.java Wyświetl plik

@@ -1,7 +1,6 @@
package com.ningdatech.pmapi.sys.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.util.TreeUtil;
@@ -10,12 +9,11 @@ import com.ningdatech.pmapi.sys.model.entity.RoleMenu;
import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO;
import com.ningdatech.pmapi.sys.service.IRoleMenuService;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
* <p>
@@ -32,11 +30,11 @@ public class MenuManage {
private final IRoleMenuService roleMenuService;

public List<MenuRoleVO> buildUserMenu(List<Menu> list, UserInfoDetails loginUser) {
if (Objects.isNull(loginUser) || CollUtil.isEmpty(loginUser.getRoleIdList())) {
/*if (Objects.isNull(loginUser) || CollUtil.isEmpty(loginUser.getRoleIdList())) {
return Collections.emptyList();
}
}*/
List<RoleMenu> roleMenus = roleMenuService.list(Wrappers.lambdaQuery(RoleMenu.class)
.in(RoleMenu::getRoleId, loginUser.getRoleIdList()));
.in(RoleMenu::getRoleId, LoginUserUtil.getRoleIdList()));
List<MenuRoleVO> menuRoles = CollUtils.convert(list, w -> BeanUtil.copyProperties(w, MenuRoleVO.class));
return TreeUtil.buildUserTree(menuRoles, roleMenus);
}


Ładowanie…
Anuluj
Zapisz