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.DeptInfoVo;
import com.gtiit.shr.mapper.DeptMapper;
import com.gtiit.shr.service.DeptService;
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 DeptServiceImpl implements DeptService {
    @Autowired
    private DeptMapper deptMapper;



    public int insertBatchPerson(List<DeptInfoVo> deptInfoVos) {
        return this.deptMapper.insertBatch(deptInfoVos);
    }

    public int updateBatchPerson(List<DeptInfoVo> deptInfoVos) {
        return this.deptMapper.updateBatch(deptInfoVos);
    }

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