Package com.mt.ecommerce.product.service
Class ProductService
java.lang.Object
com.mt.ecommerce.product.service.ProductService
Service class for managing products.
Provides methods for adding, updating, deleting, and retrieving products.
-
Constructor Summary
ConstructorsConstructorDescriptionProductService
(ProductRepository productRepository, ImageProductRepository imageProductRepository, ImageRepository imageRepository) -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteProduct
(UUID productId) Deletes a product by its ID.getProduct
(UUID vendorId, int pageNo, int size) Retrieves products for a specific vendor with pagination.getProduct
(UUID vendorId, UUID categoryId, int pageNo, int size) Retrieves products for a specific vendor and category with pagination.saveProduct
(ProductBO productBO, String userName) Saves a new product.void
updateProduct
(ProductBO productBO, String userName) Updates an existing product.
-
Constructor Details
-
ProductService
public ProductService(ProductRepository productRepository, ImageProductRepository imageProductRepository, ImageRepository imageRepository)
-
-
Method Details
-
updateProduct
Updates an existing product.- Parameters:
productBO
- the product information to updateuserName
- the username of the user updating the product
-
saveProduct
Saves a new product.- Parameters:
productBO
- the product information to saveuserName
- the username of the user saving the product- Returns:
- the saved ProductBO with generated ID
-
deleteProduct
Deletes a product by its ID.- Parameters:
productId
- the ID of the product to delete
-
getProduct
Retrieves products for a specific vendor with pagination.- Parameters:
vendorId
- the ID of the vendor whose products are to be retrievedpageNo
- the page number for paginationsize
- the number of records per page- Returns:
- a list of ProductBO objects representing the vendor's products
-
getProduct
Retrieves products for a specific vendor and category with pagination.- Parameters:
vendorId
- the ID of the vendor whose products are to be retrievedcategoryId
- the ID of the category to filter productspageNo
- the page number for paginationsize
- the number of records per page- Returns:
- a list of ProductBO objects representing the vendor's products in the specified category
-