From c3e8edeeacb69cde6e349845697a57cf50a333ce Mon Sep 17 00:00:00 2001 From: "zhang.pengcheng" Date: Thu, 12 Jun 2025 16:04:30 +0900 Subject: [PATCH] =?UTF-8?q?ToBuyRepository.findByUserIdOrderByTobuyIdAsc?= =?UTF-8?q?=20=E3=82=92=EF=BD=93=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=BE?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/todoapp/repository/ToBuysRepository.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/com/example/todoapp/repository/ToBuysRepository.java b/backend/src/main/java/com/example/todoapp/repository/ToBuysRepository.java index d9b6861..0778f5f 100644 --- a/backend/src/main/java/com/example/todoapp/repository/ToBuysRepository.java +++ b/backend/src/main/java/com/example/todoapp/repository/ToBuysRepository.java @@ -40,13 +40,13 @@ public interface ToBuysRepository extends JpaRepository { ToBuys findByTobuyId(Long tobuyId); /** - * 指定されたユーザーIDに基づいて「買うもの」リストを取得する + * 指定されたユーザーIDに基づいて「買うもの」リストを取得する_(tobuyIdの順番) * * @param userId ユーザーID * @return 「買うもの」リスト */ - @Query("SELECT t FROM ToBuys t WHERE t.user.id = ?1") - List findByUserIdOrderByTobuyIdAsc(Long userId); + @Query("SELECT t FROM ToBuys t WHERE t.user.id = :userId ORDER BY t.tobuyId ASC") + List findByUserIdOrderByTobuyIdAsc(@Param("userId") Long userId); /** * 指定された「買うもの」IDに基づいて「買うもの」リストを削除