From f18c0b3336a10bc36a9e5ca34a03b6d19c34569b Mon Sep 17 00:00:00 2001 From: luohairen <3399054449@qq.com> Date: 星期二, 12 十一月 2024 22:43:01 +0800 Subject: [PATCH] 优化错题详情 --- src/main/java/com/ycl/jxkg/service/impl/ExamPaperScoreServiceImpl.java | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/ycl/jxkg/service/impl/ExamPaperScoreServiceImpl.java b/src/main/java/com/ycl/jxkg/service/impl/ExamPaperScoreServiceImpl.java index 0956744..06049e7 100644 --- a/src/main/java/com/ycl/jxkg/service/impl/ExamPaperScoreServiceImpl.java +++ b/src/main/java/com/ycl/jxkg/service/impl/ExamPaperScoreServiceImpl.java @@ -1,16 +1,20 @@ package com.ycl.jxkg.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.ycl.jxkg.base.Result; import com.ycl.jxkg.domain.ExamPaperAnswerInfo; import com.ycl.jxkg.domain.entity.*; import com.ycl.jxkg.domain.other.KeyValue; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO; +import com.ycl.jxkg.domain.vo.admin.paper.UserAnswerPageRequestVO; import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitItemVO; import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitVO; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageVO; +import com.ycl.jxkg.domain.vo.student.exampaper.UserAnswerPageResponseVO; import com.ycl.jxkg.enums.ExamPaperTypeEnum; import com.ycl.jxkg.enums.QuestionTypeEnum; import com.ycl.jxkg.mapper.ExamPaperMapper; @@ -27,6 +31,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -192,7 +197,7 @@ examPaperScoreDetail.setQuestionId(question.getId()); examPaperScoreDetail.setExamPaperId(examPaper.getId()); examPaperScoreDetail.setQuestionScore(null); - examPaperScoreDetail.setSubjectId(examPaper.getSubjectId()); +// examPaperScoreDetail.setSubjectId(examPaper.getSubjectId()); examPaperScoreDetail.setItemOrder(itemOrder); examPaperScoreDetail.setCreateTime(now); examPaperScoreDetail.setCreateUser(user.getId()); @@ -284,4 +289,28 @@ return PageHelper.startPage(model.getPageIndex(), model.getPageSize()).doSelectPageInfo(() -> examPaperScoreMapper.pageExamPaper(model)); } + + @Override + public PageInfo<UserAnswerPageResponseVO> pageUser(UserAnswerPageRequestVO model) { + return PageHelper.startPage(model.getPageIndex(), model.getPageSize()).doSelectPageInfo(() -> + examPaperScoreMapper.pageUser(model)); + } + + @Override + public Result queryMaxAndMinScore(Integer id) { + List<ExamPaperScore> list = new ArrayList<>(); + ExamPaperScore max = examPaperScoreMapper.selectOne(new LambdaQueryWrapper<>(ExamPaperScore.class) + .eq(ExamPaperScore::getExamId, id) + .orderByDesc(ExamPaperScore::getTotalScore) + .last("limit 1")); + list.add(max); + if (null != max) { + ExamPaperScore min = examPaperScoreMapper.selectOne(new LambdaQueryWrapper<>(ExamPaperScore.class) + .eq(ExamPaperScore::getExamId, id) + .orderByAsc(ExamPaperScore::getTotalScore) + .last("limit 1")); + list.add(min); + } + return Result.ok(list); + } } -- Gitblit v1.8.0