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

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.api.saporg.dto.SapOrgRespDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.saporg.SapOrgDO;
import cn.iocoder.yudao.module.system.service.saporg.SapOrgService;
import org.springframework.stereotype.Service;

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

/**
 * sap org API 实现类
 *
 * @author ruiqi
 */
@Service
public class SapOrgApiImpl implements SapOrgApi {

    @Resource
    private SapOrgService sapOrgService;

    @Override
    public SapOrgRespDTO getSapOrg(Long id) {
        SapOrgDO sapOrg = sapOrgService.getSapOrg(id);
        return BeanUtils.toBean(sapOrg, SapOrgRespDTO.class);
    }

    @Override
    public List<SapOrgRespDTO> getSapOrgByType(Integer type) {
        List<SapOrgDO> orgs = sapOrgService.getSapOrgList(null, type, null);
        return BeanUtils.toBean(orgs, SapOrgRespDTO.class);
    }

    @Override
    public List<SapOrgRespDTO> getSapOrgList(Collection<Long> ids) {
        List<SapOrgDO> sapOrgs = sapOrgService.getSapOrgList(ids);
        return BeanUtils.toBean(sapOrgs, SapOrgRespDTO.class);
    }

}
