From c785a950e5eca9d5d35a9be5041c55d90da492ab Mon Sep 17 00:00:00 2001 From: hyeesw Date: Thu, 3 Oct 2024 22:02:55 +0900 Subject: [PATCH] =?UTF-8?q?[chore]=20#71=20=ED=98=84=EC=9E=AC=20=ED=95=AB?= =?UTF-8?q?=ED=95=9C=20=EC=98=A4=ED=94=88=ED=86=A1=20api=20200=EA=B0=9C?= =?UTF-8?q?=EC=97=90=EC=84=9C=2050=EA=B0=9C=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/domain/message/repository/MessageRepository.java | 1 + .../book/backend/domain/opentalk/service/OpentalkService.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/book/backend/domain/message/repository/MessageRepository.java b/src/main/java/com/book/backend/domain/message/repository/MessageRepository.java index 54883d6a..34e693c0 100644 --- a/src/main/java/com/book/backend/domain/message/repository/MessageRepository.java +++ b/src/main/java/com/book/backend/domain/message/repository/MessageRepository.java @@ -12,6 +12,7 @@ @Repository public interface MessageRepository extends JpaRepository { List findTop200ByOrderByCreatedAtDesc(); + List findTop50ByOrderByCreatedAtDesc(); // 특정 opentalk Id 를 갖는 데이터 조회 (페이지네이션) Page findAllByOpentalk(Opentalk opentalk, Pageable pageable); diff --git a/src/main/java/com/book/backend/domain/opentalk/service/OpentalkService.java b/src/main/java/com/book/backend/domain/opentalk/service/OpentalkService.java index 2ee43e2d..bd077160 100644 --- a/src/main/java/com/book/backend/domain/opentalk/service/OpentalkService.java +++ b/src/main/java/com/book/backend/domain/opentalk/service/OpentalkService.java @@ -49,7 +49,7 @@ public class OpentalkService { /* message 테이블에서 최근 200개 데이터 조회 -> opentalkId 기준으로 count 해서 가장 빈번하게 나오는 top 5 id 반환*/ public List getHotOpentalkIds() { log.trace("OpentalkService > hotOpentalk()"); - List recent200Messages = messageRepository.findTop200ByOrderByCreatedAtDesc(); + List recent200Messages = messageRepository.findTop50ByOrderByCreatedAtDesc(); // (key : opentalk_id, value : 출현빈도) Map opentalkIdCountMap = recent200Messages.stream().collect(