package com.dacrt.SBIABackend.repository;

import java.util.Optional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.dacrt.SBIABackend.entity.Evalprocimpacts;
import com.dacrt.SBIABackend.entity.Evalunitres;

@Repository
public interface EvalunitresRepository extends JpaRepository<Evalunitres,Integer>,JpaSpecificationExecutor<Evalunitres>{
	@Query("SELECT e FROM Evalunitres e WHERE e.evalunitid.id =?1")
	Optional<Evalunitres> findByEvalunitres(int evalunitid);
	
	@Query("SELECT e FROM Evalunitres e WHERE e.evalunitid.id =?1 and e.id =?2")
	Optional<Evalunitres> findByEvalunitresource2(int evalunitid, int resourceid);
	
	@Query("SELECT e FROM Evalunitres e WHERE e.evalunitid.id =?1 and e.resourceid.id =?2")
	Optional<Evalunitres> findByEvalunitresource(int evalunitid, int resourceid);
}
