From 8bfcdf2bf3761ae0ca7bfe75200d430a2302f697 Mon Sep 17 00:00:00 2001 From: kang Date: Tue, 30 Apr 2024 16:00:17 +0900 Subject: [PATCH] fix: rename query field --- src/main/java/zero/eight/donut/repository/GiftRepository.java | 4 ++-- .../java/zero/eight/donut/repository/MessageRepository.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/zero/eight/donut/repository/GiftRepository.java b/src/main/java/zero/eight/donut/repository/GiftRepository.java index 375bdbd..fdef782 100644 --- a/src/main/java/zero/eight/donut/repository/GiftRepository.java +++ b/src/main/java/zero/eight/donut/repository/GiftRepository.java @@ -28,9 +28,9 @@ public interface GiftRepository extends JpaRepository { @Query(value = "SELECT * FROM gift g WHERE g.auto_donation = true AND g.status = 'STORED' AND g.giver_id = :giverId AND g.due_date >= :today", nativeQuery = true) List findAllByGiverAndStatusAndDueDateAfterOrToday(@Param("giverId") Long giverId, @Param("today") LocalDateTime today); - @Query(value = "SELECT COUNT(g) FROM gift g WHERE g.giver_id = :giverId AND g.is_assigned = false", nativeQuery = true) + @Query(value = "SELECT COUNT(*) FROM gift g WHERE g.giver_id = :giverId AND g.is_assigned = false", nativeQuery = true) int findNotAssignedByGiverIdAndIsAssigned(@Param("giverId") Long giverId); - @Query(value = "SELECT COUNT(g) FROM gift g WHERE g.giver_id = :giverId AND g.is_assigned = true", nativeQuery = true) + @Query(value = "SELECT COUNT(*) FROM gift g WHERE g.giver_id = :giverId AND g.is_assigned = true", nativeQuery = true) int findIsAssignedByGiverIdAndIsAssigned(@Param("giverId") Long giverId); } diff --git a/src/main/java/zero/eight/donut/repository/MessageRepository.java b/src/main/java/zero/eight/donut/repository/MessageRepository.java index 60767a0..4b822a2 100644 --- a/src/main/java/zero/eight/donut/repository/MessageRepository.java +++ b/src/main/java/zero/eight/donut/repository/MessageRepository.java @@ -8,6 +8,6 @@ public interface MessageRepository extends JpaRepository { Message findByGiftId(Long giftId); - @Query(value = "SELECT COUNT(m) FROM message m WHERE m.giver_id = :giverId", nativeQuery = true) + @Query(value = "SELECT COUNT(*) FROM message m WHERE m.giver_id = :giverId", nativeQuery = true) int countByGiverId(@Param("giverId") Long giverId); }