package com.gtiit.shr.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gtiit.shr.common.Result;
import com.gtiit.shr.entity.vo.PersonOfficeVo;
import com.gtiit.shr.mapper.PersonOfficeMapper;
import com.gtiit.shr.service.PersonOfficeService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class PersonOfficeServiceImpl implements PersonOfficeService {
    @Autowired
    private PersonOfficeMapper personOfficeMapper;


    public int insertBatchPerson(List<PersonOfficeVo> personOfficeVos) {
        return this.personOfficeMapper.insertBatch(personOfficeVos);
    }

    public int updateBatchPerson(List<PersonOfficeVo> personOfficeVos) {
        return this.personOfficeMapper.updateBatch(personOfficeVos);
    }

    public Result findPage(List<String> shrIds) {
        QueryWrapper<PersonOfficeVo> queryWrapper = new QueryWrapper();
        queryWrapper.in("ID", shrIds);
        List<PersonOfficeVo> personInfoVos = this.personOfficeMapper.selectList(queryWrapper);
        Result result = new Result();
        if (personInfoVos != null && personInfoVos.size() > 0) {
            result.setMessage("员工任职历史记录息查询成功！");
            result.setCode(1);
            result.setFlag(true);
            result.setData(personInfoVos);
        } else {
            result.setMessage("员工任职历史记录信息查询失败！");
            result.setCode(0);
            result.setFlag(false);
        }

        return result;
    }
}
