From e5373bc3e86497a4a2f03866372733f09bff3da7 Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Mon, 18 Sep 2023 13:15:42 -0700 Subject: [PATCH] GRAD2-2326: the deceased check query is enhanced to support paging. GRAD2-2326: the deceased check query is enhanced to support paging. --- .../gradstudent/service/GradStudentService.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java index 955d5063..39d277de 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java @@ -398,6 +398,18 @@ public List getStudentIDsByStatusCode(List studentIDs, String status if (StringUtils.isBlank(statusCode) || studentIDs.isEmpty()) { return new ArrayList<>(); } - return graduationStatusRepository.filterGivenStudentsByStatusCode(studentIDs, statusCode); + List results = new ArrayList<>(); + int pageSize = 1000; + int pageNum = studentIDs.size() / pageSize + 1; + for (int i = 0; i < pageNum; i++) { + int startIndex = i * pageSize; + int endIndex = Math.min(startIndex + pageSize, studentIDs.size()); + List inputIDs = studentIDs.subList(startIndex, endIndex); + List responseIDs = graduationStatusRepository.filterGivenStudentsByStatusCode(inputIDs, statusCode); + if (responseIDs != null && !responseIDs.isEmpty()) { + results.addAll(responseIDs); + } + } + return results; } }