AnsweringQuestionController.java 2.89 KB
package com.meishu.controller;


import com.meishu.common.ResponseData;
import com.meishu.common.ResponseVO;
import com.meishu.dto.question.QueryQuestionsDTO;
import com.meishu.model.AnsweringQuestionDO;
import com.meishu.model.UserSubjectPermissionDictDO;
import com.meishu.service.AnsweringQuestionService;
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;
import io.swagger.annotations.Api;

/**
 * <p>
 * 问题答疑表 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2021-09-28
 */
@RestController
@Api(tags = "问题答疑表")
@RequestMapping("/answeringQuestion")
public class AnsweringQuestionController {

    @Autowired
    private AnsweringQuestionService answeringQuestionService;

    @PostMapping("queryQuestions")
    @ApiOperation("获取某个科目里的答疑{pageNum  pageSize userName startDate endDate subjectId}")
    public ResponseVO queryQuestions(@RequestBody QueryQuestionsDTO queryQuestionsDTO){
        return ResponseData.generateCreatedResponse(0,answeringQuestionService.queryQuestions(queryQuestionsDTO));
    }

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

    @PostMapping("queryOneQuestion")
    @ApiOperation("查看单个答疑 {id}")
    public ResponseVO queryOneQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
        return ResponseData.generateCreatedResponse(0,answeringQuestionService.queryOneQuestion(answeringQuestionDO));
    }

    @PostMapping("getClassQuestions")
    @ApiOperation("查询老师的班级 {userId 教师id}")
    public ResponseVO getClassQuestions(@RequestBody UserSubjectPermissionDictDO userSubjectPermissionDictDO){
        return ResponseData.generateCreatedResponse(0,answeringQuestionService.getClassQuestions(userSubjectPermissionDictDO));
    }

    @PostMapping("addQuestion")
    @ApiOperation("新增答疑 {subjectId 科目id askId 学生id title:问题}")
    public ResponseVO addQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
        return ResponseData.generateCreatedResponse(0,answeringQuestionService.addQuestion(answeringQuestionDO));
    }

    @PostMapping("answerQuestion")
    @ApiOperation("老师回答某个问题  id 主键 answer 答案")
    public ResponseVO answerQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
        return ResponseData.generateCreatedResponse(0,answeringQuestionService.answerQuestion(answeringQuestionDO));
    }


}