查询最新能力增加所属部门名称

This commit is contained in:
dinggang 2022-09-05 09:35:55 +08:00
parent 606757b31e
commit 2ce9eac65d
1 changed files with 18 additions and 1 deletions

View File

@ -44,6 +44,7 @@ import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dao.SysDeptDao;
import io.renren.modules.sys.dao.SysRegionDao;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.entity.SysDeptEntity;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService;
import lombok.SneakyThrows;
@ -695,8 +696,24 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
queryWrapper.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"))
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
.ne("type", "知识库")
.ne("type", "赋能案例")
.orderByDesc("create_date");
return resourceDao.selectPage(page, queryWrapper);
IPage<ResourceEntity> resourceEntityIPage = resourceDao.selectPage(page, queryWrapper);
IPage<ResourceDTO> resourceDTOIPage = new Page<>();
resourceDTOIPage.setPages(resourceEntityIPage.getPages());
resourceDTOIPage.setTotal(resourceEntityIPage.getTotal());
resourceDTOIPage.setCurrent(resourceEntityIPage.getCurrent());
resourceDTOIPage.setSize(resourceEntityIPage.getSize());
ArrayList<ResourceDTO> arrayList = new ArrayList<>();
resourceDTOIPage.setRecords(arrayList);
resourceEntityIPage.getRecords().forEach(item -> {
ResourceDTO resourceDTO = new ResourceDTO();
BeanUtils.copyProperties(item, resourceDTO);
SysDeptEntity dept = sysDeptDao.getById(resourceDTO.getDeptId());
resourceDTO.setDeptName(dept == null ? "" : dept.getName());
arrayList.add(resourceDTO);
});
return resourceDTOIPage;
}