考试系统第一版

This commit is contained in:
haown 2025-07-16 10:10:04 +08:00
parent 9bac380c26
commit b9f2f6c2c4
5 changed files with 36 additions and 6 deletions

View File

@ -19,6 +19,7 @@ import com.yf.exam.modules.exam.mapper.ExamMapper;
import com.yf.exam.modules.exam.service.ExamDepartService;
import com.yf.exam.modules.exam.service.ExamRepoService;
import com.yf.exam.modules.exam.service.ExamService;
import com.yf.exam.modules.paper.enums.ExamType;
import java.time.LocalDate;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
@ -62,8 +63,13 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
this.calcScore(reqDTO);
if (reqDTO.getTimeLimit() && (reqDTO.getStartDate() == null || reqDTO.getEndDate() == null || reqDTO.getStartTime() == null || reqDTO.getEndTime() == null)) {
throw new ServiceException(1, "日期时间范围不能为空!");
}
// 复制基本数据
BeanUtils.copyProperties(reqDTO, entity);
if (reqDTO != null) {
BeanUtils.copyProperties(reqDTO, entity);
}
entity.setId(id);
// 修复状态
@ -98,7 +104,9 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
ExamSaveReqDTO respDTO = new ExamSaveReqDTO();
Exam exam = this.getById(id);
//BeanMapper.copy(exam, respDTO);
BeanUtils.copyProperties(exam, respDTO);
if (exam != null){
BeanUtils.copyProperties(exam, respDTO);
}
// 考试部门
List<String> departIds = examDepartService.listByExam(id);
@ -115,7 +123,9 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
public ExamDTO findById(String id) {
ExamDTO respDTO = new ExamDTO();
Exam exam = this.getById(id);
BeanUtils.copyProperties(exam, respDTO);
if (exam != null){
BeanUtils.copyProperties(exam, respDTO);
}
return respDTO;
}
@ -161,7 +171,9 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
*/
@Override
public List<ExamDTO> getExamList(ExamSearchDTO reqDTO) {
reqDTO.setExamType(ExamType.FORMAL);
reqDTO.setStartDate(LocalDate.now());
reqDTO.setEndDate(LocalDate.now());
List<ExamDTO> list = baseMapper.getExamList(reqDTO);
return list;
}

View File

@ -26,5 +26,11 @@ public class UserExamReqDTO extends UserExamDTO {
@ApiModelProperty(value = "人员名称", required=true)
private String realName;
/**
* 考试类型1模拟考试2正式考试
* */
@ApiModelProperty(value = "考试类型1模拟考试2正式考试", required=true)
private Integer examType;
}

View File

@ -23,6 +23,12 @@ public class UserExamRespDTO extends UserExamDTO {
@ApiModelProperty(value = "考试名称", required=true)
private String title;
/**
* 考试类型1模拟考试2正式考试
* */
@ApiModelProperty(value = "考试类型1模拟考试2正式考试", required=true)
private Integer examType;
@ApiModelProperty(value = "人员名称", required=true)
private String realName;

View File

@ -107,11 +107,14 @@
<if test="query.openType!=null">
AND open_type = #{query.openType}
</if>
<if test="query.examType!=null">
AND exam_type = #{query.examType}
</if>
<if test="query.startDate!=null">
AND start_date >= #{query.startDate}
AND start_date &lt;= #{query.startDate}
</if>
<if test="query.endDate!=null">
AND end_date &lt;= #{query.endDate}
AND end_date >= #{query.endDate}
</if>
</if>
</select>

View File

@ -29,7 +29,7 @@
<select id="paging" resultMap="ListResultMap">
SELECT ue.*,ee.title,uc.real_name FROM el_user_exam ue
SELECT ue.*,ee.title,ee.exam_type, uc.real_name FROM el_user_exam ue
LEFT JOIN el_exam ee ON ue.exam_id=ee.id
LEFT JOIN sys_user uc ON ue.user_id=uc.id
WHERE ee.id IS NOT NULL AND uc.id IS NOT NULL
@ -45,6 +45,9 @@
<if test="query.title!=null and query.title!=''">
AND ee.title LIKE CONCAT('%',#{query.title},'%')
</if>
<if test="query.examType!=null">
AND ee.exam_type = #{query.examType}
</if>
<if test="query.realName!=null and query.realName!=''">
AND uc.real_name LIKE CONCAT('%',#{query.realName},'%')
</if>