增加构建通知
This commit is contained in:
parent
69fc7fe163
commit
36b04d50b8
@ -65,16 +65,16 @@ public class ApplicationServiceImpl extends BaseServiceImpl<Application, Applica
|
||||
@Resource
|
||||
private ExternalSystemConverter externalSystemConverter;
|
||||
|
||||
public Page<ApplicationDTO> page(ApplicationQuery query) {
|
||||
Page<ApplicationDTO> page = super.page(query);
|
||||
List<ApplicationDTO> content = page.getContent();
|
||||
|
||||
if (content.isEmpty()) {
|
||||
return page;
|
||||
/**
|
||||
* 填充应用的关联数据(分类和团队数量)
|
||||
*/
|
||||
private void fillApplicationRelations(List<ApplicationDTO> applications) {
|
||||
if (applications.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 批量查询应用分类
|
||||
List<Long> categoryIds = content.stream()
|
||||
List<Long> categoryIds = applications.stream()
|
||||
.map(ApplicationDTO::getApplicationCategoryId)
|
||||
.filter(java.util.Objects::nonNull)
|
||||
.distinct()
|
||||
@ -87,7 +87,7 @@ public class ApplicationServiceImpl extends BaseServiceImpl<Application, Applica
|
||||
}
|
||||
|
||||
// 批量统计团队数量
|
||||
List<Long> applicationIds = content.stream()
|
||||
List<Long> applicationIds = applications.stream()
|
||||
.map(ApplicationDTO::getId)
|
||||
.collect(toList());
|
||||
java.util.Map<Long, Long> teamCountMap = new java.util.HashMap<>();
|
||||
@ -101,14 +101,26 @@ public class ApplicationServiceImpl extends BaseServiceImpl<Application, Applica
|
||||
}
|
||||
|
||||
// 设置关联数据
|
||||
content.forEach(application -> {
|
||||
applications.forEach(application -> {
|
||||
if (application.getApplicationCategoryId() != null) {
|
||||
application.setApplicationCategory(categoryMap.get(application.getApplicationCategoryId()));
|
||||
}
|
||||
application.setTeamCount(teamCountMap.getOrDefault(application.getId(), 0L));
|
||||
});
|
||||
}
|
||||
|
||||
return new PageImpl<>(content, page.getPageable(), page.getTotalElements());
|
||||
@Override
|
||||
public Page<ApplicationDTO> page(ApplicationQuery query) {
|
||||
Page<ApplicationDTO> page = super.page(query);
|
||||
fillApplicationRelations(page.getContent());
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApplicationDTO> findAll(ApplicationQuery query) {
|
||||
List<ApplicationDTO> list = super.findAll(query);
|
||||
fillApplicationRelations(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user