package com.gyee.wisdom.dataadapter.domain.thing;

import com.gyee.wisdom.common.data.windturbine.PowerStation;
import com.gyee.wisdom.common.utils.StringUtil;
import com.gyee.wisdom.dao.windturbine.IPowerStationDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class StationService {

    @Autowired
    protected IPowerStationDao stationDao;

    public List<PowerStation> getAll() {
        List<PowerStation> stationList = stationDao.getAll();
        return stationList;
    }

    public PowerStation getStationById(String id) {
        return stationDao.getStationById(id);
    }

    public void add(PowerStation newStation) {
        stationDao.add(newStation);
    }

    public void modify(PowerStation station) {
        if (StringUtil.isNotBlank(station.getId())) {
            stationDao.update(station);
        }
    }

    public void delete(PowerStation station) {
        if (StringUtil.isNotBlank(station.getId()))
            stationDao.delete(station.getId());
    }


}
