Blame view

AnsweringQuestionController.java 2.89 KB
涂亚平 committed
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
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));
    }


}