diff --git a/src/main/java/com/kusitms/samsion/domain/comment/domain/repository/CommentRepository.java b/src/main/java/com/kusitms/samsion/domain/comment/domain/repository/CommentRepository.java index b0143c1..01206d8 100644 --- a/src/main/java/com/kusitms/samsion/domain/comment/domain/repository/CommentRepository.java +++ b/src/main/java/com/kusitms/samsion/domain/comment/domain/repository/CommentRepository.java @@ -10,7 +10,8 @@ public interface CommentRepository extends JpaRepository { - long countByAlbumId(Long albumId); + + long countByAlbumIdAndDeletedFalse(Long albumId); @Query("select c from Comment c where c.album.id = :albumId order by c.parent.id asc nulls first, c.createdDate asc") Slice findByAlbumId(Pageable pageable, @Param("albumId") Long albumId); } diff --git a/src/main/java/com/kusitms/samsion/domain/comment/domain/service/CommentQueryService.java b/src/main/java/com/kusitms/samsion/domain/comment/domain/service/CommentQueryService.java index fc3220d..5b80eb5 100644 --- a/src/main/java/com/kusitms/samsion/domain/comment/domain/service/CommentQueryService.java +++ b/src/main/java/com/kusitms/samsion/domain/comment/domain/service/CommentQueryService.java @@ -31,7 +31,7 @@ public Slice getCommentByAlbumId(Pageable pageable, Long albumId) { @Cacheable(value = CachingStoreConst.COMMENT_COUNT_CACHE_NAME, key = "#albumId") public long getCommentCountByAlbumId(Long albumId){ - return commentRepository.countByAlbumId(albumId); + return commentRepository.countByAlbumIdAndDeletedFalse(albumId); } }