package com.unis.base.app.controller;

import com.unis.base.app.service.CompanyService;
import com.unis.base.client.CompanyFeign;
import com.unis.base.client.PersonnelRecordsHisFeign;
import com.unis.base.common.vo.CompanyRecordsVO;
import com.unis.base.common.vo.CompanyVO;
import com.unis.base.common.vo.PersonnelRecordsHisVO;
import com.unis.base.common.vo.PersonnelRecordsHisqueryVO;
import com.unis.base.common.vo.DRyxxsjyVO;
import com.unis.common.utils.CurrentUtil;
import com.unis.common.utils.ResponseWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@RestController
@Api(value = "人员历史信息", tags = "人员历史信息")
@Slf4j
public class PersonnelRecordsHisController {
	
	@Autowired
	private PersonnelRecordsHisFeign dRyxxsjyHisFeign;


	/**
	 * 获取人员历史信息列表
	 * @param companyQueryVO
	 * @return
	 */
	@ApiOperation(value = "获取人员历史信息列表")
	@PostMapping(value = "/getPageOnList/{pageNum}/{pageSize}")
    public ResponseWrapper getPageOnList(@RequestBody PersonnelRecordsHisqueryVO dRyxxsjyHisqueryVO,@PathVariable("pageNum")Integer pageNum,@PathVariable("pageSize") Integer pageSize){
       
		
		return dRyxxsjyHisFeign.getPageOnList(dRyxxsjyHisqueryVO, pageNum, pageSize);
    }
	
	
	/**
	 * 新增历史人员信息
	 * @param companyVO
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	@ApiOperation(value = "新增历史人员信息", notes = "参数：历史人员")
	@PostMapping(value = "/DRyxxsjyHis")
    public ResponseWrapper insert(@RequestBody PersonnelRecordsHisVO dRyxxsjyHisVO){
		
		dRyxxsjyHisVO.setStatus(1);
		dRyxxsjyHisVO.setCreateDate(new Date());
		dRyxxsjyHisVO.setCreator(CurrentUtil.getUserName());
		dRyxxsjyHisVO.setRefresher(CurrentUtil.getUserName());
		dRyxxsjyHisVO.setRefreshTime(new Date());
		return dRyxxsjyHisFeign.insert(dRyxxsjyHisVO);
	}
	
	
	

	/**
	 * 查看人员历史
	 * @param rybajlId
	 */
	@ApiOperation(value = "查看人员历史信息", notes = "参数：历史人员主键")
	@PostMapping(value = "/getDRyxxsjyHis/{rybajlId}")
    public ResponseWrapper getPersonnelRecordsHisVO(@PathVariable String rybajlId){
		return dRyxxsjyHisFeign.getPersonnelRecordsHisVO(rybajlId);
	}
	
	
	
}
