既存のrecipeStuffsRepository.javaを削除したら、本来のrecipesStuffsRepositoryをrecipeStuffsRepositorに変わる 2. tobuy/addByRecipeを実装しましたfeature-backend-tobuy-addByRecipe
parent
fed5a2e923
commit
e3ba1d5b49
@ -1,27 +1,37 @@ |
|||||||
//--------------------------------
|
|
||||||
// RecipeStuffsRepository.java
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// 更新履歴:2025/06/10 新規作成
|
|
||||||
// Copyright(c) 2025 IVIS All rights reserved.
|
|
||||||
//--------------------------------------------
|
|
||||||
package com.example.todoapp.repository; |
package com.example.todoapp.repository; |
||||||
|
|
||||||
import com.example.todoapp.model.RecipeStuffs; |
import java.util.List; |
||||||
|
import java.util.Optional; |
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository; |
import org.springframework.data.jpa.repository.JpaRepository; |
||||||
import org.springframework.stereotype.Repository; |
|
||||||
|
import com.example.todoapp.model.RecipeStuffs; |
||||||
|
|
||||||
/** |
/** |
||||||
* 料理-材料エンティティのリポジトリインターフェース |
* レシピ食材関連データのリポジトリインターフェース |
||||||
* <p> |
* <p> |
||||||
* このインターフェースは料理-材料データへのアクセスと操作を提供します。 |
* このインターフェースはレシピと食材の関連データへのアクセスを提供します。 |
||||||
* Spring Data JPAによって自動的に実装されます。 |
* Spring Data JPAによって自動的に実装されます。 |
||||||
* </p> |
* </p> |
||||||
*/ |
*/ |
||||||
|
|
||||||
@Repository |
|
||||||
public interface RecipeStuffsRepository extends JpaRepository<RecipeStuffs, Long> { |
public interface RecipeStuffsRepository extends JpaRepository<RecipeStuffs, Long> { |
||||||
|
/** |
||||||
} |
* レシピIDで食材情報を検索する |
||||||
|
* |
||||||
|
* @param recipeId 検索するレシピID |
||||||
|
* @return 関連する食材情報リスト |
||||||
|
*/ |
||||||
|
List<RecipeStuffs> findByRecipesRecipeId(Long recipeId); |
||||||
|
|
||||||
|
/** |
||||||
|
* レシピIDと食材IDで関連情報を検索する |
||||||
|
* |
||||||
|
* @param recipeId 検索するレシピID |
||||||
|
* @param stuffId 検索する食材ID |
||||||
|
* @return 関連情報(存在する場合) |
||||||
|
*/ |
||||||
|
Optional<RecipeStuffs> findByRecipesRecipeIdAndStuffStuffId(Long recipeId, Long stuffId); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,37 +0,0 @@ |
|||||||
package com.example.todoapp.repository; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
import java.util.Optional; |
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository; |
|
||||||
|
|
||||||
import com.example.todoapp.model.RecipeStuffs; |
|
||||||
|
|
||||||
/** |
|
||||||
* レシピ食材関連データのリポジトリインターフェース |
|
||||||
* <p> |
|
||||||
* このインターフェースはレシピと食材の関連データへのアクセスを提供します。 |
|
||||||
* Spring Data JPAによって自動的に実装されます。 |
|
||||||
* </p> |
|
||||||
*/ |
|
||||||
public interface RecipesStuffsRepository extends JpaRepository<RecipeStuffs, Long> { |
|
||||||
/** |
|
||||||
* レシピIDで食材情報を検索する |
|
||||||
* |
|
||||||
* @param recipeId 検索するレシピID |
|
||||||
* @return 関連する食材情報リスト |
|
||||||
*/ |
|
||||||
List<RecipeStuffs> findByRecipesRecipeId(Long recipeId); |
|
||||||
|
|
||||||
/** |
|
||||||
* レシピIDと食材IDで関連情報を検索する |
|
||||||
* |
|
||||||
* @param recipeId 検索するレシピID |
|
||||||
* @param stuffId 検索する食材ID |
|
||||||
* @return 関連情報(存在する場合) |
|
||||||
*/ |
|
||||||
Optional<RecipeStuffs> findByRecipesRecipeIdAndStuffStuffId(Long recipeId, Long stuffId); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in new issue