Interface ItemRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Item,Long>, org.springframework.data.jpa.repository.JpaRepository<Item,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Item>, org.springframework.data.repository.ListCrudRepository<Item,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Item,Long>, org.springframework.data.repository.PagingAndSortingRepository<Item,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Item>, org.springframework.data.repository.Repository<Item,Long>

@Repository public interface ItemRepository extends org.springframework.data.jpa.repository.JpaRepository<Item,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Item>
This repository provides CRUD operations for the Item entity. It extends JpaRepository and JpaSpecificationExecutor interfaces. JpaRepository provides basic CRUD operations while JpaSpecificationExecutor provides search functionality using specifications.
  • Method Details

    • findByItemId

      Optional<Item> findByItemId(Long itemId)
      Finds an item by its items ID.
      Parameters:
      itemId - the ID of the item to find
      Returns:
      an Optional containing the item with the given ID, or an empty Optional if no such item exists
    • findByProductNameAndStore

      Optional<Item> findByProductNameAndStore(String name, Store store)
      Finds an item by its item name and store.
      Parameters:
      name - the name of the item to find
      store - the store to use
      Returns:
      an Optional containing the item with the given name and store, or an empty Optional if no such item exists
    • findItemsByStore

      Optional<List<Item>> findItemsByStore(Store store)
      Finds a list of items by their store.
      Parameters:
      store - the store of the items to find
      Returns:
      an Optional containing the list of items with the given main category, or an empty Optional if no such items exist
    • findItemsByDescContainingIgnoreCase

      Optional<List<Item>> findItemsByDescContainingIgnoreCase(String phrase)
      Finds a list of items whose brief description contains the given phrase, ignoring case.
      Parameters:
      phrase - the phrase to search for
      Returns:
      an Optional containing the list of items whose brief description contains the given phrase, or an empty Optional if no such items exist
    • findItemByProductName

      Optional<Item> findItemByProductName(String productName)
      Finds an items by their product name.
      Parameters:
      productName - the product name to search for
      Returns:
      an Optional containing the items with the given product name, or an empty Optional if no such items exist
    • findItemsByPriceLessThan

      Optional<List<Item>> findItemsByPriceLessThan(double price)
      Finds a list of items whose price is less than the given price.
      Parameters:
      price - the maximum price of the items to find
      Returns:
      an Optional containing the list of items whose price is less than the given price, or an empty Optional if no such items exist
    • findItemsByPriceLessThanEqual

      Optional<List<Item>> findItemsByPriceLessThanEqual(double price)
      Finds items with prices less than or equal to the given price.
      Parameters:
      price - The maximum price to search for.
      Returns:
      An optional list of items with prices less than or equal to the given price.
    • findItemsByPriceGreaterThan

      Optional<List<Item>> findItemsByPriceGreaterThan(double price)
      Finds items with prices greater than the given price.
      Parameters:
      price - The minimum price to search for.
      Returns:
      An optional list of items with prices greater than the given price.
    • findItemsByPriceGreaterThanEqual

      Optional<List<Item>> findItemsByPriceGreaterThanEqual(double price)
      Finds items with prices greater than or equal to the given price.
      Parameters:
      price - The minimum price to search for.
      Returns:
      An optional list of items with prices greater than or equal to the given price.
    • findItemsByPriceBetween

      Optional<List<Item>> findItemsByPriceBetween(double lowerBound, double upperBound)
      Finds items with prices between the given lower and upper bounds (inclusive).
      Parameters:
      lowerBound - The lower bound of the price range.
      upperBound - The upper bound of the price range.
      Returns:
      An optional list of items with prices between the given lower and upper bounds.
    • findItemsByEan

      Optional<List<Item>> findItemsByEan(String ean)
      This method finds items with a given ean.
      Parameters:
      ean - The ean to be checked, given as String.
      Returns:
      An optional list of items containing the ean provided.
    • findItemByEanAndStore_StoreName

      Optional<Item> findItemByEanAndStore_StoreName(String ean, String storeName)
      This method finds items with a given ean.
      Parameters:
      ean - The ean to be checked, given as String.
      storeName - Name of the store, given as a String.
      Returns:
      An optional list of items containing the ean provided.
    • findItemByProductNameAndStore_StoreName

      Optional<Item> findItemByProductNameAndStore_StoreName(String productName, String storeName)
      This method finds items with a given store name and product name.
      Parameters:
      productName - Name of the product, given as a String.
      storeName - Name of the store, given as a String.
      Returns:
      An optional list of items containing the ean provided.