Bläddra i källkod

zhurui Question实体类添加新字段

Leonezhurui 4 år sedan
förälder
incheckning
a811bb35c5

+ 2 - 0
seecoder-bok-common/src/main/java/cn/seecoder/bok/common/QuestionState.java

@@ -11,6 +11,8 @@ import com.fasterxml.jackson.annotation.JsonValue;
 public enum QuestionState {
     APPROVED("APPROVED"),
     CHECKING("CHECKING"),
+    UPDATING("UPDATING"),
+    DELETING("DELETING"),
     REFUSED("REFUSED"),
     DELETED("DELETED");
 

+ 15 - 1
seecoder-bok-common/src/main/java/cn/seecoder/bok/common/vo/question/AbstractQuestionVO.java

@@ -70,6 +70,11 @@ public abstract class AbstractQuestionVO {
      */
     protected List<String> knowledgeId;
 
+    /**
+     * 保留字段;对于更新题目的话,则存储的是中间状态题目的id
+     */
+    protected String remark;
+
     /**
      * 创建时间
      */
@@ -152,6 +157,14 @@ public abstract class AbstractQuestionVO {
         this.knowledgeId = knowledgeId;
     }
 
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
     public Instant getCreatedTime() {
         return createdTime;
     }
@@ -196,10 +209,10 @@ public abstract class AbstractQuestionVO {
     public String toString() {
         return "AbstractQuestionVO{" +
                 "id='" + id + '\'' +
+                ", type=" + type +
                 ", state=" + state +
                 ", checkedUserId=" + checkedUserId +
                 ", savedUserId=" + savedUserId +
-                ", type=" + type +
                 ", title='" + title + '\'' +
                 ", stem='" + stem + '\'' +
                 ", analysis='" + analysis + '\'' +
@@ -207,6 +220,7 @@ public abstract class AbstractQuestionVO {
                 ", keyPoints='" + keyPoints + '\'' +
                 ", tags=" + tags +
                 ", knowledgeId=" + knowledgeId +
+                ", remark='" + remark + '\'' +
                 ", createdTime=" + createdTime +
                 ", lastModifiedTime=" + lastModifiedTime +
                 '}';

+ 12 - 0
seecoder-bok-server/src/main/java/cn/seecoder/seecoderbokserver/domain/Question.java

@@ -55,6 +55,9 @@ public class Question {
     @Field(name = "key_points", type = FieldType.Text)
     private String keyPoints;
 
+    @Field(name = "remark", type = FieldType.Text)
+    private String remark;
+
     @Field(name = "tags", type = FieldType.Text)
     private List<String> tags;
 
@@ -159,6 +162,14 @@ public class Question {
         this.knowledgeId = knowledgeId;
     }
 
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
     public Map<String, String> getOptions() {
         return options;
     }
@@ -260,6 +271,7 @@ public class Question {
                 ", weight=" + weight +
                 ", analysis='" + analysis + '\'' +
                 ", keyPoints='" + keyPoints + '\'' +
+                ", remark='" + remark + '\'' +
                 ", tags=" + tags +
                 ", knowledgeId=" + knowledgeId +
                 ", options=" + options +

+ 7 - 0
seecoder-bok-server/src/main/java/cn/seecoder/seecoderbokserver/web/rest/QuestionController.java

@@ -98,6 +98,13 @@ public class QuestionController implements SeecoderBokQuestionApi, SeecoderBokQu
                 .map(questionMapper::questionToQuestionVO);
     }
 
+    @GetMapping("/getQuestion/{id}")
+    public Response getQuestionById1(
+            @NotBlank @PathVariable(name = "id") String questionId) {
+        return Response.buildSuccess(questionService.findById(questionId)
+                .map(questionMapper::questionToQuestionVO));
+    }
+
     @PutMapping("/question/{id}")
     public Response updateQuestion(
             @NotNull @RequestBody QuestionVO question) {

+ 1 - 0
seecoder-bok-server/src/main/java/cn/seecoder/seecoderbokserver/web/rest/UserController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
  */
 
 @Slf4j
+@CrossOrigin(origins = "http:localhost:8000")
 @RestController
 @RequestMapping("/api/user")
 public class UserController {