Selaa lähdekoodia

更新 bok 接口

Bay 6 vuotta sitten
vanhempi
commit
1e20b1564e

+ 8 - 19
seec-bok/src/main/java/cn/seec/seecbok/controller/QuestionController.java

@@ -1,7 +1,7 @@
 package cn.seec.seecbok.controller;
 
+import cn.seec.seecbok.dto.PageDTO;
 import cn.seec.seecbok.util.FakeQuestionData;
-import cn.seec.seecbok.vo.PageVO;
 import cn.seec.seecbok.vo.PageableQuestionListVO;
 import cn.seec.seecbok.vo.QuestionVO;
 import io.swagger.v3.oas.annotations.Operation;
@@ -19,26 +19,15 @@ public class QuestionController {
     @GetMapping("")
     @Operation(description = "获得题目列表")
     public PageableQuestionListVO getQuestionList(
-            @RequestParam(value = "id", required = false) @Parameter(description = "多id查找")
-                    List<String> id,
             @RequestParam(value = "stem", required = false) @Parameter(description = "模糊查找题目")
                     String stem,
-            @RequestParam(value = "size", required = false) @Parameter(description = "页面展示条数")
-                    Integer size,
-            @RequestParam(value = "page", required = false) @Parameter(description = "当前页码")
-                    Integer page,
-            @RequestParam(value = "sort", required = false) @Parameter(description = "排序方式")
-                    String sort) {
-        return PageableQuestionListVO.builder()
-                .questions(FakeQuestionData.buildList())
-                .page(
-                        PageVO.builder()
-                                .size(size)
-                                .totalPages(205)
-                                .totalElements(1022)
-                                .number(page)
-                                .build())
-                .build();
+            @RequestParam(value = "tag", required = false) @Parameter(description = "模糊查找题目")
+                    List<String> tag,
+            @RequestParam(value = "knowledgeId", required = false)
+                    @Parameter(description = "模糊查找题目")
+                    List<String> knowledgeId,
+            PageDTO pageDTO) {
+        return FakeQuestionData.buildPageableList();
     }
 
     @PostMapping("")

+ 25 - 0
seec-bok/src/main/java/cn/seec/seecbok/controller/QuestionQueryController.java

@@ -0,0 +1,25 @@
+package cn.seec.seecbok.controller;
+
+import cn.seec.seecbok.util.FakeQuestionData;
+import cn.seec.seecbok.vo.QuestionVO;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/** @author Kunduin */
+@RestController
+@RequestMapping("/api/question-query")
+public class QuestionQueryController {
+
+    @GetMapping("/id")
+    @Operation(description = "根据id批量获取题目")
+    public List<QuestionVO> getQuestionListById(
+            @RequestParam("id") @Parameter(description = "批量获取") List<String> id) {
+        return FakeQuestionData.buildList();
+    }
+}

+ 13 - 0
seec-bok/src/main/java/cn/seec/seecbok/dto/PageDTO.java

@@ -0,0 +1,13 @@
+package cn.seec.seecbok.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/** @author Kunduin */
+@Data
+public class PageDTO {
+    Integer size;
+    Integer page;
+    List<String> sort;
+}

+ 15 - 0
seec-bok/src/main/java/cn/seec/seecbok/util/FakeQuestionData.java

@@ -1,5 +1,7 @@
 package cn.seec.seecbok.util;
 
+import cn.seec.seecbok.vo.PageVO;
+import cn.seec.seecbok.vo.PageableQuestionListVO;
 import cn.seec.seecbok.vo.QuestionVO;
 
 import java.util.Arrays;
@@ -14,6 +16,19 @@ public class FakeQuestionData {
         return Arrays.asList(build("1001"), build("1002"), build("1003"));
     }
 
+    public static PageableQuestionListVO buildPageableList() {
+        return PageableQuestionListVO.builder()
+                .questions(FakeQuestionData.buildList())
+                .page(
+                        PageVO.builder()
+                                .size(5)
+                                .totalPages(205)
+                                .totalElements(1022)
+                                .number(1)
+                                .build())
+                .build();
+    }
+
     public static QuestionVO build() {
         return build("1001");
     }

+ 6 - 0
seec-bok/src/main/java/cn/seec/seecbok/vo/QuestionVO.java

@@ -3,6 +3,7 @@ package cn.seec.seecbok.vo;
 import lombok.Builder;
 import lombok.Data;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -14,9 +15,14 @@ public class QuestionVO {
     String type;
     String stem;
     Map<String, String> options;
+
+    /** 填空题 __1__ __2__ */
+    Map<String, String> blanks;
+
     String answer;
     String keyPoints;
     String analysis;
     List<String> tags;
     List<String> knowledgeId;
+    Date lastModifiedTime;
 }

+ 14 - 0
seec-bok/src/main/java/cn/seec/seecbok/vo/constant/QuestionType.java

@@ -0,0 +1,14 @@
+package cn.seec.seecbok.vo.constant;
+
+public enum QuestionType {
+    /** 选择题 */
+    choice,
+    /** 判断题 */
+    true_false,
+    /** 多选题 */
+    multiple_choice,
+    /** 填空题 */
+    blank,
+    /** 简答题 */
+    short_answer
+}