package com.ssj.dao.es.dao;

import com.ssj.bean.es.domain.EsDataRecode;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @author sh
 * @className IEsDataRecodeDao
 * @description TODO
 * @date 2020/4/29
 */
@Repository
public interface IEsDataRecodeDao extends JpaRepository<EsDataRecode,String> {
    @Query(nativeQuery = true,value = "select * from es_data_recode where es_index_name = ?1  and state=1 order by load_date desc limit 1 ")
    EsDataRecode getLastDataByIndex(String indexName);

    @Query(nativeQuery = true,value = "select * from es_data_recode where es_index_name = ?1 and load_date=?2   order by load_date desc limit 1 ")
    EsDataRecode getLastDataByDate(String indexName, String loadDate);
}
