Interface NotificationsRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Notification,,String> org.springframework.data.repository.Repository<Notification,String>
@Repository
public interface NotificationsRepository
extends org.springframework.data.repository.CrudRepository<Notification,String>
Spring Data repository used to access the notifications in BBDD. See
Notification.-
Method Summary
Modifier and TypeMethodDescriptionfindOneByChannelAndProviderAndExternalId(Channel channel, Provider provider, String externalId) Find a notification by its external identifier.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
-
Method Details
-
findOneByChannelAndProviderAndExternalId
@Query(nativeQuery=true, value="SELECT n.id, n.external_id, n.creation_date, n.update_date, n.notification_status_id, n.status_description, n.user_id, n.message_id, n.destination, n.cost, n.currency, n.msg_count, n.campaign_id, n.template_id FROM notification n INNER JOIN message_channel_priority p on n.message_id = p.message_id and n.template_id = p.template_id INNER JOIN template t on n.template_id = t.id WHERE p.channel_id = :channel and t.provider_id = :provider and n.external_id = :externalId") Optional<Notification> findOneByChannelAndProviderAndExternalId(@Param("channel") Channel channel, @Param("provider") Provider provider, @Param("externalId") String externalId) Find a notification by its external identifier.- Parameters:
channel- the notification channel.provider- the notification provider.externalId- the external notification identifier.- Returns:
- the notification found (if any was actually found).
-