From 86e41765f59e7046278c37774c7fc6e573dea840 Mon Sep 17 00:00:00 2001 From: s-choi Date: Thu, 17 Sep 2026 14:52:24 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]=20JPQL=E3=81=AE=E5=A4=89=E6=95=B0?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/app/infra/repository/TransactionRepository.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java b/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java index c747917..5fe10a1 100644 --- a/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java +++ b/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java @@ -13,13 +13,13 @@ public interface TransactionRepository extends JpaRepository findByUserIdAndDate(LocalDate todayDate, Long userId); - @Query("select t from TransactionEntity t where (t.transactionDate between :startDate and :endDate) and (t.userId = :userId) order by t.transactionDate asc") + @Query("select t from TransactionEntity t where (t.transactionDate between :startDate and :endDate) and (t.userEntity.userId = :userId) order by t.transactionDate asc") public List findAllByDateAndUserId(LocalDate startDate, LocalDate endDate, Long userId); - @Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryId = c.categoryId where (t.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 0") + @Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryEntity.categoryId = c.categoryId where (t.userEntity.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 0") public Integer findTotalExpense(LocalDate startDate, LocalDate endDate, Long userId); - @Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryId = c.categoryId where (t.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 1") + @Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryEntity.categoryId = c.categoryId where (t.userEntity.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 1") public Integer findTotalIncome(LocalDate startDate, LocalDate endDate, Long userId); @Query("select sum(t.amount) from TransactionEntity t where t.userEntity.userId = :userId and t.categoryEntity.categoryId = :categoryId and t.transactionDate between :startDate and :endDate")