You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
package com.mousetech.gourmetj.persistence.dao;
|
|
|
|
import java.util.List;
|
|
|
|
import org.springframework.data.jpa.repository.EntityGraph;
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
import org.springframework.data.jpa.repository.Query;
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
import com.mousetech.gourmetj.persistence.model.Category;
|
|
import com.mousetech.gourmetj.persistence.model.Recipe;
|
|
|
|
/**
|
|
* JpaRepository for Recipes, which relate OneToMany for
|
|
* Ingredients and Categories.
|
|
*
|
|
* Service method is @see RecipeService
|
|
*
|
|
* @author timh
|
|
* @since Dec 28, 2021
|
|
*/
|
|
|
|
@Repository
|
|
public interface RecipeRepository
|
|
extends JpaRepository<Recipe, Long> {
|
|
|
|
List<Recipe> findByTitleContaining(String searchText);
|
|
|
|
@EntityGraph(value="Recipe.findWorkingSet")
|
|
public Recipe findDetailsById(Long recipeId);
|
|
|
|
@Query(name = "Recipe.findCusines", nativeQuery = true)
|
|
List<String> FindCuisinesNative();
|
|
|
|
List<Recipe> findByCategories_CategoryContains(String searchText);
|
|
|
|
List<Recipe> findByCuisineContains(String searchText);
|
|
|
|
List<Recipe> findDistinctByIngredientHash_ItemContains(
|
|
String searchText);
|
|
|
|
}
|
|
|