package com.ym.mec.web.controller.student;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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 com.ym.mec.biz.dal.entity.StudentCourseHomeworkReply;
import com.ym.mec.biz.dal.page.StudentCourseHomeworkReplyQueryInfo;
import com.ym.mec.biz.service.StudentCourseHomeworkReplyService;
import com.ym.mec.common.controller.BaseController;

/**
 * @Author Joburgess
 * @Date 2019/9/19
 */

@RequestMapping("studentCourseHomeworkReply")
@Api(tags = "作业评论-学生端")
@RestController
public class StudentCourseHomeworkReplyController extends BaseController {

    @Autowired
    private StudentCourseHomeworkReplyService studentCourseHomeworkReplyService;

    @ApiOperation(value = "新增回复")
    @PostMapping("/add")
    public Object add(@RequestBody StudentCourseHomeworkReply studentCourseHomeworkReply) {
        studentCourseHomeworkReplyService.insert(studentCourseHomeworkReply);
        return succeed();
    }

    @ApiOperation(value = "回复查询")
    @GetMapping("/queryPage")
    public Object queryPage(@RequestBody StudentCourseHomeworkReplyQueryInfo queryInfo){
        return succeed(studentCourseHomeworkReplyService.queryPage(queryInfo));
    }

    @ApiOperation(value = "删除回复")
    @DeleteMapping("/del/{id}")
    public Object del(@ApiParam(value = "回复ID", required = true) @PathVariable("id") Long id){
        studentCourseHomeworkReplyService.delete(id);
        return succeed();
    }

}
