Commit b000eb91 by Wangmin

答题记录新增图片答案,考试试题新增图片答案

parent 121c85e3
...@@ -20,12 +20,12 @@ import java.math.BigDecimal; ...@@ -20,12 +20,12 @@ import java.math.BigDecimal;
@TableName("db_test_paper_record_detail") @TableName("db_test_paper_record_detail")
public class DbTestPaperRecordDetail extends BaseEntity { public class DbTestPaperRecordDetail extends BaseEntity {
private static final long serialVersionUID=1L; private static final long serialVersionUID = 1L;
/** /**
* 主键id * 主键id
*/ */
@TableId(value = "id",type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
/** /**
* 记录id * 记录id
...@@ -39,6 +39,11 @@ public class DbTestPaperRecordDetail extends BaseEntity { ...@@ -39,6 +39,11 @@ public class DbTestPaperRecordDetail extends BaseEntity {
* 答案 * 答案
*/ */
private String answer; private String answer;
/**
* 图片答案
*/
private String answersPic;
/** /**
* 正确答案 * 正确答案
*/ */
......
...@@ -24,4 +24,9 @@ public class TestPaperAnswerItemBo implements Serializable { ...@@ -24,4 +24,9 @@ public class TestPaperAnswerItemBo implements Serializable {
* 学生答题内容 * 学生答题内容
*/ */
private String answer; private String answer;
/**
* 学生答题内容(图片)
*/
private String answerPic;
} }
...@@ -45,6 +45,11 @@ public class DbTestPaperRecordDetailVo { ...@@ -45,6 +45,11 @@ public class DbTestPaperRecordDetailVo {
*/ */
@ExcelProperty(value = "答案") @ExcelProperty(value = "答案")
private String answer; private String answer;
/**
* 图片答案
*/
@ExcelProperty(value = "答案")
private String answerPic;
/** /**
* 正确答案 * 正确答案
......
...@@ -29,6 +29,16 @@ public class TestQuestionItemVo { ...@@ -29,6 +29,16 @@ public class TestQuestionItemVo {
private String answer; private String answer;
/** /**
* 我的答案(图片)
*/
private String answerPic;
/**
* 题目类型 1填空,2选择,3解答
*/
private Integer species;
/**
* 选择题选项 * 选择题选项
*/ */
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
......
...@@ -94,7 +94,7 @@ public class TestPaperServiceImpl implements ITestPaperService { ...@@ -94,7 +94,7 @@ public class TestPaperServiceImpl implements ITestPaperService {
// 若传入了本题的结果,则先将结果存入Redis中 // 若传入了本题的结果,则先将结果存入Redis中
if (CollUtil.isNotEmpty(request.getAnswers())) { if (CollUtil.isNotEmpty(request.getAnswers())) {
request.getAnswers().forEach(answer -> { request.getAnswers().forEach(answer -> {
Objects.requireNonNull(answer.getId(),"题目ID非法"); Objects.requireNonNull(answer.getId(), "题目ID非法");
String key = String.format(TEST_PAPER_ANSWER_KEY_FORMAT, TEST_PAPER_ANSWER_KEY, request.getRecordId(), answer.getId()); String key = String.format(TEST_PAPER_ANSWER_KEY_FORMAT, TEST_PAPER_ANSWER_KEY, request.getRecordId(), answer.getId());
RedisUtils.setCacheObject(key, answer); RedisUtils.setCacheObject(key, answer);
}); });
...@@ -108,6 +108,7 @@ public class TestPaperServiceImpl implements ITestPaperService { ...@@ -108,6 +108,7 @@ public class TestPaperServiceImpl implements ITestPaperService {
TestPaperAnswerItemBo cacheObject = RedisUtils.getCacheObject(key); TestPaperAnswerItemBo cacheObject = RedisUtils.getCacheObject(key);
Optional.ofNullable(cacheObject).ifPresent(cache -> { Optional.ofNullable(cacheObject).ifPresent(cache -> {
question.setAnswer(cache.getAnswer()); question.setAnswer(cache.getAnswer());
question.setAnswerPic(cache.getAnswerPic());
}); });
}); });
return result; return result;
...@@ -139,6 +140,7 @@ public class TestPaperServiceImpl implements ITestPaperService { ...@@ -139,6 +140,7 @@ public class TestPaperServiceImpl implements ITestPaperService {
TestPaperAnswerItemBo cacheObject = RedisUtils.getCacheObject(key); TestPaperAnswerItemBo cacheObject = RedisUtils.getCacheObject(key);
Optional.ofNullable(cacheObject).ifPresent(cache -> { Optional.ofNullable(cacheObject).ifPresent(cache -> {
buffer.setAnswer(cache.getAnswer()); buffer.setAnswer(cache.getAnswer());
buffer.setAnswersPic(cache.getAnswerPic());
}); });
// 计算选择题分数 // 计算选择题分数
DbQuestionBankTestPaperVo bankTestPaperVo = bankTestPaperService.queryById(question.getId()); DbQuestionBankTestPaperVo bankTestPaperVo = bankTestPaperService.queryById(question.getId());
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<resultMap id="TestPaper" type="com.ruoyi.school.paper.domain.vo.TestQuestionItemVo"> <resultMap id="TestPaper" type="com.ruoyi.school.paper.domain.vo.TestQuestionItemVo">
<id property="id" column="id"/> <id property="id" column="id"/>
<result property="topic" column="topic"/> <result property="topic" column="topic"/>
<result property="species" column="species"/>
<collection property="options" column="id" ofType="com.ruoyi.school.paper.domain.vo.OptionsVo" select="selectOptions"> <collection property="options" column="id" ofType="com.ruoyi.school.paper.domain.vo.OptionsVo" select="selectOptions">
<result property="optionTag" column="option_tag"/> <result property="optionTag" column="option_tag"/>
<result property="optionContent" column="option_content"/> <result property="optionContent" column="option_content"/>
...@@ -42,7 +43,8 @@ ...@@ -42,7 +43,8 @@
<select id="selectTestPaperQuestion" resultMap="TestPaper"> <select id="selectTestPaperQuestion" resultMap="TestPaper">
select question_bank.id, select question_bank.id,
question_bank.topic question_bank.topic,
question_bank.species
from db_test_paper_record as answer_sheet from db_test_paper_record as answer_sheet
join db_question_bank_test_paper as question_bank join db_question_bank_test_paper as question_bank
on answer_sheet.test_paper_id = question_bank.test_paper_id on answer_sheet.test_paper_id = question_bank.test_paper_id
......
...@@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.ruoyi.school.paper.domain.vo.DbTestPaperRecordDetailVo" id="TestPaperRecordDetailResult"> <resultMap type="com.ruoyi.school.paper.domain.vo.DbTestPaperRecordDetailVo" id="TestPaperRecordDetailResult">
<result property="topic" column="topic"/> <result property="topic" column="topic"/>
<result property="answer" column="answer"/> <result property="answer" column="answer"/>
<result property="answerPic" column="answers_pic"/>
<result property="score" column="score"/> <result property="score" column="score"/>
<result property="correctAnswer" column="correctAnswer"/> <result property="correctAnswer" column="correctAnswer"/>
<result property="righAnswersPic" column="right_answers_pic"/> <result property="righAnswersPic" column="right_answers_pic"/>
...@@ -40,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -40,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dqbatp.right_answers as correctAnswer, dqbatp.right_answers as correctAnswer,
dqbatp.right_answers_pic, dqbatp.right_answers_pic,
dtprd.answer, dtprd.answer,
dtprd.answers_pic,
dtprd.score, dtprd.score,
d.option_tag, d.option_tag,
d.option_content, d.option_content,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment