管理系统-能力挂接列表新增显示所属部门字段

This commit is contained in:
dinggang 2022-07-25 17:19:23 +08:00
parent 6fedef22c0
commit 115944b8e8
2 changed files with 6 additions and 2 deletions

View File

@ -11,7 +11,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;

View File

@ -21,6 +21,7 @@ import io.renren.modules.resource.videoPreview.VideoPreviewFactory;
import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysDeptService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -129,7 +130,11 @@ public class ResourceController {
}) })
public Result<PageData<ResourceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) { public Result<PageData<ResourceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<ResourceDTO> page = resourceService.page(params); PageData<ResourceDTO> page = resourceService.page(params);
page.getList().forEach(item -> item.setInfoList(resourceService.selectAttrsByResourceId(item.getId()))); page.getList().forEach(item -> {
item.setInfoList(resourceService.selectAttrsByResourceId(item.getId()));
String deptName = sysDeptService.get(item.getDeptId()).getName();
item.setDeptName(StringUtils.isNotBlank(deptName) ? deptName : "--");
});
return new Result<PageData<ResourceDTO>>().ok(page); return new Result<PageData<ResourceDTO>>().ok(page);
} }