Skip to content

Commit 7118e76

Browse files
committed
fix: 네이티브 쿼리들 수정
1 parent 7e6865a commit 7118e76

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/moaguide/domain/ArticleContent/ArticleContentRepository.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ public interface ArticleContentRepository extends JpaRepository<ArticleContent,
5656
"CASE WHEN LENGTH(c.paywallUp) > 150 THEN CONCAT(SUBSTRING(c.paywallUp, 1, 150), '...') ELSE c.paywallUp END, " +
5757
"c.imgLink, cat.name) " +
5858
"FROM ArticleContent c JOIN c.categoryId cat " +
59-
"WHERE c.categoryId.categoryId = :categoryId AND c.createdAt <= CONVERT_TZ(NOW(), '+00:00', '+09:00') " +
59+
"WHERE c.categoryId = :categoryId AND c.createdAt <= CONVERT_TZ(NOW(), '+00:00', '+09:00') " +
6060
"ORDER BY c.createdAt DESC", nativeQuery = true)
6161
Page<ArticleOverviewDto> findByCategory(@Param("categoryId") int categoryId, Pageable pageable);
6262

6363
// 랜덤으로 3개의 관련 아티클 가져오기
6464
@Query(value =
6565
"SELECT new com.moaguide.dto.NewDto.ArticleContentDto.RelatedContentDto(c.articleId, c.title, c.imgLink, c.createdAt, c.views, " +
66-
"(SELECT CAST(COUNT(al) AS long) FROM ArticleLike al WHERE al.article.articleId = c.articleId)) " +
66+
"(SELECT CAST(COUNT(al) AS long) FROM ArticleLike al WHERE al.article = c.articleId)) " +
6767
"FROM ArticleContent c " +
68-
"WHERE c.categoryId.categoryId = :categoryId AND c.articleId != :articleId " +
68+
"WHERE c.categoryId = :categoryId AND c.articleId != :articleId " +
6969
"ORDER BY FUNCTION('RAND')", nativeQuery = true)
7070
List<RelatedContentDto> findRelatedArticles(@Param("categoryId") Long categoryId, @Param("articleId") Long articleId);
7171

0 commit comments

Comments
 (0)