package cn.com.countrygarden.bi.main.controller.review;
import cn.com.countrygarden.bi.main.controller.BaseController;
import cn.com.countrygarden.bi.main.core.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import cn.com.countrygarden.bi.main.model.review.ReviewQuestionnaireProblemOption;
import cn.com.countrygarden.bi.main.dao.review.ReviewQuestionnaireProblemOptionMapper;
import cn.com.countrygarden.bi.main.service.review.ReviewQuestionnaireProblemOptionService;

/**
 * 选项表-业务逻辑层实现
 *
 * @author 汤婷
 * @email www.justintoforest@gamail.com
 * @url 
 * @date 2018-07-06
 */
@RestController("ReviewQuestionnaireProblemOptionController")
@RequestMapping("/api/reviewQuestionnaireProblemOption")
public class ReviewQuestionnaireProblemOptionController extends BaseController{
    @Autowired
    private ReviewQuestionnaireProblemOptionService reviewQuestionnaireProblemOptionService;


    @GetMapping(value = "/list", produces = "application/json;charset=utf-8")
    public Result list(ReviewQuestionnaireProblemOption reviewQuestionnaireProblemOption,
                       @RequestParam(value = "size", required = false, defaultValue = "10") int size,
                       @RequestParam(value = "page", required = false, defaultValue = "1") int page,
                       HttpServletRequest request){
        return  reviewQuestionnaireProblemOptionService.queryPageList(reviewQuestionnaireProblemOption,page,size);
    }

    @GetMapping(value = "/one", produces = "application/json;charset=utf-8")
    public Result queryById(@RequestParam(value = "id", required = true)Integer id,
                            HttpServletRequest request){
        return  reviewQuestionnaireProblemOptionService.queryById(id);
    }

    @PostMapping(value = "/add")
    public Result add(ReviewQuestionnaireProblemOption reviewQuestionnaireProblemOption,
                      HttpServletRequest request){
        return  reviewQuestionnaireProblemOptionService.add(reviewQuestionnaireProblemOption,getAccessToken(request));
    }

    @PutMapping(value = "/edit")
    public Result edit(ReviewQuestionnaireProblemOption reviewQuestionnaireProblemOption, HttpServletRequest request){
        return  reviewQuestionnaireProblemOptionService.edit(reviewQuestionnaireProblemOption,getAccessToken(request));
    }

    @DeleteMapping(value="/del")
    public Result del(@RequestParam(value = "id", required = true)Integer id){
        return  reviewQuestionnaireProblemOptionService.del(id);
    }


}