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