From 3896f6df85ea93d76c14a9c34db493a2dffe5584 Mon Sep 17 00:00:00 2001 From: Lqc Date: Fri, 29 Aug 2025 16:11:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/biz/controller/RepoBizController.java | 12 ++++++++++-- .../gen/question/controller/QuestionController.java | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-learn/src/main/java/org/jeecg/modules/biz/controller/RepoBizController.java b/jeecg-boot/jeecg-boot-module/jeecg-module-learn/src/main/java/org/jeecg/modules/biz/controller/RepoBizController.java index b48ce05d..936d1c0b 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-learn/src/main/java/org/jeecg/modules/biz/controller/RepoBizController.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-learn/src/main/java/org/jeecg/modules/biz/controller/RepoBizController.java @@ -82,8 +82,16 @@ public class RepoBizController { @GetMapping("/questionList/{repoId}") @Operation(summary = "查询题库下题目") public Result> questionList(@PathVariable String repoId) { - List list = questionRepoService.questionList(repoId); - List questions = questionService.listByIds(list); + // 获取题库中的题目ID列表 + List repoQuestionIds = questionRepoService.questionList(repoId); + if (repoQuestionIds.isEmpty()) { + return Result.error("该题库下没有题目或该题库不存在"); + } + // 根据ID列表查询题目 + List questions = questionService.listByIds(repoQuestionIds); + if(questions.isEmpty()){ + return Result.error("题目不存在"); + } //获取复选题id List type5Ids = questions.stream() .filter(question -> question.getType() == 5) diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-learn/src/main/java/org/jeecg/modules/gen/question/controller/QuestionController.java b/jeecg-boot/jeecg-boot-module/jeecg-module-learn/src/main/java/org/jeecg/modules/gen/question/controller/QuestionController.java index 08921abe..33f3fbb2 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-learn/src/main/java/org/jeecg/modules/gen/question/controller/QuestionController.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-learn/src/main/java/org/jeecg/modules/gen/question/controller/QuestionController.java @@ -91,7 +91,7 @@ public class QuestionController extends JeecgController add(@RequestBody Question question) { questionService.save(question); - return Result.OK("添加成功!"); + return Result.OK(question.getId()); } /**