dev-tmp1
luotaiqian 2026-08-19 17:24:39 +08:00
parent 81e03460f7
commit 6acb1a44d7
3 changed files with 6 additions and 10 deletions

View File

@ -20,6 +20,7 @@ import org.qinan.cedu.model.entity.PaperQuestionRelDO;
import org.qinan.cedu.model.entity.QuestionDO;
import org.qinan.cedu.model.entity.QuestionOptionDO;
import org.qinan.cedu.service.PaperQuestionRelService;
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -81,9 +82,7 @@ public class PaperQuestionRelServiceImpl extends ServiceImpl<PaperQuestionRelMap
.map(option -> String.valueOf(option.getId()))
.collect(Collectors.joining(",")));
question.setCreateTime(now);
question.setUpdateTime(now);
question.setVersion(0);
InsertFieldDefaults.applyIgnoreOrgId(question);
questionMapper.insert(question);
Db.saveBatch(options);
@ -91,8 +90,7 @@ public class PaperQuestionRelServiceImpl extends ServiceImpl<PaperQuestionRelMap
PaperQuestionRelDO rel = new PaperQuestionRelDO();
rel.setPaperId(dto.getPaperId());
rel.setQuestionId(question.getId());
rel.setCreateTime(now);
rel.setUpdateTime(now);
InsertFieldDefaults.applyIgnoreOrgId(rel);
this.save(rel);
}
@ -114,9 +112,7 @@ public class PaperQuestionRelServiceImpl extends ServiceImpl<PaperQuestionRelMap
option.setOptionKey(key);
option.setOptionName(key);
option.setSortOrder(sortOrder++);
option.setCreateTime(now);
option.setUpdateTime(now);
option.setVersion(0);
InsertFieldDefaults.applyIgnoreOrgId(option);
}
return options;
}

View File

@ -54,7 +54,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionDO>
public QuestionVO find(Long questionId) {
QuestionVO questionVO = this.baseMapper.findQuestion(questionId);
if (questionVO == null) {
throw new IllegalArgumentException("试题不存在id=" + questionId);
throw new IllegalArgumentException("试题不存在");
}
// 查询选项信息仅查询VO需要的字段
List<QuestionOptionDO> options = questionOptionService.lambdaQuery()

View File

@ -27,7 +27,7 @@
, q.analysis, q.tag_type, q.courseware_management_id
, cm.courseware_name AS coursewareManagementName
FROM question q
JOIN courseware_management cm ON q.courseware_management_id = cm.id
LEFT JOIN courseware_management cm ON q.courseware_management_id = cm.id
WHERE q.id = #{questionId}
AND q.delete_enum = 'false'
</select>