Package org.salespointframework.catalog
Interface Catalog<T extends Product>
- All Superinterfaces:
CrudRepository<T,
,Product.ProductIdentifier> PagingAndSortingRepository<T,
,Product.ProductIdentifier> Repository<T,
,Product.ProductIdentifier> SalespointRepository<T,
Product.ProductIdentifier>
@Repository
public interface Catalog<T extends Product>
extends SalespointRepository<T,Product.ProductIdentifier>
Repository interface for
Product
s- Author:
- Oliver Gierke
-
Method Summary
Modifier and TypeMethodDescriptiondefault Streamable<T>
findByAllCategories
(String... categories) Returns allProduct
that are assigned to all given categories.findByAllCategories
(Collection<String> categories) Returns allProduct
that are assigned to all given categories.default Streamable<T>
findByAnyCategory
(String... categories) Returns allProduct
s that are assigned to any of the given categories.findByAnyCategory
(Collection<String> categories) Returns allProduct
s that are assigned to any of the given categories.findByCategory
(String category) Returns allProduct
s assigned to the given category.findByName
(String name) Returns theProduct
s with the given name.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll
Methods inherited from interface org.salespointframework.core.SalespointRepository
findAll, findAll, findAllById, saveAll
-
Method Details
-
findByCategory
@Query("select p from #{#entityName} p\n where :category member of p.categories\n") Streamable<T> findByCategory(String category) Returns allProduct
s assigned to the given category.- Parameters:
category
-- Returns:
-
findByAllCategories
Returns allProduct
that are assigned to all given categories.- Parameters:
categories
- must not be null.- Returns:
- Since:
- 7.1
-
findByAllCategories
@Query(" select p from #{#entityName} p\ninner join p.categories c\n where c in :categories\n group by p.id having count(p.id) = ?#{#categories.size().longValue()}\n") Streamable<T> findByAllCategories(Collection<String> categories) Returns allProduct
that are assigned to all given categories.- Parameters:
categories
- must not be null.- Returns:
- Since:
- 7.1
-
findByAnyCategory
Returns allProduct
s that are assigned to any of the given categories.- Parameters:
categories
- must not be null.- Returns:
- Since:
- 7.1
-
findByAnyCategory
@Query("select p from #{#entityName} p\n join p.categories c\n where c in :categories\n") Streamable<T> findByAnyCategory(Collection<String> categories) Returns allProduct
s that are assigned to any of the given categories.- Parameters:
categories
- must not be null.- Returns:
- Since:
- 7.1
-
findByName
Returns theProduct
s with the given name.- Parameters:
name
-- Returns:
-