package com.huimv.eartag.dao.repo;

import com.huimv.eartag.dao.entity.EartagEnvEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface EartagEnvRepo extends JpaRepository<EartagEnvEntity, Integer>, JpaSpecificationExecutor<EartagEnvEntity> {

    @Query(nativeQuery = true,value = "SELECT * FROM eartag_env WHERE device_code=?1 AND DATE_FORMAT(add_time,'%Y-%m-%d')=DATE_FORMAT(?2,'%Y-%m-%d') limit 1")
    List<EartagEnvEntity> getDeviceEnvtempByDeviceCode(String deviceCode, String todayDateText);
}