wangliang 4 жил өмнө
parent
commit
94cee85610

+ 2 - 1
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamActivityController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.themis.business.base.BasePage;
 import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.dto.response.TEExamActivityQueryDto;
 import com.qmth.themis.business.entity.TBUser;
 import com.qmth.themis.business.entity.TEExam;
 import com.qmth.themis.business.entity.TEExamActivity;
@@ -100,7 +101,7 @@ public class TEExamActivityController {
     @RequestMapping(value = "/query", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "考试场次信息", response = TEExamActivity.class)})
     public Result query(@ApiParam(value = "考试批次id", required = false) @RequestParam(required = false) Long examId, @ApiParam(value = "考试场次编码", required = false) @RequestParam(required = false) String code, @ApiParam(value = "开始日期", required = false) @RequestParam(required = false) String startDate, @ApiParam(value = "结束日期", required = false) @RequestParam(required = false) String finishDate, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
-        IPage<TEExamActivity> teExamActivityIPage = teExamActivityService.examActivityQuery(new Page<>(pageNumber, pageSize), examId, code, startDate, finishDate);
+        IPage<TEExamActivityQueryDto> teExamActivityIPage = teExamActivityService.examActivityQuery(new Page<>(pageNumber, pageSize), examId, code, startDate, finishDate);
         BasePage basePage = new BasePage(teExamActivityIPage.getRecords(), teExamActivityIPage.getCurrent(), teExamActivityIPage.getSize(), teExamActivityIPage.getTotal());
         Map map = new HashMap<>();
         map.put(SystemConstant.RECORDS, basePage);

+ 2 - 1
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamActivityMapper.java

@@ -3,6 +3,7 @@ package com.qmth.themis.business.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.qmth.themis.business.dto.response.TEExamActivityDto;
+import com.qmth.themis.business.dto.response.TEExamActivityQueryDto;
 import com.qmth.themis.business.entity.TEExamActivity;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -70,7 +71,7 @@ public interface TEExamActivityMapper extends BaseMapper<TEExamActivity> {
      * @param finishDate
      * @return
      */
-    public IPage<TEExamActivity> examActivityQuery(IPage<Map> iPage, @Param("examId") Long examId, @Param("code") String code, @Param("startDate") String startDate, @Param("finishDate") String finishDate);
+    public IPage<TEExamActivityQueryDto> examActivityQuery(IPage<Map> iPage, @Param("examId") Long examId, @Param("code") String code, @Param("startDate") String startDate, @Param("finishDate") String finishDate);
 
     /**
      * 获取考试待考列表

+ 114 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/response/TEExamActivityQueryDto.java

@@ -0,0 +1,114 @@
+package com.qmth.themis.business.dto.response;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description: 考试场次dto
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/8/3
+ */
+public class TEExamActivityQueryDto implements Serializable {
+
+    private Long id;//考试id
+    private String code;//考试场次id
+    private Long examId;//考试批次id
+    private Integer prepareSeconds;//提前多长时间开始候考(分钟)
+    private Integer maxDurationSeconds;//最大考试时长
+    private Integer enable;//是否启用
+    private Integer openingSeconds;//允许开考时长(分钟);
+    private Date startTime;//开始时间
+    private Date finishTime;//结束时间
+    private Date updateTime;//更新时间
+    private String updateName;//更新人
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public Integer getPrepareSeconds() {
+        return prepareSeconds;
+    }
+
+    public void setPrepareSeconds(Integer prepareSeconds) {
+        this.prepareSeconds = prepareSeconds;
+    }
+
+    public Integer getMaxDurationSeconds() {
+        return maxDurationSeconds;
+    }
+
+    public void setMaxDurationSeconds(Integer maxDurationSeconds) {
+        this.maxDurationSeconds = maxDurationSeconds;
+    }
+
+    public Integer getEnable() {
+        return enable;
+    }
+
+    public void setEnable(Integer enable) {
+        this.enable = enable;
+    }
+
+    public Integer getOpeningSeconds() {
+        return openingSeconds;
+    }
+
+    public void setOpeningSeconds(Integer openingSeconds) {
+        this.openingSeconds = openingSeconds;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getFinishTime() {
+        return finishTime;
+    }
+
+    public void setFinishTime(Date finishTime) {
+        this.finishTime = finishTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getUpdateName() {
+        return updateName;
+    }
+
+    public void setUpdateName(String updateName) {
+        this.updateName = updateName;
+    }
+}

+ 2 - 1
themis-business/src/main/java/com/qmth/themis/business/service/TEExamActivityService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
 import com.qmth.themis.business.dto.response.TEExamActivityDto;
+import com.qmth.themis.business.dto.response.TEExamActivityQueryDto;
 import com.qmth.themis.business.entity.TEExamActivity;
 
 import java.util.List;
@@ -68,7 +69,7 @@ public interface TEExamActivityService extends IService<TEExamActivity> {
      * @param finishDate
      * @return
      */
-    public IPage<TEExamActivity> examActivityQuery(IPage<Map> iPage, Long examId, String code, String startDate, String finishDate);
+    public IPage<TEExamActivityQueryDto> examActivityQuery(IPage<Map> iPage, Long examId, String code, String startDate, String finishDate);
 
     /**
      * 获取考试待考列表

+ 2 - 1
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamActivityServiceImpl.java

@@ -6,6 +6,7 @@ import java.util.Map;
 import javax.annotation.Resource;
 
 import com.qmth.themis.business.dto.response.TEExamActivityDto;
+import com.qmth.themis.business.dto.response.TEExamActivityQueryDto;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
@@ -95,7 +96,7 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
      * @return
      */
     @Override
-    public IPage<TEExamActivity> examActivityQuery(IPage<Map> iPage, Long examId, String code, String startDate, String finishDate) {
+    public IPage<TEExamActivityQueryDto> examActivityQuery(IPage<Map> iPage, Long examId, String code, String startDate, String finishDate) {
         return teExamActivityMapper.examActivityQuery(iPage, examId, code, startDate, finishDate);
     }
 

+ 33 - 3
themis-business/src/main/resources/mapper/TEExamActivityMapper.xml

@@ -59,8 +59,38 @@
         select * from ${tableName}
     </select>
 
-    <select id="examActivityQuery" resultType="com.qmth.themis.business.entity.TEExamActivity">
-        select teea.* from t_e_exam_activity teea
+    <select id="examActivityQuery" resultType="com.qmth.themis.business.dto.response.TEExamActivityQueryDto">
+        select
+        t.id,
+        t.code,
+        t.examId,
+        t.prepareSeconds,
+        t.maxDurationSeconds,
+        t.enable,
+        t.openingSeconds,
+        t.startTime,
+        t.finishTime,
+        if(t.updateName is not null, t.updateName, t.createName) as updateName,
+        if(t.updateTime is not null, t.updateTime, t.createTime) as updateTime
+        from
+        (
+        select
+        teea.id, teea.code, teea.exam_id as examId, teea.prepare_seconds as prepareSeconds, teea.max_duration_seconds as
+        maxDurationSeconds, teea.enable, teea.opening_seconds as openingSeconds, teea.start_time as startTime,
+        teea.finish_time as finishTime, teea.create_time as createTime, teea.update_time as updateTime,(
+        select
+        t1.name
+        from
+        t_b_user t1
+        where
+        t1.id = teea.create_id) as createName, (
+        select
+        t1.name
+        from
+        t_b_user t1
+        where
+        t1.id = teea.update_id) as updateName
+        from t_e_exam_activity teea
         left join t_e_exam tee on teea.exam_id = tee.id
         <where>
             <if test="examId != null and examId != ''">
@@ -75,7 +105,7 @@
             <if test="finishDate != null and finishDate != ''">
                 and teea.finish_time = #{finishDate}
             </if>
-        </where>
+        </where> ) t order by t.code
     </select>
 
     <select id="getWaitingExam" resultType="com.qmth.themis.business.dto.response.TEExamActivityDto">