FollowRepo.java 727 B

123456789101112131415161718192021
  1. package com.izouma.nineth.repo;
  2. import com.izouma.nineth.domain.Follow;
  3. import org.springframework.data.jpa.repository.JpaRepository;
  4. import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  5. import org.springframework.data.jpa.repository.Modifying;
  6. import org.springframework.data.jpa.repository.Query;
  7. import javax.transaction.Transactional;
  8. import java.util.List;
  9. public interface FollowRepo extends JpaRepository<Follow, Long>, JpaSpecificationExecutor<Follow> {
  10. @Query("update Follow t set t.del = true where t.id = ?1")
  11. @Modifying
  12. @Transactional
  13. void softDelete(Long id);
  14. List<Follow> findByUserIdAndFollowUserId(Long userId, Long to);
  15. List<Follow> findByUserId(Long userId);
  16. }