Commit 7d7ea8db by 丁伟峰

page方式

1 parent 69594d07
...@@ -29,7 +29,7 @@ public class BusinessController { ...@@ -29,7 +29,7 @@ public class BusinessController {
return res; return res;
} }
@GetMapping("/business/warehouse/list") @GetMapping("/business/team/warehouse/list")
public Result<?> getWarehouses(@Validated BusinessWarehousesDTO.Request reqDTO) { public Result<?> getWarehouses(@Validated BusinessWarehousesDTO.Request reqDTO) {
Result<?> res = null; Result<?> res = null;
try { try {
......
...@@ -26,19 +26,19 @@ public class BusinessTeamsDTO { ...@@ -26,19 +26,19 @@ public class BusinessTeamsDTO {
/** /**
* 当前页码 * 当前页码
*/ */
private String pageCurrent; private Integer pageCurrent;
/** /**
* 总页数 * 总页数
*/ */
private String pages; private Integer pages;
/** /**
* 每业条数 * 每业条数
*/ */
private String pageSize; private Integer pageSize;
/** /**
* 总条数 * 总条数
*/ */
private String total; private Integer total;
} }
@lombok.Data @lombok.Data
......
...@@ -42,11 +42,11 @@ public class BusinessTeamServiceImpl implements BusinessTeamService { ...@@ -42,11 +42,11 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
@Override @Override
public Result<?> getTeams(BusinessTeamsDTO.Request req) { public Result<?> getTeams(BusinessTeamsDTO.Request req) {
List<BusinessTeamsDTO.Content> contens = new ArrayList<>(); List<BusinessTeamsDTO.Content> contents = new ArrayList<>();
Pageable pageable = PageRequest.of(req.getPage() - 1, req.getSize()); Pageable pageable = PageRequest.of(req.getPage() - 1, req.getSize());
Page<OrgTeamEntity> teams = orgTeamDao.findAllByGroupId(req.getLevelValue(), pageable); Page<OrgTeamEntity> page = orgTeamDao.findAllByGroupId(req.getLevelValue(), pageable);
List<String> teamIds = teams.stream().map(OrgTeamEntity::getTeamId).collect(Collectors.toList()); List<String> teamIds = page.getContent().stream().map(OrgTeamEntity::getTeamId).collect(Collectors.toList());
for (OrgTeamEntity e:teams){ for (OrgTeamEntity e:page.getContent()){
String engineers = orgTeamEngineerDao.findAllByTeamId(e.getTeamId()).stream().map(e2->{ String engineers = orgTeamEngineerDao.findAllByTeamId(e.getTeamId()).stream().map(e2->{
return engineerInfoDao.getByEngineerCode(e2.getEngineerCode()).getName(); return engineerInfoDao.getByEngineerCode(e2.getEngineerCode()).getName();
}).collect(Collectors.toList()).toString(); }).collect(Collectors.toList()).toString();
...@@ -56,7 +56,9 @@ public class BusinessTeamServiceImpl implements BusinessTeamService { ...@@ -56,7 +56,9 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
content.setEngineers(engineers); content.setEngineers(engineers);
// todo 工作队容量 // todo 工作队容量
} }
return Result.success(new BusinessTeamsDTO.Result().setContent(contens)); BusinessTeamsDTO.Result rs = new BusinessTeamsDTO.Result();
rs.setContent(contents).setTotal(page.getTotalPages()).setPageSize(page.getSize());
return Result.success(rs);
} }
private List<String> getWorkdaysChinese(String workDays){ private List<String> getWorkdaysChinese(String workDays){
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!