mirror of https://github.com/elunez/eladmin
parent
1af4eb89d2
commit
59bf09eb31
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package me.zhengjie.modules.system.rest;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -86,13 +87,16 @@ public class MenuController {
|
|||
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
|
||||
@GetMapping("/superior")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public ResponseEntity<Object> getSuperior(@RequestParam List<Long> ids) {
|
||||
public ResponseEntity<Object> getSuperior(@RequestParam(required = false) List<Long> ids) {
|
||||
Set<MenuDto> menuDtos = new LinkedHashSet<>();
|
||||
for (Long id : ids) {
|
||||
MenuDto menuDto = menuService.findById(id);
|
||||
menuDtos.addAll(menuService.getSuperior(menuDto, new ArrayList<>()));
|
||||
if(CollectionUtil.isNotEmpty(ids)){
|
||||
for (Long id : ids) {
|
||||
MenuDto menuDto = menuService.findById(id);
|
||||
menuDtos.addAll(menuService.getSuperior(menuDto, new ArrayList<>()));
|
||||
}
|
||||
return new ResponseEntity<>(menuService.buildTree(new ArrayList<>(menuDtos)),HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(menuService.buildTree(new ArrayList<>(menuDtos)),HttpStatus.OK);
|
||||
return new ResponseEntity<>(menuService.getMenus(null),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增菜单")
|
||||
|
|
|
@ -164,7 +164,7 @@ public class RoleServiceImpl implements RoleService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "'auth:' + #p0")
|
||||
@Cacheable(key = "'auth:' + #p0.id")
|
||||
public List<GrantedAuthority> mapToGrantedAuthorities(UserDto user) {
|
||||
Set<String> permissions = new HashSet<>();
|
||||
// 如果是管理员直接返回
|
||||
|
|
Loading…
Reference in New Issue