Interface ProductRepo

All Superinterfaces:
org.springframework.data.repository.CrudRepository<ProductEntity,Integer>, JpaRepository<ProductEntity,Integer>, org.springframework.data.repository.ListCrudRepository<ProductEntity,Integer>, org.springframework.data.repository.ListPagingAndSortingRepository<ProductEntity,Integer>, org.springframework.data.repository.PagingAndSortingRepository<ProductEntity,Integer>, org.springframework.data.repository.query.QueryByExampleExecutor<ProductEntity>, org.springframework.data.repository.Repository<ProductEntity,Integer>

public interface ProductRepo extends JpaRepository<ProductEntity,Integer>
Author:
Liang123456123
  • Method Details

    • findByProductNameContaining

      org.springframework.data.domain.Page<ProductEntity> findByProductNameContaining(String productName, org.springframework.data.domain.Pageable pageable)
    • findProductsByFilter

      @Query("SELECT p FROM ProductEntity p WHERE (:categoryId IS NULL OR p.productCategory.categoryId = :categoryId) AND (:minPrice IS NULL OR p.price >= :minPrice) AND (:maxPrice IS NULL OR p.price <= :maxPrice) AND (p.status = 1 OR p.status = 2) AND (:productName IS NULL OR p.productName LIKE %:productName%)") org.springframework.data.domain.Page<ProductEntity> findProductsByFilter(@Param("categoryId") Integer categoryId, @Param("minPrice") Integer minPrice, @Param("maxPrice") Integer maxPrice, @Param("productName") String productName, org.springframework.data.domain.Pageable pageable)
    • findRecommendedProductsByTag

      @Query("SELECT p FROM ProductEntity p WHERE p.productTag.tagId = :tagId AND p.productID != :currentProductId AND p.status = 1 ORDER BY p.createdDate DESC LIMIT 3") List<ProductEntity> findRecommendedProductsByTag(@Param("tagId") Integer tagId, @Param("currentProductId") Integer currentProductId)