package cn.iocoder.yudao.module.system.api.dept;

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptSapOrgRespDTO;
import cn.iocoder.yudao.module.system.controller.admin.deptsaporg.vo.DeptSapOrgPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.deptsaporg.DeptSapOrgDO;
import cn.iocoder.yudao.module.system.service.deptsaporg.DeptSapOrgService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

/**
 * 部门 关联的 SAP 组织主数据 API 实现类
 *
 * @author ruiqi
 */
@Service
public class DeptSapOrgApiImpl implements DeptSapOrgApi {

    @Resource
    private DeptSapOrgService deptSapOrgService;


    @Override
    public List<DeptSapOrgRespDTO> getDeptSapOrgList(Long id) {
        DeptSapOrgPageReqVO reqVO = new DeptSapOrgPageReqVO();
        reqVO.setDeptId(id);
        List<DeptSapOrgDO> deptSapOrgDOS = deptSapOrgService.getDeptSapOrgList(reqVO);
        return BeanUtils.toBean(deptSapOrgDOS, DeptSapOrgRespDTO.class);
    }

    @Override
    public List<DeptSapOrgRespDTO> getSapOrgListByDeptIds(Collection<Long> deptIds) {
        DeptSapOrgPageReqVO reqVO = new DeptSapOrgPageReqVO();
        reqVO.setDeptIds(deptIds);
        List<DeptSapOrgDO> deptSapOrgDOS = deptSapOrgService.getSapOrgListByDeptIds(reqVO);
        return BeanUtils.toBean(deptSapOrgDOS, DeptSapOrgRespDTO.class);
    }
}
