QuestionsController.java
1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.laowu.controller;
import com.laowu.model.QuestionsDO;
import com.laowu.service.QuestionsService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* Q && A 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-15
*/
@RestController
@Api(tags = "Q && A")
@RequestMapping("/questions")
public class QuestionsController {
@Autowired
private QuestionsService questionsService;
@PostMapping("contentQuestions")
@ApiOperation("某个目录下的问题&答案 contentId")
public ResponseVO contentQuestions(@RequestBody QuestionsDO questionsDO){
return ResponseData.generateCreatedResponse(0,questionsService.contentQuestions(questionsDO));
}
@PostMapping("deleteQuestion")
@ApiOperation("删除答疑 id")
public ResponseVO deleteQuestion(@RequestBody QuestionsDO questionsDO){
return ResponseData.generateCreatedResponse(0,questionsService.deleteQuestion(questionsDO));
}
@PostMapping("addQuestion")
@ApiOperation("新增答疑 contentId question answer")
public ResponseVO addQuestion(@RequestBody QuestionsDO questionsDO){
return ResponseData.generateCreatedResponse(0,questionsService.addQuestion(questionsDO));
}
@PostMapping("updateQuestion")
@ApiOperation("修改答疑 id contentId question answer")
public ResponseVO updateQuestion(@RequestBody QuestionsDO questionsDO){
return ResponseData.generateCreatedResponse(0,questionsService.updateQuestion(questionsDO));
}
}