Selaa lähdekoodia

部分列表分页查询修改

wangliang 1 vuosi sitten
vanhempi
commit
5c7d08e7f4

+ 1 - 1
server/src/main/java/com/qmth/jkserver/controller/system/ExamPlanController.java

@@ -228,7 +228,7 @@ public class ExamPlanController extends BaseSystemController {
         pageSize = pageSize == null ? Constants.DEFAULT_PAGE_SIZE : pageSize;
         ExamStudentDto examStudentDto = new ExamStudentDto();
         examStudentDto.setExamCode(examCode);
-        examStudentDto.setAttachmentId(attachmentId);
+        examStudentDto.setAttachmentId(Long.parseLong(attachmentId));
         examStudentDto.setBatchId(batchId);
         examStudentDto.setStageId(stageId);
         examStudentDto.setPlaceCode(placeCode);

+ 8 - 0
server/src/main/java/com/qmth/jkserver/dao/ExamPlanDao.java

@@ -66,5 +66,13 @@ public interface ExamPlanDao extends BaseMapper<ExamPlan> {
                                                @Param("enable") Boolean enable,
                                                @Param("schoolId") Long schoolId,
                                                @Param("creatorId") Long creatorId);
+
+    public IPage<ExamPlan> findByNameByIpage(IPage<Map> iPage,
+                                      @Param("name") String name,
+                                      @Param("examType") String examType,
+                                      @Param("examStatus") String examStatus,
+                                      @Param("startTime") Long startTime,
+                                      @Param("endTime") Long endTime,
+                                      @Param("schoolId") Long schoolId);
 }
 

+ 9 - 0
server/src/main/java/com/qmth/jkserver/dao/ExamRoomTempDao.java

@@ -15,7 +15,9 @@ package com.qmth.jkserver.dao;
 //}
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.qmth.jkserver.model.ExamRoomTemp;
+import com.qmth.jkserver.model.ExamStudentTemp;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -33,7 +35,14 @@ public interface ExamRoomTempDao extends BaseMapper<ExamRoomTemp> {
 
     public List<ExamRoomTemp> findByExamCodeAndAttachmentId(@Param("examCode") String examCode, @Param("attachmentId") Long attachmentId);
 
+    @SuppressWarnings("MybatisXMapperMethodInspection")
     public List<Map> findByExamCodeAndAttachmentIdByMap(@Param("examCode") String examCode, @Param("attachmentId") Long attachmentId);
 
+    @SuppressWarnings("MybatisXMapperMethodInspection")
     public List<Map> findByExamCodeAndAttachmentIdGroupByRoomCodeByMap(@Param("examCode") String examCode, @Param("attachmentId") Long attachmentId);
+
+    public IPage<ExamRoomTemp> findByExamCode(IPage<Map> iPage,
+                                                 @Param("examCode") String examCode,
+                                                 @Param("attachmentId") Long attachmentId,
+                                                 @Param("placeCode") String placeCode);
 }

+ 10 - 0
server/src/main/java/com/qmth/jkserver/dao/ExamStudentTempDao.java

@@ -41,4 +41,14 @@ public interface ExamStudentTempDao extends BaseMapper<ExamStudentTemp> {
 
     @SuppressWarnings("MybatisXMapperMethodInspection")
     public IPage<Map> findByExamCodeAndPlaceCodeByMap(IPage<Map> iPage, @Param("examCode") String examCode, @Param("placeCode") String placeCode);
+
+    public IPage<ExamStudentTemp> findByExamCode(IPage<Map> iPage,
+                                                                     @Param("examCode") String examCode,
+                                                                     @Param("attachmentId") Long attachmentId,
+                                                                     @Param("batchId") String batchId,
+                                                                     @Param("stageId") String stageId,
+                                                                     @Param("placeCode") String placeCode,
+                                                                     @Param("roomCode") String roomCode,
+                                                                     @Param("courseCode") String courseCode,
+                                                                     @Param("querykey") String querykey);
 }

+ 3 - 3
server/src/main/java/com/qmth/jkserver/dto/ExamStudentDto.java

@@ -17,7 +17,7 @@ public class ExamStudentDto {
 
     private String querykey;
 
-    private String attachmentId;
+    private Long attachmentId;
     
     private String placeCode;
     
@@ -113,11 +113,11 @@ public class ExamStudentDto {
         this.querykey = querykey;
     }
 
-    public String getAttachmentId() {
+    public Long getAttachmentId() {
         return attachmentId;
     }
 
-    public void setAttachmentId(String attachmentId) {
+    public void setAttachmentId(Long attachmentId) {
         this.attachmentId = attachmentId;
     }
 }

+ 16 - 7
server/src/main/java/com/qmth/jkserver/service/impl/JkExamPlanServiceImpl.java

@@ -303,15 +303,18 @@ public class JkExamPlanServiceImpl extends ServiceImpl<ExamPlanDao, ExamPlan> im
         if (Objects.nonNull(searchCondition.getSchoolId()) && searchCondition.getSchoolId().longValue() > 0) {
             examPlanQueryWrapper.lambda().eq(ExamPlan::getSchoolId, searchCondition.getSchoolId());
         }
-        examPlanQueryWrapper.lambda().orderByDesc(ExamPlan::getCreateTime);
+//        examPlanQueryWrapper.lambda().orderByDesc(ExamPlan::getCreateTime);
 //        query.with(new Sort(Direction.DESC, "createTime"));
 //        long count = this.mongoTemplate.count(query, ExamPlan.class);
         long count = examPlanService.count(examPlanQueryWrapper);
 //        query.limit(pageSize);
 //        query.skip((curPage - 1) * pageSize);
 //        List<ExamPlan> examPlanList = this.mongoTemplate.find(query, ExamPlan.class);
-        List<ExamPlan> examPlanList = examPlanService.list(examPlanQueryWrapper);
-        return new PageImpl<ExamPlan>(examPlanList, PageRequest.of(curPage - 1, pageSize), count);
+//        List<ExamPlan> examPlanList = examPlanService.list(examPlanQueryWrapper);
+        IPage<ExamPlan> examPlanIPage = examPlanDao.findByNameByIpage(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(curPage, pageSize),
+                searchCondition.getName(), Objects.nonNull(searchCondition.getExamType()) ? searchCondition.getExamType().name() : null, Objects.nonNull(searchCondition.getExamStatus()) ? searchCondition.getExamStatus().name() : null,
+                searchCondition.getStartTime(), searchCondition.getEndTime(), Objects.nonNull(searchCondition.getSchoolId()) && searchCondition.getSchoolId().longValue() > 0 ? searchCondition.getSchoolId() : null);
+        return new PageImpl<ExamPlan>(examPlanIPage.getRecords(), PageRequest.of(curPage - 1, pageSize), count);
     }
 
     /**
@@ -628,8 +631,11 @@ public class JkExamPlanServiceImpl extends ServiceImpl<ExamPlanDao, ExamPlan> im
 //        query.limit(pageSize);
 //        query.skip((curPage - 1) * pageSize);
 //        List<ExamStudentTemp> examStudentList = this.mongoTemplate.find(query, ExamStudentTemp.class);
-        List<ExamStudentTemp> examStudentList = jkExamStudentTempService.list(examStudentTempQueryWrapper);
-        return new PageImpl<ExamStudentTemp>(examStudentList, PageRequest.of(curPage - 1, pageSize), count);
+//        List<ExamStudentTemp> examStudentList = jkExamStudentTempService.list(examStudentTempQueryWrapper);
+        IPage<ExamStudentTemp> examStudentTempIPage = examStudentTempDao.findByExamCode(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(curPage, pageSize),
+                searchCondition.getExamCode(), searchCondition.getAttachmentId(), searchCondition.getBatchId(), searchCondition.getStageId(), searchCondition.getPlaceCode(),
+                searchCondition.getRoomCode(), searchCondition.getCourseCode(), searchCondition.getQuerykey());
+        return new PageImpl<ExamStudentTemp>(examStudentTempIPage.getRecords(), PageRequest.of(curPage - 1, pageSize), count);
     }
 
     @Override
@@ -646,8 +652,11 @@ public class JkExamPlanServiceImpl extends ServiceImpl<ExamPlanDao, ExamPlan> im
         if (Objects.nonNull(searchCondition) && Objects.nonNull(searchCondition.getPlaceCode())) {
             examRoomTempQueryWrapper.lambda().eq(ExamRoomTemp::getPlaceCode, searchCondition.getPlaceCode());
         }
-        List<ExamRoomTemp> list = jkExamRoomTempService.list(examRoomTempQueryWrapper);
-        return new PageImpl<ExamRoomTemp>(list, PageRequest.of(curPage - 1, pageSize), list.size());
+//        List<ExamRoomTemp> list = jkExamRoomTempService.list(examRoomTempQueryWrapper);
+        long count = jkExamRoomTempService.count(examRoomTempQueryWrapper);
+        IPage<ExamRoomTemp> examRoomTempIPage = examRoomTempDao.findByExamCode(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(curPage, pageSize),
+                searchCondition.getExamCode(), searchCondition.getAttachmentId(), searchCondition.getPlaceCode());
+        return new PageImpl<ExamRoomTemp>(examRoomTempIPage.getRecords(), PageRequest.of(curPage - 1, pageSize), count);
     }
 
     @Override

+ 25 - 0
server/src/main/resources/mapper/JkExamPlanMapper.xml

@@ -105,4 +105,29 @@
             </if>
         </where>
     </select>
+
+    <select id="findByNameByIpage" resultType="com.qmth.jkserver.model.ExamPlan">
+        select * from jk_exam_plan t
+        <where>
+            <if test="name != null and name != ''">
+                and t.name like concat('%', #{name}, '%')
+            </if>
+            <if test="examType != null and examType != ''">
+                and t.exam_type = #{examType}
+            </if>
+            <if test="examStatus != null and examStatus != ''">
+                and t.exam_status = #{examStatus}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and t.start_time <![CDATA[ >= ]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and t.end_time <![CDATA[ <= ]]> #{endTime}
+            </if>
+            <if test="schoolId != null and schoolId != ''">
+                and t.school_id = #{schoolId}
+            </if>
+        </where>
+        order by t.create_time desc
+    </select>
 </mapper>

+ 15 - 0
server/src/main/resources/mapper/JkExamRoomTempMapper.xml

@@ -41,4 +41,19 @@
         group by t.room_code,t.room_name
         order by t.room_code
     </select>
+
+    <select id="findByExamCode" resultType="com.qmth.jkserver.model.ExamRoomTemp">
+        select * from jk_exam_room_temp t
+        <where>
+            <if test="examCode != null and examCode != ''">
+                and t.exam_code = #{examCode}
+            </if>
+            <if test="attachmentId != null and attachmentId != ''">
+                and t.attachment_id = #{attachmentId}
+            </if>
+            <if test="placeCode != null and placeCode != ''">
+                and t.place_code = #{placeCode}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 31 - 0
server/src/main/resources/mapper/JkExamStudentTempMapper.xml

@@ -52,4 +52,35 @@
         group by t.place_code,t.room_code
         order by t.room_code
     </select>
+
+
+    <select id="findByExamCode" resultType="com.qmth.jkserver.model.ExamStudentTemp">
+        select * from jk_exam_student_temp t
+        <where>
+            <if test="examCode != null and examCode != ''">
+                and t.exam_code = #{examCode}
+            </if>
+            <if test="attachmentId != null and attachmentId != ''">
+                and t.attachment_id = #{attachmentId}
+            </if>
+            <if test="batchId != null and batchId != ''">
+                and t.batch_id = #{batchId}
+            </if>
+            <if test="stageId != null and stageId != ''">
+                and t.stage_id = #{stageId}
+            </if>
+            <if test="placeCode != null and placeCode != ''">
+                and t.place_code = #{placeCode}
+            </if>
+            <if test="roomCode != null and roomCode != ''">
+                and t.room_code = #{roomCode}
+            </if>
+            <if test="courseCode != null and courseCode != ''">
+                and t.course_code = #{courseCode}
+            </if>
+            <if test="querykey != null and querykey != ''">
+                and (t.name like concat('%', #{querykey}, '%') or t.ticket_no like concat('%', #{querykey}, '%'))
+            </if>
+        </where>
+    </select>
 </mapper>