fix product search matching descriptions
This commit is contained in:
@@ -23,7 +23,7 @@ public interface ProductRepository extends JpaRepository<Product, Long> {
|
|||||||
boolean existsByProdNameIgnoreCaseAndProdIdNot(String prodName, Long prodId);
|
boolean existsByProdNameIgnoreCaseAndProdIdNot(String prodName, Long prodId);
|
||||||
|
|
||||||
@Query("SELECT p FROM Product p WHERE " +
|
@Query("SELECT p FROM Product p WHERE " +
|
||||||
"(:q IS NULL OR LOWER(p.prodName) LIKE LOWER(CONCAT('%', :q, '%')) OR LOWER(COALESCE(p.prodDesc, '')) LIKE LOWER(CONCAT('%', :q, '%'))) AND " +
|
"(:q IS NULL OR LOWER(p.prodName) LIKE LOWER(CONCAT('%', :q, '%')) OR LOWER(p.category.categoryName) LIKE LOWER(CONCAT('%', :q, '%'))) AND " +
|
||||||
"(:categoryId IS NULL OR p.category.categoryId = :categoryId)")
|
"(:categoryId IS NULL OR p.category.categoryId = :categoryId)")
|
||||||
Page<Product> searchProducts(@Param("q") String query, @Param("categoryId") Long categoryId, Pageable pageable);
|
Page<Product> searchProducts(@Param("q") String query, @Param("categoryId") Long categoryId, Pageable pageable);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user