feat(exam): 添加学生考试历史结果查看功能
- 新增接口获取指定学生的历史考试结果列表 - 数据库层新增根据学生ID查询历史考试记录的查询方法 - 服务层新增获取学生历史考试结果列表的实现 - 前端api新增调用学生考试历史接口的方法 - 学生详情页增加考试历史记录图表展示板块 - 新增考试历史折线图组件,展示正确词数和错误词数的时间变化 - 使用echarts实现折线图并支持点击显示详情 - 更新项目依赖,新增echarts库用于图表展示
This commit is contained in:
@@ -141,4 +141,22 @@ public class ExamWordsController {
|
||||
|
||||
return Response.success(examWordsDetailResultRspVO);
|
||||
}
|
||||
|
||||
@PostMapping("student/history")
|
||||
@ApiOperationLog(description = "获取学生历史考试结果")
|
||||
Response<List<FindStudentExamWordsResultListRspVO>> getStudentExamWordsResultList(@RequestBody FindStudentExamWordsResultReqVO findStudentExamWordsResultReqVO) {
|
||||
Integer studentId = findStudentExamWordsResultReqVO.getStudentId();
|
||||
List<FindStudentExamWordsResultListRspVO> list = examWordsJudgeService.getStudentExamWordsResultList(studentId).stream().map(examWordsJudgeResultDO -> FindStudentExamWordsResultListRspVO.builder()
|
||||
.id(examWordsJudgeResultDO.getId())
|
||||
.studentId(examWordsJudgeResultDO.getStudentId())
|
||||
.examWordsId(examWordsJudgeResultDO.getExamWordsId())
|
||||
.correctWordCount(examWordsJudgeResultDO.getCorrectWordCount())
|
||||
.wrongWordCount(examWordsJudgeResultDO.getWrongWordCount())
|
||||
.startDate(examWordsJudgeResultDO.getStartDate())
|
||||
.accuracy((double)examWordsJudgeResultDO.getCorrectWordCount() / (examWordsJudgeResultDO.getCorrectWordCount() + examWordsJudgeResultDO.getWrongWordCount()))
|
||||
.build()
|
||||
).toList();
|
||||
|
||||
return Response.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,6 @@ public interface ExamWordsJudgeResultDOMapper {
|
||||
Integer selectCount();
|
||||
|
||||
ExamWordsJudgeResultDO selectDetailById(@Param("id") Integer id);
|
||||
|
||||
List<ExamWordsJudgeResultDO> selectByStudentId(@Param("studentId") Integer studentId);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yinlihupo.enlish.service.model.vo.exam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Builder
|
||||
public class FindStudentExamWordsResultListRspVO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer studentId;
|
||||
|
||||
private Integer examWordsId;
|
||||
|
||||
private Integer correctWordCount;
|
||||
|
||||
private Integer wrongWordCount;
|
||||
|
||||
private Double accuracy;
|
||||
|
||||
private LocalDateTime startDate;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.yinlihupo.enlish.service.model.vo.exam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Builder
|
||||
public class FindStudentExamWordsResultReqVO {
|
||||
|
||||
private Integer studentId;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.yinlihupo.enlish.service.service;
|
||||
|
||||
import com.yinlihupo.enlish.service.domain.dataobject.ExamWordsJudgeResultDO;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public interface ExamWordsJudgeService {
|
||||
@@ -13,4 +14,6 @@ public interface ExamWordsJudgeService {
|
||||
Integer getExamWordsJudgeResultCount();
|
||||
|
||||
ExamWordsJudgeResultDO getExamWordsJudgeResultDOById(Integer id);
|
||||
|
||||
List<ExamWordsJudgeResultDO> getStudentExamWordsResultList(Integer studentId);
|
||||
}
|
||||
|
||||
@@ -144,4 +144,9 @@ public class ExamWordsJudgeServiceImpl implements ExamWordsJudgeService {
|
||||
public ExamWordsJudgeResultDO getExamWordsJudgeResultDOById(Integer id) {
|
||||
return examWordsJudgeResultDOMapper.selectDetailById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamWordsJudgeResultDO> getStudentExamWordsResultList(Integer studentId) {
|
||||
return examWordsJudgeResultDOMapper.selectByStudentId(studentId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,5 +66,12 @@
|
||||
from exam_words_judge_result
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectByStudentId" resultMap="BaseResultMap">
|
||||
select *
|
||||
from exam_words_judge_result
|
||||
where student_id = #{studentId}
|
||||
order by start_date desc
|
||||
limit 500;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user