package com.rehome.mqttclienttemperature.dao;

import com.rehome.mqttclienttemperature.entity.WebServiceWeatherInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface WebServiceWeatherInfoRepository extends JpaRepository<WebServiceWeatherInfo,Long> {
    //方法名称必须要遵循驼峰式命名规则，findBy（关键字）+属性名称（首字母大写）+查询条件（首字母大写）
    @Query(value = "select * from web_service_weather_info t where t.create_date=?1 and t.city_code=?2", nativeQuery = true)
    List<WebServiceWeatherInfo> findByCreateDateAndCityCode(String createDate, String cityCode);

    //@Query(value = "select * from web_service_weather_info t where t.create_date=?1 and t.city_name=?2", nativeQuery = true)
    List<WebServiceWeatherInfo> findByCreateDateAndCityName(String createDate, String cityName);
}
