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.PersonnelAssessmentemporary;
import cn.com.countrygarden.bi.main.dao.personnel.PersonnelAssessmentemporaryMapper;
import cn.com.countrygarden.bi.main.service.personnel.PersonnelAssessmentemporaryService;

/**
 * 270评估导入临时表-控制层实现
 *
 * @author 吕伟峰
 * @email www.justintoforest@gamail.com
 * @url 
 * @date 2018-11-21
 */
@RestController("PersonnelAssessmentemporaryController")
@RequestMapping("/api/personnelAssessmentemporary")
public class PersonnelAssessmentemporaryController extends BaseController{
    @Autowired
    private PersonnelAssessmentemporaryService personnelAssessmentemporaryService;


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

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

    @PostMapping(value = "/add")
    public Result add(PersonnelAssessmentemporary personnelAssessmentemporary,
                      HttpServletRequest request){
        return  personnelAssessmentemporaryService.add(personnelAssessmentemporary,getAccessToken(request));
    }

    @PutMapping(value = "/edit")
    public Result edit(PersonnelAssessmentemporary personnelAssessmentemporary, HttpServletRequest request){
        return  personnelAssessmentemporaryService.edit(personnelAssessmentemporary,getAccessToken(request));
    }

    @DeleteMapping(value="/del")
    public Result del(@RequestParam(value = "id", required = true)Integer id){
        return  personnelAssessmentemporaryService.del(id);
    }
    
    @GetMapping(value = "/listemporary", produces = "application/json;charset=utf-8")
    public Result listemporary(@RequestParam(value="search",required=true)String search,HttpServletRequest request){
        return  personnelAssessmentemporaryService.listemporary(search,getAccessToken(request));
    }
    
    @GetMapping(value = "/getlist", produces = "application/json;charset=utf-8")
    public Result getlist(@RequestParam(value="search",required=true)String search,
                       HttpServletRequest request){
        return  personnelAssessmentemporaryService.getlist(search,getAccessToken(request));
    }


}