|
@@ -23,6 +23,7 @@ import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
|
|
|
import static cn.newfeifan.mall.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
|
@@ -87,9 +88,12 @@ public class RoleController {
|
|
|
|
|
|
@GetMapping({"/list-all-simple", "/simple-list"})
|
|
|
@Operation(summary = "获取角色精简信息列表", description = "只包含被开启的角色,主要用于前端的下拉选项")
|
|
|
- public CommonResult<List<RoleSimpleRespVO>> getSimpleRoleList() {
|
|
|
+ public CommonResult<List<RoleSimpleRespVO>> getSimpleRoleList(@RequestParam(value = "categoryId", required = false) Integer categoryId) {
|
|
|
List<RoleDO> list = roleService.getRoleListByStatus(singleton(CommonStatusEnum.ENABLE.getStatus()));
|
|
|
list.sort(Comparator.comparing(RoleDO::getSort));
|
|
|
+ if (categoryId != null) {
|
|
|
+ list = list.stream().filter(k -> k.getCategoryId().equals(categoryId)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
return success(BeanUtils.toBean(list, RoleSimpleRespVO.class));
|
|
|
}
|
|
|
|