package com.huimv.produce.produce.repo;

import com.huimv.produce.produce.entity.ProdImportantIndicatorEntity;
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 ProdImportantIndicatoRepo extends JpaRepository<ProdImportantIndicatorEntity, Integer>, JpaSpecificationExecutor<ProdImportantIndicatorEntity> {

    //
    @Query(nativeQuery = true,value = "SELECT * FROM prod_important_indicator WHERE farm_id=?1 AND year=?2 AND month between 1 AND ?3 ORDER BY month ASC")
    List<ProdImportantIndicatorEntity> findAllByFarmIdAndStartAndEndDate(Integer farmId, String year, Integer month);
}