wangwei há 7 anos atrás
pai
commit
4c3481b149

+ 1 - 1
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/api/ExamApi.java

@@ -226,7 +226,7 @@ public class ExamApi extends ControllerSupport {
 	public ResponseEntity<?> queryAllCourseGroups(@PathVariable Long examId, @PathVariable Integer curPage,
 			@PathVariable Integer pageSize) {
 
-		List<CourseGroup> groupList = courseGroupRepo.findByExamId(examId);
+		List<CourseGroup> groupList = courseGroupRepo.findByExamId(examId, (curPage - 1) * pageSize, pageSize);
 
 		for (CourseGroup courseGroup : groupList) {
 			List<Long> courseIdList = Lists.newArrayList();

+ 3 - 2
exam-work-domain/src/main/java/cn/com/qmth/examcloud/service/examwork/dao/CourseGroupRepo.java

@@ -11,7 +11,8 @@ import cn.com.qmth.examcloud.service.examwork.entity.CourseGroup;
 
 public interface CourseGroupRepo extends JpaRepository<CourseGroup, Long>, QueryByExampleExecutor<CourseGroup> {
 
-	@Query(value = "select * from ecs_exam_course_group t where t.exam_id=?1 order by id", nativeQuery = true)
-	List<CourseGroup> findByExamId(@Param("examId") Long examId);
+	@Query(value = "select * from ecs_exam_course_group t where t.exam_id=?1 order by id limit ?2,?3", nativeQuery = true)
+	List<CourseGroup> findByExamId(@Param("examId") Long examId, @Param("curPage") Integer curPage,
+			@Param("pageSize") Integer pageSize);
 
 }