ToBuyRepository.findByUserIdOrderByTobuyIdAsc をs修正しました

feature-frontend-ama^2
zhang.pengcheng 4 months ago
parent e3ba1d5b49
commit c3e8edeeac
  1. 6
      backend/src/main/java/com/example/todoapp/repository/ToBuysRepository.java

@ -40,13 +40,13 @@ public interface ToBuysRepository extends JpaRepository<ToBuys, Integer> {
ToBuys findByTobuyId(Long tobuyId); ToBuys findByTobuyId(Long tobuyId);
/** /**
* 指定されたユーザーIDに基づいて買うものリストを取得する * 指定されたユーザーIDに基づいて買うものリストを取得する_tobuyIdの順番
* *
* @param userId ユーザーID * @param userId ユーザーID
* @return 買うものリスト * @return 買うものリスト
*/ */
@Query("SELECT t FROM ToBuys t WHERE t.user.id = ?1") @Query("SELECT t FROM ToBuys t WHERE t.user.id = :userId ORDER BY t.tobuyId ASC")
List<ToBuys> findByUserIdOrderByTobuyIdAsc(Long userId); List<ToBuys> findByUserIdOrderByTobuyIdAsc(@Param("userId") Long userId);
/** /**
* 指定された買うものIDに基づいて買うものリストを削除 * 指定された買うものIDに基づいて買うものリストを削除

Loading…
Cancel
Save