|
|
@@ -73,15 +73,15 @@ public class ProductServiceImpl implements ProductService {
|
|
|
|
|
|
@Override
|
|
|
public List<ProductVO> getProductsWithCondition(String name, CategoryEnum category, Double price) {
|
|
|
- String condition="SELECT * FROM Product WHERE 1=1";
|
|
|
+ String condition="SELECT p FROM Product p WHERE 1=1";
|
|
|
if (name!=null && name.length()>0){
|
|
|
- condition=condition.concat("AND name = :name");
|
|
|
+ condition=condition.concat(" AND name = :name");
|
|
|
}
|
|
|
if (category!=null){
|
|
|
- condition=condition.concat("AND category = :category");
|
|
|
+ condition=condition.concat(" AND category = :category");
|
|
|
}
|
|
|
if (price!=null && price>0){
|
|
|
- condition=condition.concat("AND price <= :price");
|
|
|
+ condition=condition.concat(" AND price <= :price");
|
|
|
}
|
|
|
Query query=entityManager.createQuery(condition);
|
|
|
if (name!=null && name.length()>0){
|