test
parent
81e03460f7
commit
6acb1a44d7
|
|
@ -20,6 +20,7 @@ import org.qinan.cedu.model.entity.PaperQuestionRelDO;
|
||||||
import org.qinan.cedu.model.entity.QuestionDO;
|
import org.qinan.cedu.model.entity.QuestionDO;
|
||||||
import org.qinan.cedu.model.entity.QuestionOptionDO;
|
import org.qinan.cedu.model.entity.QuestionOptionDO;
|
||||||
import org.qinan.cedu.service.PaperQuestionRelService;
|
import org.qinan.cedu.service.PaperQuestionRelService;
|
||||||
|
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
@ -81,9 +82,7 @@ public class PaperQuestionRelServiceImpl extends ServiceImpl<PaperQuestionRelMap
|
||||||
.map(option -> String.valueOf(option.getId()))
|
.map(option -> String.valueOf(option.getId()))
|
||||||
.collect(Collectors.joining(",")));
|
.collect(Collectors.joining(",")));
|
||||||
|
|
||||||
question.setCreateTime(now);
|
InsertFieldDefaults.applyIgnoreOrgId(question);
|
||||||
question.setUpdateTime(now);
|
|
||||||
question.setVersion(0);
|
|
||||||
questionMapper.insert(question);
|
questionMapper.insert(question);
|
||||||
Db.saveBatch(options);
|
Db.saveBatch(options);
|
||||||
|
|
||||||
|
|
@ -91,8 +90,7 @@ public class PaperQuestionRelServiceImpl extends ServiceImpl<PaperQuestionRelMap
|
||||||
PaperQuestionRelDO rel = new PaperQuestionRelDO();
|
PaperQuestionRelDO rel = new PaperQuestionRelDO();
|
||||||
rel.setPaperId(dto.getPaperId());
|
rel.setPaperId(dto.getPaperId());
|
||||||
rel.setQuestionId(question.getId());
|
rel.setQuestionId(question.getId());
|
||||||
rel.setCreateTime(now);
|
InsertFieldDefaults.applyIgnoreOrgId(rel);
|
||||||
rel.setUpdateTime(now);
|
|
||||||
this.save(rel);
|
this.save(rel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,9 +112,7 @@ public class PaperQuestionRelServiceImpl extends ServiceImpl<PaperQuestionRelMap
|
||||||
option.setOptionKey(key);
|
option.setOptionKey(key);
|
||||||
option.setOptionName(key);
|
option.setOptionName(key);
|
||||||
option.setSortOrder(sortOrder++);
|
option.setSortOrder(sortOrder++);
|
||||||
option.setCreateTime(now);
|
InsertFieldDefaults.applyIgnoreOrgId(option);
|
||||||
option.setUpdateTime(now);
|
|
||||||
option.setVersion(0);
|
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionDO>
|
||||||
public QuestionVO find(Long questionId) {
|
public QuestionVO find(Long questionId) {
|
||||||
QuestionVO questionVO = this.baseMapper.findQuestion(questionId);
|
QuestionVO questionVO = this.baseMapper.findQuestion(questionId);
|
||||||
if (questionVO == null) {
|
if (questionVO == null) {
|
||||||
throw new IllegalArgumentException("试题不存在:id=" + questionId);
|
throw new IllegalArgumentException("试题不存在");
|
||||||
}
|
}
|
||||||
// 查询选项信息(仅查询VO需要的字段)
|
// 查询选项信息(仅查询VO需要的字段)
|
||||||
List<QuestionOptionDO> options = questionOptionService.lambdaQuery()
|
List<QuestionOptionDO> options = questionOptionService.lambdaQuery()
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
, q.analysis, q.tag_type, q.courseware_management_id
|
, q.analysis, q.tag_type, q.courseware_management_id
|
||||||
, cm.courseware_name AS coursewareManagementName
|
, cm.courseware_name AS coursewareManagementName
|
||||||
FROM question q
|
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}
|
WHERE q.id = #{questionId}
|
||||||
AND q.delete_enum = 'false'
|
AND q.delete_enum = 'false'
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue