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.PositionVo;
import com.gtiit.shr.mapper.PositionMapper;
import com.gtiit.shr.service.PositionService;
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 PositionServiceImpl implements PositionService {
    @Autowired
    private PositionMapper positionMapper;


    public int insertBatchPerson(List<PositionVo> positionVos) {
        return this.positionMapper.insertBatch(positionVos);
    }

    public int updateBatchPerson(List<PositionVo> positionVos) {
        return this.positionMapper.updateBatch(positionVos);
    }

    public Result findPage(List<String> shrIds) {
        QueryWrapper<PositionVo> queryWrapper = new QueryWrapper();
        queryWrapper.in("ID", shrIds);
        List<PositionVo> personInfoVos = this.positionMapper.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;
    }
}
