From 133c2f894ff62b12677cdab0952b2fafa1a619c7 Mon Sep 17 00:00:00 2001 From: Gouyeon Chung Date: Fri, 13 Sep 2024 02:00:49 +0900 Subject: [PATCH] =?UTF-8?q?FIX=20:=20=EC=9D=B8=EA=B8=B0=EC=88=9C=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=20=EC=A1=B0=ED=9A=8C=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=ED=8B=B0=EB=B8=8C=20=EC=BF=BC=EB=A6=AC=20=EB=AC=B8=EB=B2=95=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../news/repository/NewsRepository.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/kkokkomu/short_news/news/repository/NewsRepository.java b/src/main/java/com/kkokkomu/short_news/news/repository/NewsRepository.java index 78f9bb8..a0d1b56 100644 --- a/src/main/java/com/kkokkomu/short_news/news/repository/NewsRepository.java +++ b/src/main/java/com/kkokkomu/short_news/news/repository/NewsRepository.java @@ -121,13 +121,13 @@ Page findFirstPageByCategoryOrderByIdDesc( SELECT n.* FROM news n LEFT JOIN comment c ON n.id = c.news_id LEFT JOIN news_reaction r ON n.id = r.news_id - WHERE (n.viewCnt * :viewWeight + COUNT(c.id) * :commentWeight + COUNT(r.id) * :reactionWeight + n.sharedCnt * :shareWeight + - TIMESTAMPDIFF(DAY, n.createdAt, CURRENT_TIMESTAMP) * :dateWeight) < :cursorScore - OR ((n.viewCnt * :viewWeight + COUNT(c.id) * :commentWeight + COUNT(r.id) * :reactionWeight + n.sharedCnt * :shareWeight + - TIMESTAMPDIFF(DAY, n.createdAt, CURRENT_TIMESTAMP) * :dateWeight) = :cursorScore AND n.id < :cursorId) + WHERE (n.view_cnt * :viewWeight + COUNT(c.id) * :commentWeight + COUNT(r.id) * :reactionWeight + n.shared_cnt * :shareWeight + + TIMESTAMPDIFF(DAY, n.created_at, CURRENT_TIMESTAMP) * :dateWeight) < :cursorScore + OR ((n.view_cnt * :viewWeight + COUNT(c.id) * :commentWeight + COUNT(r.id) * :reactionWeight + n.shared_cnt * :shareWeight + + TIMESTAMPDIFF(DAY, n.created_at, CURRENT_TIMESTAMP) * :dateWeight) = :cursorScore AND n.id < :cursorId) GROUP BY n.id - ORDER BY (n.viewCnt * :viewWeight + COUNT(c.id) * :commentWeight + COUNT(r.id) * :reactionWeight + n.sharedCnt * :shareWeight + - TIMESTAMPDIFF(DAY, n.createdAt, CURRENT_TIMESTAMP) * :dateWeight) DESC, n.id DESC + ORDER BY (n.view_cnt * :viewWeight + COUNT(c.id) * :commentWeight + COUNT(r.id) * :reactionWeight + n.shared_cnt * :shareWeight + + TIMESTAMPDIFF(DAY, n.created_at, CURRENT_TIMESTAMP) * :dateWeight) DESC, n.id DESC """, nativeQuery = true) Page findByPopularityLessThan( @Param("viewWeight") double viewWeight, @@ -146,8 +146,8 @@ Page findByPopularityLessThan( LEFT JOIN comment c ON n.id = c.news_id LEFT JOIN news_reaction r ON n.id = r.news_id GROUP BY n.id - ORDER BY (n.viewCnt * :viewWeight + COUNT(c.id) * :commentWeight + COUNT(r.id) * :reactionWeight + n.sharedCnt * :shareWeight + - TIMESTAMPDIFF(DAY, n.createdAt, CURRENT_TIMESTAMP) * :dateWeight) DESC, n.id DESC + ORDER BY (n.view_cnt * :viewWeight + COUNT(c.id) * :commentWeight + COUNT(r.id) * :reactionWeight + n.shared_cnt * :shareWeight + + TIMESTAMPDIFF(DAY, n.created_at, CURRENT_TIMESTAMP) * :dateWeight) DESC, n.id DESC """, nativeQuery = true) Page findFirstPageByPopularity( @Param("viewWeight") double viewWeight,