package com.jasamedika.medifirst2000.dao;

import java.util.List;

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

import com.jasamedika.medifirst2000.entities.NotifMessaging;

@Repository("NotifMessagingDao")
public interface NotifMessagingDao extends JpaRepository<NotifMessaging, Integer> {

	
	public List<NotifMessaging> findByObjekModulAplikasiId(Integer objekModulAplikasiId);
	
	public List<NotifMessaging> findByObjekModulAplikasiIdAndUrlBackEnd(Integer objekModulAplikasiId, String urlBackEnd);

	@Query("SELECT mi FROM NotifMessaging mi WHERE mi.objekModulAplikasiId = :objekModulAplikasiId AND (mi.urlBackEnd = :urlBackEnd OR mi.urlBackEnd IS NULL)")
	public List<NotifMessaging> findByObjekModulAplikasiIdAndUrlBackEndOrUrlBackEndIsNull(@Param("objekModulAplikasiId")Integer objekModulAplikasiId, @Param("urlBackEnd")String urlBackEnd);
	
}
