From 7eca472d0551ea05265a82cf2075ca4c264f0677 Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 11 Feb 2025 17:49:53 +0900 Subject: [PATCH] =?UTF-8?q?CLAP-381=20Fix=20:=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=EB=90=9C=20task=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=EC=9D=80=20=EB=B6=88=EB=9F=AC=EC=98=A4=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8F=84=EB=A1=9D=20=EC=84=A4=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?fetch=20join=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/NotificationRepository.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/clap/server/adapter/outbound/persistense/repository/notification/NotificationRepository.java b/src/main/java/clap/server/adapter/outbound/persistense/repository/notification/NotificationRepository.java index e4462dd5..0a8b86e1 100644 --- a/src/main/java/clap/server/adapter/outbound/persistense/repository/notification/NotificationRepository.java +++ b/src/main/java/clap/server/adapter/outbound/persistense/repository/notification/NotificationRepository.java @@ -5,6 +5,8 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import java.util.List; @@ -13,7 +15,14 @@ @Repository public interface NotificationRepository extends JpaRepository { - Slice findAllByReceiver_MemberIdOrderByCreatedAtDesc(Long receiverId, Pageable pageable); + @Query("SELECT n FROM NotificationEntity n " + + "JOIN FETCH n.task t " + + "JOIN FETCH n.receiver r " + + "WHERE n.receiver.memberId = :receiverId " + + "AND t.isDeleted = false " + + "ORDER BY n.createdAt DESC") + Slice findAllByReceiver_MemberIdOrderByCreatedAtDesc( + @Param("receiverId") Long receiverId, Pageable pageable); List findAllByReceiver_MemberId(Long memberId);