From 24c9d860ced4d058b866a9fb548a8ef1d1412c20 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期一, 06 五月 2024 18:04:10 +0800 Subject: [PATCH] 新增标签菜单添加、查询、删除、修改,学生绑定、展示、修改 --- src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java | 45 +++++++++++++++++++++++++++++++++++++++------ 1 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java index 57637ed..eedd73f 100644 --- a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java +++ b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java @@ -1,14 +1,16 @@ package com.mindskip.xzs.service.impl; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.mindskip.xzs.domain.*; import com.mindskip.xzs.domain.enums.ExamPaperAnswerStatusEnum; import com.mindskip.xzs.domain.enums.ExamPaperTypeEnum; import com.mindskip.xzs.domain.enums.QuestionTypeEnum; import com.mindskip.xzs.domain.exam.ExamPaperTitleItemObject; -import com.mindskip.xzs.domain.other.KeyValue; import com.mindskip.xzs.domain.other.ExamPaperAnswerUpdate; +import com.mindskip.xzs.domain.other.KeyValue; import com.mindskip.xzs.domain.task.TaskItemAnswerObject; -import com.mindskip.xzs.repository.*; +import com.mindskip.xzs.domain.vo.ScoreTemplatesCountVO; import com.mindskip.xzs.repository.ExamPaperAnswerMapper; import com.mindskip.xzs.repository.ExamPaperMapper; import com.mindskip.xzs.repository.QuestionMapper; @@ -19,12 +21,11 @@ import com.mindskip.xzs.utility.DateTimeUtil; import com.mindskip.xzs.utility.ExamUtil; import com.mindskip.xzs.utility.JsonUtil; +import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradePageRequestVM; +import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradeQuery; import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM; import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitVM; import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.mindskip.xzs.domain.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -220,13 +221,17 @@ QuestionTypeEnum questionTypeEnum = QuestionTypeEnum.fromCode(examPaperQuestionCustomerAnswer.getQuestionType()); switch (questionTypeEnum) { case SingleChoice: + examPaperQuestionCustomerAnswer.setAnswer(customerQuestionAnswer.getContent()); + examPaperQuestionCustomerAnswer.setDoRight(question.getCorrect().equals(customerQuestionAnswer.getContent())); + examPaperQuestionCustomerAnswer.setCustomerScore(examPaperQuestionCustomerAnswer.getDoRight() ? question.getScore() : 0); + break; case TrueFalse: examPaperQuestionCustomerAnswer.setAnswer(customerQuestionAnswer.getContent()); examPaperQuestionCustomerAnswer.setDoRight(question.getCorrect().equals(customerQuestionAnswer.getContent())); examPaperQuestionCustomerAnswer.setCustomerScore(examPaperQuestionCustomerAnswer.getDoRight() ? question.getScore() : 0); break; case MultipleChoice: - String customerAnswer = ExamUtil.contentToString(customerQuestionAnswer.getContentArray()); + String customerAnswer = customerQuestionAnswer.getContent() ==null ? ExamUtil.contentToString(customerQuestionAnswer.getContentArray()) : customerQuestionAnswer.getContent(); examPaperQuestionCustomerAnswer.setAnswer(customerAnswer); examPaperQuestionCustomerAnswer.setDoRight(customerAnswer.equals(question.getCorrect())); examPaperQuestionCustomerAnswer.setCustomerScore(examPaperQuestionCustomerAnswer.getDoRight() ? question.getScore() : 0); @@ -280,4 +285,32 @@ public ExamPaperAnswer getById(Integer id) { return examPaperAnswerMapper.getById(id); } + + @Override + public List<ExamPaperAnswer> selectByPaperName(String paperName) { + return examPaperAnswerMapper.selectByPaperName(paperName); + } + + @Override + public List<ExamPaperAnswer> getByExamPaperIdAndUserId(List<ExamTemplatesUserCount> examTemplatesUserCount) { + return examPaperAnswerMapper.getByExamPaperIdAndUserId(examTemplatesUserCount); + } + + @Override + public PageInfo<ExamPaperAnswer> adminPageByGrade(ExamPaperGradePageRequestVM grade) { + return PageHelper.startPage(grade.getPageIndex(), grade.getPageSize(), "id desc").doSelectPageInfo(() -> + examPaperAnswerMapper.adminPageByGrade(grade)); + } + + @Override + public List<ExamPaperAnswer> getByScorePaperIdAndUserId(List<ScoreTemplatesUserCount> scoreTemplatesUserCounts) { + return examPaperAnswerMapper.getByScorePaperIdAndUserId(scoreTemplatesUserCounts); + } + + @Override + public PageInfo<ExamPaperAnswer> getByCreatUser(ExamPaperGradeQuery query) { + query.setFullTime(); + return PageHelper.startPage(query.getPageIndex(), query.getPageSize(), "id desc").doSelectPageInfo(() -> + examPaperAnswerMapper.getByCreatUser(query)); + } } -- Gitblit v1.8.0