AnsweringQuestionController.java
2.94 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.course.GetCourseQuestionDTO;
import com.subsidy.model.AnsweringQuestionDO;
import com.subsidy.service.AnsweringQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
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>
* 问题答疑表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-14
*/
@RestController
@Api(tags = "问题答疑表")
@RequestMapping("/answeringQuestion")
public class AnsweringQuestionController {
@Autowired
private AnsweringQuestionService answeringQuestionService;
@PostMapping("getCourseQuestion")
@ApiOperation(" 获取某个课程的答疑 {classId pageSize pageNum memberId}")
@LoginRequired
public ResponseVO getCourseQuestion(@RequestBody GetCourseQuestionDTO getCourseQuestionDTO){
return ResponseData.generateCreatedResponse(0,answeringQuestionService.getCourseQuestion(getCourseQuestionDTO));
}
@PostMapping("addQuestion")
@ApiOperation("新增答疑 {classId askId title}")
@LoginRequired
@CachePut(value = "ResultData" ,key = "'classId_'+#answeringQuestionDO.getClassId()")
public ResponseVO addQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
return ResponseData.generateCreatedResponse(0,answeringQuestionService.addQuestion(answeringQuestionDO));
}
@PostMapping("deleteQuestion")
@ApiOperation(" 删除答疑 {id}")
@LoginRequired
@CachePut(value = "ResultData" ,key = "'classId_'+#answeringQuestionDO.getClassId()")
public ResponseVO deleteQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
return ResponseData.generateCreatedResponse(0,answeringQuestionService.deleteQuestion(answeringQuestionDO));
}
@PostMapping("updateQuestion")
@ApiOperation("编辑答疑 {id answerId answer}")
@LoginRequired
@CachePut(value = "ResultData" ,key = "'classId_'+#answeringQuestionDO.getClassId()")
public ResponseVO updateQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
return ResponseData.generateCreatedResponse(0, answeringQuestionService.updateQuestion(answeringQuestionDO));
}
@PostMapping("getNoAnswers")
@ApiOperation("获取某个课程没有回答的答疑个数 classId 课程id")
@LoginRequired
public ResponseVO getNoAnswers(@RequestBody AnsweringQuestionDO answeringQuestionDO){
return ResponseData.generateCreatedResponse(0,answeringQuestionService.getNoAnswers(answeringQuestionDO));
}
}