package com.casic.missiles.modular.system.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.casic.missiles.core.datascope.DataScope;
import com.casic.missiles.modular.system.dao.BusMapOverviewGisMapper;
import com.casic.missiles.modular.system.model.DeviceMapVO;
import com.casic.missiles.modular.system.model.DeviceValueMapVO;
import com.casic.missiles.modular.system.service.BusMapOverviewGisService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;


@RequiredArgsConstructor
@DS("log")
@Service
public class BusMapOverviewGisServiceImpl implements BusMapOverviewGisService {

    private final BusMapOverviewGisMapper busMapOverviewGisMapper;

    @Override
    public List<DeviceMapVO> deviceList(DataScope dataScope, String deviceType, String keyWords) {
        return busMapOverviewGisMapper.deviceList(dataScope, deviceType, keyWords);
    }

    @Override
    public DeviceValueMapVO deviceValue(String devcode) {
        DeviceValueMapVO  deviceValueMapVO= busMapOverviewGisMapper.deviceValue(devcode);
        if(ObjectUtils.isEmpty(deviceValueMapVO)){
            DeviceValueMapVO deviceValue= new DeviceValueMapVO();
            deviceValue.setCode(devcode);
            return deviceValue;
        }
        return deviceValueMapVO;
    }


}
