package cn.com.countrygarden.bi.main.controller.writtenExamination;
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.writtenExamination.PersonnelSelectionType;
import cn.com.countrygarden.bi.main.dao.writtenExamination.PersonnelSelectionTypeMapper;
import cn.com.countrygarden.bi.main.service.writtenExamination.PersonnelSelectionTypeService;

/**
 * 选拔类型-业务逻辑层实现
 *
 * @author 汤婷
 * @email www.justintoforest@gamail.com
 * @url 
 * @date 2018-10-17
 */
@RestController("PersonnelSelectionTypeController")
@RequestMapping("/api/personnelSelectionType")
public class PersonnelSelectionTypeController extends BaseController{
    @Autowired
    private PersonnelSelectionTypeService personnelSelectionTypeService;


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

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

    @PostMapping(value = "/add")
    public Result add(PersonnelSelectionType personnelSelectionType,
                      HttpServletRequest request){
        return  personnelSelectionTypeService.add(personnelSelectionType,getAccessToken(request));
    }

    @PutMapping(value = "/edit")
    public Result edit(PersonnelSelectionType personnelSelectionType, HttpServletRequest request){
        return  personnelSelectionTypeService.edit(personnelSelectionType,getAccessToken(request));
    }

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


}