package com.jiayue.ipfcst.dataexchange.service.equipmentstatusdata;

import com.alibaba.fastjson.JSON;
import com.jiayue.ipfcst.common.data.entity.WeatherStationStatusData;
import com.jiayue.ipfcst.common.data.entity.WindTowerStatusData;
import com.jiayue.ipfcst.common.data.repository.WeatherStationStatusDataRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * 气象站状态数据
 *
 * @author: xiuwei
 * @version:
 */
@Service
public class WeatherStationStatusDataService {

  @Autowired
  WeatherStationStatusDataRepository weatherStationStatusDataRepository;

  public WeatherStationStatusData save(WeatherStationStatusData weatherStationStatusData) {
    return weatherStationStatusDataRepository.save(weatherStationStatusData);
  }

  public List<WeatherStationStatusData> save(List<WeatherStationStatusData> weatherStationStatusData) {
    return weatherStationStatusDataRepository.saveAll(weatherStationStatusData);
  }


  public List<WeatherStationStatusData> findByEquipmentNoAndTimeBetween(Integer equipmentNo, Date startTime, Date endTime){
    return weatherStationStatusDataRepository.findByTimeBetweenAndEquipmentNo(startTime,endTime,equipmentNo);
  }


}
