package com.gtiit.shr.controller;

import com.gtiit.shr.common.ResponseResult;
import com.gtiit.shr.common.Result;
import com.gtiit.shr.entity.vo.PersonInfoVo;
import com.gtiit.shr.service.PersonService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"/person"})
public class PersonController {
    @Autowired
    private PersonService personService;



    @RequestMapping({"/insertBatch"})
    public Result insertBatchPerson(@RequestBody List<PersonInfoVo> personInfoVos) {
        int result = this.personService.insertBatchPerson(personInfoVos);
        return result == 0 ? ResponseResult.isError("员工基本信息保存失败！", (Object)null) : ResponseResult.isOk("员工基本信息保存成功！", (Object)null);
    }

    public Result updateBatchPerson(@RequestBody List<PersonInfoVo> personInfoVos) {
        int result = this.personService.updateBatchPerson(personInfoVos);
        return result == 0 ? ResponseResult.isError("员工基本信息更新失败！", (Object)null) : ResponseResult.isOk("员工基本信息更新成功！", (Object)null);
    }

    @RequestMapping({"/findPage"})
    public Result findPage(@RequestParam("shrId") List<String> shrIds) {
        return this.personService.findPage(shrIds);
    }
}
