package com.rehome.jpahefengweather.dao;



import com.rehome.jpahefengweather.entity.NowWeather;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 参数一 T :当前需要映射的实体
 * 参数二 ID :当前映射的实体中的OID的类型
 *
 */
public interface NowWeatherRepository extends JpaRepository<NowWeather,Long> {
    //方法名称必须要遵循驼峰式命名规则，findBy（关键字）+属性名称（首字母大写）+查询条件（首字母大写）
    //List<NowWeather> findByLocationIdAndWeatherDate(String locationId, String weatherDate);
    List<NowWeather> findByLocationIdAndWeatherDateOrderByIdDesc(String locationId, String weatherDate);
    List<NowWeather> findByLocationIdAndWeatherDateOrderByIdAsc(String locationId, String weatherDate);
    NowWeather findFirstByLocationIdAndWeatherDateOrderByIdDesc(String locationId, String weatherDate);
    NowWeather findTopByLocationIdAndWeatherDateOrderByIdDesc(String locationId, String weatherDate);
    //NowWeather findByLocationIdO(String locationId, String weatherDate);
}
