Przeglądaj źródła

修改调卷规则查询

宋悦 8 lat temu
rodzic
commit
0c324ef85d

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

@@ -25,16 +25,16 @@ public class ExamCourseApi {
 
     @GetMapping
     public Page<ExamCourseDTO> query(@RequestParam("exam_id") Long examId,
-                                     @RequestParam(value = "course_name", required = false) String courseName,
+                                     @RequestParam(value = "course_code", required = false) String courseCode,
                                      @RequestParam("cur_page") Integer curPage,
                                      @RequestParam("page_size") Integer pageSize) {
 
 
         Page<ExamStudent> examStudentPage;
-        if (StringUtils.isEmpty(courseName)) {
+        if (StringUtils.isEmpty(courseCode)) {
             examStudentPage = examStudentRepo.findDistinctCourseCode(examId, new PageRequest(curPage, pageSize));
         } else {
-            examStudentPage = examStudentRepo.findDistinctCourseCode(examId, '%' + courseName + "%", new PageRequest(curPage - 1, pageSize));
+            examStudentPage = examStudentRepo.findDistinctCourseCode(examId, courseCode, new PageRequest(curPage - 1, pageSize));
         }
 
 

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

@@ -19,8 +19,8 @@ public interface ExamStudentRepo extends JpaRepository<ExamStudent, Long>, Query
     @Query("select s from ExamStudent s where s.exam.id=?1 group by s.courseCode")
     Page<ExamStudent> findDistinctCourseCode(Long examId, Pageable pageable);
 
-    @Query("select s from ExamStudent s where s.exam.id=?1 and s.courseName like ?2 group by s.courseCode")
-    Page<ExamStudent> findDistinctCourseCode(Long examId,String courseName, Pageable pageable);
+    @Query("select s from ExamStudent s where s.exam.id=?1 and s.courseCode = ?2 group by s.courseCode")
+    Page<ExamStudent> findDistinctCourseCode(Long examId,String courseCode, Pageable pageable);
 
     List<ExamStudent> findByIdIn(List<Long> ids);