Merge remote-tracking branch 'origin/develop-backend' into develop-frontend

feature-frontend-stock
Masaharu.Kato 4 months ago
commit dc98e34b3d
  1. 8
      backend/src/main/java/com/example/todoapp/repository/RecipeStuffsRepository.java
  2. 6
      backend/src/main/java/com/example/todoapp/repository/ToBuysRepository.java

@ -7,6 +7,13 @@ import org.springframework.data.jpa.repository.JpaRepository;
import com.example.todoapp.model.RecipeStuffs; import com.example.todoapp.model.RecipeStuffs;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
/** /**
* レシピ食材関連データのリポジトリインターフェース * レシピ食材関連データのリポジトリインターフェース
* <p> * <p>
@ -31,4 +38,5 @@ public interface RecipeStuffsRepository extends JpaRepository<RecipeStuffs, Long
* @return 関連情報存在する場合 * @return 関連情報存在する場合
*/ */
Optional<RecipeStuffs> findByRecipesRecipeIdAndStuffStuffId(Long recipeId, Long stuffId); Optional<RecipeStuffs> findByRecipesRecipeIdAndStuffStuffId(Long recipeId, Long stuffId);
} }

@ -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