feat(exam): 添加按班级、年级、学生姓名筛选考试结果功能
- 在ExamWordsResultReqVO中新增classId、gradeId、studentName字段 - 修改ExamWordsJudgeService接口及实现,支持按筛选条件获取考试结果 - 在ExamWordsJudgeResultDOMapper中添加按学生ID列表分页查询方法 - 扩展StudentDOMapper,新增按班级、年级和姓名查询学生列表方法 - 修改ExamWordsController,支持从请求体接收筛选参数 - 修改前端exam.js,调用接口时传递筛选参数 - 在uploadpng.vue页面新增筛选表单,支持班级、年级、学生姓名输入 - 增加班级和年级选项数据的获取 - 实现筛选查询、重置功能及班级切换自动同步年级 - 在App.vue中配置Element Plus中文语言环境 - 调整配置文件,更新学习计划模板路径 - 修改接口权限配置,关闭plan/word/voice路径的鉴权
This commit is contained in:
@@ -25,9 +25,11 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
|
||||
SaRouter.match("/**")
|
||||
.notMatch("/login/**")
|
||||
.notMatch("plan/word/voice")
|
||||
.check(r -> StpUtil.checkLogin());
|
||||
|
||||
SaRouter.match("/admin/**")
|
||||
.notMatch("plan/word/voice")
|
||||
.check(r -> StpUtil.checkRole("root"));
|
||||
|
||||
}))
|
||||
|
||||
@@ -107,8 +107,11 @@ public class ExamWordsController {
|
||||
PageResponse<ExamWordsResultRspVO> getExamWordsResult(@RequestBody ExamWordsResultReqVO examWordsResultReqVO) {
|
||||
Integer page = examWordsResultReqVO.getPage();
|
||||
Integer size = examWordsResultReqVO.getSize();
|
||||
Integer classId = examWordsResultReqVO.getClassId();
|
||||
Integer gradeId = examWordsResultReqVO.getGradeId();
|
||||
String studentName = examWordsResultReqVO.getStudentName();
|
||||
Integer total = examWordsJudgeService.getExamWordsJudgeResultCount();
|
||||
List<ExamWordsJudgeResultDO> examWordsJudgeResult = examWordsJudgeService.getExamWordsJudgeResult(page, size);
|
||||
List<ExamWordsJudgeResultDO> examWordsJudgeResult = examWordsJudgeService.getExamWordsJudgeResult(page, size, classId, gradeId, studentName);
|
||||
List<ExamWordsResultRspVO> list = examWordsJudgeResult.stream().map(examWordsJudgeResultDO -> ExamWordsResultRspVO
|
||||
.builder()
|
||||
.id(examWordsJudgeResultDO.getId())
|
||||
|
||||
@@ -24,4 +24,6 @@ public interface ExamWordsJudgeResultDOMapper {
|
||||
List<ExamWordsJudgeResultDO> selectByStudentId(@Param("studentId") Integer studentId);
|
||||
|
||||
List<ExamWordsJudgeResultDO> selectByStudentIdAndLimitTime(@Param("studentId") Integer studentId);
|
||||
|
||||
List<ExamWordsJudgeResultDO> selectByPageAndStudentIds(@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize, @Param("studentIds") List<Integer> studentIds);
|
||||
}
|
||||
@@ -23,4 +23,10 @@ public interface StudentDOMapper {
|
||||
int selectStudentCountByClassId(@Param("classId") Integer classId);
|
||||
|
||||
int updateStudentActualGradeId(@Param("studentId") Integer studentId, @Param("gradeId") Integer gradeId);
|
||||
|
||||
List<StudentDO> selectStudentDOListByClassId(@Param("classId") Integer classId);
|
||||
|
||||
List<StudentDO> selectStudentDOListByGradeId(@Param("gradeId") Integer gradeId);
|
||||
|
||||
List<StudentDO> selectStudentDOListByName(@Param("name") String name);
|
||||
}
|
||||
@@ -13,4 +13,8 @@ public class ExamWordsResultReqVO {
|
||||
|
||||
private Integer page;
|
||||
private Integer size;
|
||||
|
||||
private Integer classId;
|
||||
private Integer gradeId;
|
||||
private String studentName;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.yinlihupo.enlish.service.model.vo.student;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -16,5 +17,6 @@ public class AddStudentReqVO {
|
||||
private String name;
|
||||
private Integer classId;
|
||||
private Integer gradeId;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ public interface ExamWordsJudgeService {
|
||||
|
||||
void judgeExamWords(int count);
|
||||
|
||||
List<ExamWordsJudgeResultDO> getExamWordsJudgeResult(Integer page, Integer pageSize);
|
||||
List<ExamWordsJudgeResultDO> getExamWordsJudgeResult(Integer page, Integer pageSize, Integer classId, Integer gradeId, String studentName);
|
||||
|
||||
Integer getExamWordsJudgeResultCount();
|
||||
|
||||
|
||||
@@ -326,8 +326,24 @@ public class ExamWordsJudgeServiceImpl implements ExamWordsJudgeService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamWordsJudgeResultDO> getExamWordsJudgeResult(Integer page, Integer pageSize) {
|
||||
return examWordsJudgeResultDOMapper.selectByPage((page - 1) * pageSize, pageSize);
|
||||
public List<ExamWordsJudgeResultDO> getExamWordsJudgeResult(Integer page, Integer pageSize, Integer classId, Integer gradeId, String studentName) {
|
||||
|
||||
List<Integer> studentIds = new ArrayList<>();
|
||||
if (classId != null) {
|
||||
studentIds.addAll(studentDOMapper.selectStudentDOListByClassId(classId).stream().map(StudentDO::getId).toList());
|
||||
}
|
||||
if (gradeId != null) {
|
||||
studentIds.addAll(studentDOMapper.selectStudentDOListByGradeId(gradeId).stream().map(StudentDO::getId).toList());
|
||||
}
|
||||
if (!studentName.isEmpty()) {
|
||||
studentIds.addAll(studentDOMapper.selectStudentDOListByName(studentName).stream().map(StudentDO::getId).toList());
|
||||
}
|
||||
|
||||
if (studentIds.isEmpty()) {
|
||||
return examWordsJudgeResultDOMapper.selectByPage((page - 1) * pageSize, pageSize);
|
||||
} else {
|
||||
return examWordsJudgeResultDOMapper.selectByPageAndStudentIds((page - 1) * pageSize, page * pageSize, studentIds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ templates:
|
||||
count: 100
|
||||
data: C:\project\tess
|
||||
plan:
|
||||
weekday: C:\project\java\enlish_edu\enlish\enlish-service\src\main\resources\templates\tem_study_plan_v5.docx
|
||||
weekday: C:\project\java\enlish_edu\enlish\enlish-service\src\main\resources\templates\tem_study_plan_v6.docx
|
||||
weekend: C:\project\java\enlish_edu\enlish\enlish-service\src\main\resources\templates\study_plan_review_v2.docx
|
||||
plan_day: 7
|
||||
tmp:
|
||||
|
||||
@@ -83,4 +83,16 @@
|
||||
and start_date between date_sub(now(), interval 7 day) and now()
|
||||
</select>
|
||||
|
||||
<select id="selectByPageAndStudentIds" resultMap="BaseResultMap">
|
||||
select *
|
||||
from exam_words_judge_result
|
||||
where student_id in
|
||||
<foreach item="item" index="index" collection="studentIds"
|
||||
open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by start_date
|
||||
limit #{startIndex}, #{pageSize}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -75,4 +75,24 @@
|
||||
where class_id = #{classId}
|
||||
and is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectStudentDOListByClassId" resultMap="BaseResultMap">
|
||||
select *
|
||||
from student
|
||||
where class_id = #{classId}
|
||||
and is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectStudentDOListByGradeId" resultMap="BaseResultMap">
|
||||
select *
|
||||
from student
|
||||
where grade_id = #{gradeId}
|
||||
and is_deleted = 0
|
||||
</select>
|
||||
<select id="selectStudentDOListByName" resultMap="BaseResultMap">
|
||||
select *
|
||||
from student
|
||||
where name like concat('%', #{name}, '%')
|
||||
and is_deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
Binary file not shown.
@@ -56,8 +56,8 @@ public class ExamWordsJudgeServiceTest {
|
||||
|
||||
@Test
|
||||
public void selectExamWordsJudgeResult() {
|
||||
List<ExamWordsJudgeResultDO> examWordsJudgeResult = examWordsJudgeService.getExamWordsJudgeResult(1, 10);
|
||||
log.info("examWordsJudgeResult:{}", examWordsJudgeResult);
|
||||
// List<ExamWordsJudgeResultDO> examWordsJudgeResult = examWordsJudgeService.getExamWordsJudgeResult(1, 10);
|
||||
// log.info("examWordsJudgeResult:{}", examWordsJudgeResult);
|
||||
}
|
||||
|
||||
// @Test
|
||||
|
||||
Reference in New Issue
Block a user