Skip to content

Commit 8ecf6b4

Browse files
committed
fix: implement sorting logic for compliance evaluations
1 parent 01e597a commit 8ecf6b4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

backend/src/main/java/com/park/utmstack/service/compliance/config/UtmComplianceControlConfigService.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,14 @@ public Page<UtmComplianceControlConfig> findBySection(Long sectionId, String sea
137137

138138
List<UtmComplianceControlConfig> content = repository.findWithQueriesByIdIn(ids);
139139

140-
return new PageImpl<>(content, pageable, page.getTotalElements());
140+
if (content.isEmpty()) {
141+
return Page.empty(pageable);
142+
}
143+
144+
Map<Long, UtmComplianceControlConfig> map = content.stream().collect(Collectors.toMap(UtmComplianceControlConfig::getId, c -> c));
145+
List<UtmComplianceControlConfig> ordered = ids.stream().map(map::get).collect(Collectors.toList());
146+
147+
return new PageImpl<>(ordered, pageable, page.getTotalElements());
141148
}
142149

143150
}

0 commit comments

Comments
 (0)