微调
This commit is contained in:
parent
6cf1b91b85
commit
3896f6df85
@ -82,8 +82,16 @@ public class RepoBizController {
|
|||||||
@GetMapping("/questionList/{repoId}")
|
@GetMapping("/questionList/{repoId}")
|
||||||
@Operation(summary = "查询题库下题目")
|
@Operation(summary = "查询题库下题目")
|
||||||
public Result<List<Question>> questionList(@PathVariable String repoId) {
|
public Result<List<Question>> questionList(@PathVariable String repoId) {
|
||||||
List<String> list = questionRepoService.questionList(repoId);
|
// 获取题库中的题目ID列表
|
||||||
List<Question> questions = questionService.listByIds(list);
|
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
|
//获取复选题id
|
||||||
List<String> type5Ids = questions.stream()
|
List<String> type5Ids = questions.stream()
|
||||||
.filter(question -> question.getType() == 5)
|
.filter(question -> question.getType() == 5)
|
||||||
|
@ -91,7 +91,7 @@ public class QuestionController extends JeecgController<Question, IQuestionServi
|
|||||||
public Result<String> add(@RequestBody Question question) {
|
public Result<String> add(@RequestBody Question question) {
|
||||||
questionService.save(question);
|
questionService.save(question);
|
||||||
|
|
||||||
return Result.OK("添加成功!");
|
return Result.OK(question.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user