package cn.com.countrygarden.bi.main.controller.personnel;
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.personnel.PersonnelAdvisorType;
import cn.com.countrygarden.bi.main.dao.personnel.PersonnelAdvisorTypeMapper;
import cn.com.countrygarden.bi.main.service.personnel.PersonnelAdvisorTypeService;

/**
 * 导师类型-控制层实现
 *
 * @author 吕伟峰
 * @email www.justintoforest@gamail.com
 * @url 
 * @date 2018-09-27
 */
@RestController("PersonnelAdvisorTypeController")
@RequestMapping("/api/personnelAdvisorType")
public class PersonnelAdvisorTypeController extends BaseController{
    @Autowired
    private PersonnelAdvisorTypeService personnelAdvisorTypeService;


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

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

    @PostMapping(value = "/add")
    public Result add(PersonnelAdvisorType personnelAdvisorType,
                      HttpServletRequest request){
        return  personnelAdvisorTypeService.add(personnelAdvisorType,getAccessToken(request));
    }

    @PutMapping(value = "/edit")
    public Result edit(PersonnelAdvisorType personnelAdvisorType, HttpServletRequest request){
        return  personnelAdvisorTypeService.edit(personnelAdvisorType,getAccessToken(request));
    }

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


}