This commit is contained in:
Lqc 2025-08-29 16:11:48 +08:00
parent 6cf1b91b85
commit 3896f6df85
2 changed files with 11 additions and 3 deletions

View File

@ -82,8 +82,16 @@ public class RepoBizController {
@GetMapping("/questionList/{repoId}")
@Operation(summary = "查询题库下题目")
public Result<List<Question>> questionList(@PathVariable String repoId) {
List<String> list = questionRepoService.questionList(repoId);
List<Question> questions = questionService.listByIds(list);
// 获取题库中的题目ID列表
List<String> repoQuestionIds = questionRepoService.questionList(repoId);
if (repoQuestionIds.isEmpty()) {
return Result.error("该题库下没有题目或该题库不存在");
}
// 根据ID列表查询题目
List<Question> questions = questionService.listByIds(repoQuestionIds);
if(questions.isEmpty()){
return Result.error("题目不存在");
}
//获取复选题id
List<String> type5Ids = questions.stream()
.filter(question -> question.getType() == 5)

View File

@ -91,7 +91,7 @@ public class QuestionController extends JeecgController<Question, IQuestionServi
public Result<String> add(@RequestBody Question question) {
questionService.save(question);
return Result.OK("添加成功!");
return Result.OK(question.getId());
}
/**