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

import static com.ym.mec.common.controller.BaseController.succeed;
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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ym.mec.biz.dal.entity.SysSuggestion;
import com.ym.mec.biz.service.SysSuggestionService;
import com.ym.mec.common.page.QueryInfo;

/**
 * @Author Joburgess
 * @Date 2019/9/21
 */
@Api(tags = "平台建议")
@RequestMapping("suggestion")
@RestController
public class SuggestionController {

    @Autowired
    private SysSuggestionService suggestionService;

    @ApiOperation(value = "新增建议")
    @PostMapping("/add")
    public Object add(SysSuggestion SysSuggestion) {
        suggestionService.insert(SysSuggestion);
        return succeed();
    }

    @ApiOperation(value = "删除建议")
    @PostMapping("/del/{id}")
    public Object del(@ApiParam(value = "建议编号", required = true) @PathVariable("id") Integer id) {
        suggestionService.delete(Long.valueOf(id));
        return succeed();
    }

    @ApiOperation(value = "修改建议")
    @PostMapping("/update")
    public Object update(SysSuggestion SysSuggestion) {
        suggestionService.update(SysSuggestion);
        return succeed();
    }


    @ApiOperation("分页查询建议列表")
    @PostMapping("/queryPage")
    public Object queryPage(QueryInfo queryInfo){
        return succeed(suggestionService.queryPage(queryInfo));
    }
}
