AnsweringQuestionController.java 1.96 KB
package com.subsidy.controller;


import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.GetCourseQuestionDTO;
import com.subsidy.model.AnsweringQuestionDO;
import com.subsidy.service.AnsweringQuestionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.Api;

/**
 * <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}")
    public ResponseVO getCourseQuestion(@RequestBody GetCourseQuestionDTO getCourseQuestionDTO){
        return ResponseData.generateCreatedResponse(0,answeringQuestionService.getCourseQuestion(getCourseQuestionDTO));
    }

    @PostMapping("addQuestion")
    @ApiOperation("新增答疑 {classId askId title}")
    public ResponseVO addQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
        return ResponseData.generateCreatedResponse(0,answeringQuestionService.addQuestion(answeringQuestionDO));
    }

    @PostMapping("deleteQuestion")
    @ApiOperation("删除答疑 {id}")
    public ResponseVO deleteQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
        return ResponseData.generateCreatedResponse(0,answeringQuestionService.deleteQuestion(answeringQuestionDO));
    }

    @PostMapping("updateQuestion")
    @ApiOperation("编辑答疑  {id answerId answer}")
    public ResponseVO updateQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
        return ResponseData.generateCreatedResponse(0, answeringQuestionService.updateQuestion(answeringQuestionDO));
    }



}