diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java index 6449582c..8e1ff240 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java @@ -491,11 +491,36 @@ public class ExamQuestionServiceImpl implements IExamQuestionService PageResult questionExamineDOPageResult = questionExamineMapper.selectPage(questionVo); List list = questionExamineDOPageResult.getList(); List examQuestionList=new ArrayList<>(); + + List examKnowledgePoints = knowledgePointsMapper.selectKnowledgePoints(); + // 构造 ID → 名称映射 + Map idNameMap = examKnowledgePoints.stream() + .collect(Collectors.toMap(ExamKnowledgePoints::getSpId, ExamKnowledgePoints::getSpName)); if (list!=null&&list.size()>0){ for (QuestionExamineDO questionExamineDO : list) { String schoolName =questionExamineMapper.selectSchoolName(questionExamineDO.getSource()); ExamQuestion examQuestion = examQuestionMapper.selectExamQuestionByQuId(questionExamineDO.getQuId()); + String pointIdStr = examQuestion.getPointNames(); + String chapterIdStr = examQuestion.getChapteridDictText(); if (examQuestion!=null){ + try { + if (pointIdStr != null) { + Long pointId = Long.valueOf(pointIdStr); + if (idNameMap.containsKey(pointId)) { + examQuestion.setPointNamesVo(idNameMap.get(pointId)); + } + } + + if (chapterIdStr != null) { + Long chapterId = Long.valueOf(chapterIdStr); + if (idNameMap.containsKey(chapterId)) { + examQuestion.setChapteridDictTextVo(idNameMap.get(chapterId)); + } + } + } catch (NumberFormatException e) { + // 日志记录或跳过处理 + System.err.println("ID格式错误:" + e.getMessage()); + } examQuestion.setCreateTeacher(questionExamineDO.getCreateTeacher()); examQuestion.setSchoolName(schoolName); examQuestion.setSource(questionExamineDO.getSource());