|
|
@@ -3,6 +3,7 @@ package com.izouma.nineth.repo;
|
|
|
import com.izouma.nineth.domain.User;
|
|
|
import com.izouma.nineth.enums.AuthStatus;
|
|
|
import com.izouma.nineth.security.Authority;
|
|
|
+import org.springframework.cache.annotation.CacheEvict;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
|
@@ -47,12 +48,15 @@ public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExe
|
|
|
"where f.followUserId = ?1 and u.del = false ")
|
|
|
List<User> userFollowers(Long userId);
|
|
|
|
|
|
+ @CacheEvict(value = "user" ,key = "#userId")
|
|
|
@Transactional
|
|
|
@Modifying
|
|
|
@Query(value = "update user set follows = (select count(*) from follow " +
|
|
|
"where follow.user_id = ?1) where user.id = ?1", nativeQuery = true)
|
|
|
void updateFollows(Long userId);
|
|
|
|
|
|
+
|
|
|
+ @CacheEvict(value = "user" ,key = "#userId")
|
|
|
@Transactional
|
|
|
@Modifying
|
|
|
@Query(value = "update user set followers = (select count(*) from follow " +
|