package com.base.biz.service;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.base.api.model.AntennaRpcDTO;
import com.base.biz.mapper.AntennaInfoMapper;
import com.base.biz.model.entity.AntennaInfo;
import com.base.orbit.utils.BizUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

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

@Service
public class AntennaService extends ServiceImpl<AntennaInfoMapper, AntennaInfo> {

    @Resource
    private AntennaInfoMapper antennaInfoMapper;

    public List<AntennaRpcDTO> getInfoList(AntennaRpcDTO antennaRpcDTO) {
        List<AntennaInfo> antennaInfos = antennaInfoMapper.getInfoList(antennaRpcDTO);
        return BizUtils.copyEntityToDto(AntennaRpcDTO.class, antennaInfos);
    }

    public List<AntennaRpcDTO> selAntenaInfoByIds(List<String> ids) {
        List<AntennaInfo> antennaInfos = null;
        if (CollectionUtils.isEmpty(ids)) {
            antennaInfos = antennaInfoMapper.selectList(null);
        } else {
            antennaInfos = antennaInfoMapper.selAntenaInfoByIds(ids);
        }
        return BizUtils.copyEntityToDto(AntennaRpcDTO.class, antennaInfos);
    }


    public List<AntennaRpcDTO> selAllAntenaInfos() {
        List<AntennaInfo> antennaInfos = this.list();
        return BizUtils.copyEntityToDto(AntennaRpcDTO.class, antennaInfos);
    }

}
