package com.izouma.jmrh.repo;

import com.izouma.jmrh.domain.Collect;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;

import javax.transaction.Transactional;

public interface CollectRepo extends JpaRepository<Collect, Long>, JpaSpecificationExecutor<Collect> {

    @Modifying
    @Transactional
    void deleteAllByIdIn(Iterable<Long> ids);

    @Modifying
    @Transactional
    void deleteAllByUserIdAndSndIdIn(Long userId, Iterable<Long> ids);

    Collect findByUserIdAndSndId(Long userId, Long sndId);
}