luohairen
2024-11-13 12b7bf2629926c8acbd451f48aa815a2fb59fa50
优化错题详情
4个文件已修改
28 ■■■■ 已修改文件
src/main/java/com/ycl/jxkg/controller/student/ExamPaperAnswerController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/domain/vo/student/wrong/CheckWrongVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/ExamPaperScoreMapper.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ExamPaperScoreMapper.xml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/student/ExamPaperAnswerController.java
@@ -16,6 +16,7 @@
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.wrong.CheckWrongVO;
import com.ycl.jxkg.mapper.ExamPaperMapper;
import com.ycl.jxkg.mapper.ExamPaperScoreMapper;
import com.ycl.jxkg.service.ExamPaperScoreService;
import com.ycl.jxkg.service.ExamPaperService;
@@ -43,6 +44,7 @@
    private final SubjectService subjectService;
    private final ApplicationEventPublisher eventPublisher;
    private final ExamPaperScoreMapper examPaperScoreMapper;
    private final ExamPaperMapper examPaperMapper;
    @RequestMapping(value = "/pageList", method = RequestMethod.POST)
@@ -114,6 +116,10 @@
                .eq(ExamPaperScore::getExamId, model.getExamId())
                .eq(ExamPaperScore::getUserId, getCurrentUser().getId())
                .one();
//        model.setUserId(getCurrentUser().getId());
//        ExamPaperScore examPaperScore = examPaperScoreMapper.checkWrong(model);
        ExamPaperScore examPaperScore = examPaperScoreService.getById(info.getId());
        ExamPaperScoreVO examPaperScoreVO = new ExamPaperScoreVO();
        BeanUtils.copyProperties(examPaperScore, examPaperScoreVO);
src/main/java/com/ycl/jxkg/domain/vo/student/wrong/CheckWrongVO.java
@@ -8,6 +8,7 @@
@AllArgsConstructor
@NoArgsConstructor
public class CheckWrongVO {
    private Integer userId;
    private Integer examId;
    private Integer questionType;
    private Integer questionId;
src/main/java/com/ycl/jxkg/mapper/ExamPaperScoreMapper.java
@@ -8,11 +8,13 @@
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.domain.vo.student.wrong.CheckWrongVO;
import com.ycl.jxkg.domain.vo.student.wrong.WrongRequestVo;
import com.ycl.jxkg.domain.vo.student.wrong.WrongResponseVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
@@ -37,5 +39,6 @@
    List<ExamPaperScore> selectByUserId(Integer userId);
    List<WrongResponseVO> selectWrong(WrongRequestVo wrongRequestVo);
    ExamPaperScore checkWrong(@Valid CheckWrongVO model);
}
src/main/resources/mapper/ExamPaperScoreMapper.xml
@@ -176,7 +176,19 @@
        from t_exam_paper_score
        where user_id = #{userId}
    </select>
    <select id="selectWrong" resultType="com.ycl.jxkg.domain.vo.student.wrong.WrongResponseVO">
    <select id="checkWrong" resultType="com.ycl.jxkg.domain.entity.ExamPaperScore">
        SELECT
            <include refid="Base_Column_List"/>
        from t_exam_paper_score AS eps,
             JSON_TABLE(paper_content, '$[*]' COLUMNS(
                 questionType INT PATH '$.questionType',
                 questionId INT PATH '$.questionList[*].questionId'
        )) AS pc
        <where>
            eps.exam_id = #{examId}
            AND eps.user_id = #{userId}
            AND pc.questionType = #{questionType}
            AND pc.questionId = #{questionId}
        </where>
    </select>
</mapper>