Commit f4011a95 authored by 陈立彬's avatar 陈立彬

重复答题清除原答题结果

parent 0289cb74
...@@ -263,12 +263,7 @@ public class ExamController { ...@@ -263,12 +263,7 @@ public class ExamController {
// 更新之前考试过的题目 // 更新之前考试过的题目
ElehSessionQaRecordDo recordDo = qaRecordMapper.selectQaRecord(tenant, sessionId, userId, questionId); ElehSessionQaRecordDo recordDo = qaRecordMapper.selectQaRecord(tenant, sessionId, userId, questionId);
if(Objects.nonNull(recordDo)) { if(Objects.nonNull(recordDo)) {
ElehSessionQaRecordDo update = new ElehSessionQaRecordDo(); qaRecordMapper.clearById(recordDo.getId());
update.setAnswer("");
update.setScoreCriteria("");
update.setScore(null);
update.setId(recordDo.getId());
qaRecordMapper.updateById(update);
} }
log.info("PUT REDIS KEY = {}, REDIS VALUE = {}", redisKey, JSONObject.toJSONString(qa)); log.info("PUT REDIS KEY = {}, REDIS VALUE = {}", redisKey, JSONObject.toJSONString(qa));
......
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@Mapper @Mapper
public interface ElehSessionQaRecordMapper extends BaseMapper<ElehSessionQaRecordDo> { public interface ElehSessionQaRecordMapper extends BaseMapper<ElehSessionQaRecordDo> {
...@@ -20,4 +21,7 @@ public interface ElehSessionQaRecordMapper extends BaseMapper<ElehSessionQaRecor ...@@ -20,4 +21,7 @@ public interface ElehSessionQaRecordMapper extends BaseMapper<ElehSessionQaRecor
@Select(value = "select * from eleh_session_qa_record where tenant = #{tenant} and session_id = #{sessionId} and user_id = #{userId} and type = 1 order by created_at desc limit 1") @Select(value = "select * from eleh_session_qa_record where tenant = #{tenant} and session_id = #{sessionId} and user_id = #{userId} and type = 1 order by created_at desc limit 1")
ElehSessionQaRecordDo selectExamResult(@Param("tenant") Integer tenant, @Param("sessionId") String sessionId, @Param("userId") String userId); ElehSessionQaRecordDo selectExamResult(@Param("tenant") Integer tenant, @Param("sessionId") String sessionId, @Param("userId") String userId);
@Update(value = "update eleh_session_qa_record set answer = '',score_criteria='',score=null where id = #{id}")
int clearById(@Param("id") Long id);
} }
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