宋悦 7 سال پیش
والد
کامیت
0cedfe2c81
1فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 4 2
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/api/ExamCourseApi.java

+ 4 - 2
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/api/ExamCourseApi.java

@@ -67,8 +67,10 @@ public class ExamCourseApi {
         }).filter(examCourseDTO -> {
             Boolean enable = courseMap.get(examCourseDTO.getCourseCode());
             return enable != null ? enable : false;
-        }).skip(curPage * pageSize).limit(pageSize).collect(Collectors.toList());
-        return new PageImpl<ExamCourseDTO>(examCourseDTOs, new PageRequest(curPage, pageSize), examStudents.size());
+        }).collect(Collectors.toList());
+        int total = examCourseDTOs.size();
+        examCourseDTOs = examCourseDTOs.stream().skip(curPage * pageSize).limit(pageSize).collect(Collectors.toList());
+        return new PageImpl<ExamCourseDTO>(examCourseDTOs, new PageRequest(curPage, pageSize), total);
 
     }