[EDIT]transactionRepositoryにカテゴリ別集計を追記しました。

This commit is contained in:
2026-09-17 13:00:25 +09:00
parent fbd1746776
commit d65a84ea79

View File

@@ -22,5 +22,6 @@ public interface TransactionRepository extends JpaRepository<TransactionEntity,
@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")
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")
public Integer findCategoryExpense(LocalDate startDate, LocalDate endDate, Long userId, Long categoryId);
}