From 751c34f39dca2e42174317c85db819cf0b8df70c Mon Sep 17 00:00:00 2001 From: James Zow Date: Mon, 27 May 2024 20:51:41 +0800 Subject: [PATCH] Fix keyword query errors --- .../mapper_xml/product/ProductStockMapper.xml | 31 ++++++++++++++++--- .../product/QueryProductStockKeepUnitDTO.java | 2 ++ .../product/impl/ProductServiceImpl.java | 7 +++++ 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/core/dao/src/main/resources/mapper_xml/product/ProductStockMapper.xml b/core/dao/src/main/resources/mapper_xml/product/ProductStockMapper.xml index 7116ae40..7cfb1210 100644 --- a/core/dao/src/main/resources/mapper_xml/product/ProductStockMapper.xml +++ b/core/dao/src/main/resources/mapper_xml/product/ProductStockMapper.xml @@ -21,11 +21,26 @@ diff --git a/core/domain/src/main/java/com/wansenai/dto/product/QueryProductStockKeepUnitDTO.java b/core/domain/src/main/java/com/wansenai/dto/product/QueryProductStockKeepUnitDTO.java index 38168353..dbeaf3d9 100644 --- a/core/domain/src/main/java/com/wansenai/dto/product/QueryProductStockKeepUnitDTO.java +++ b/core/domain/src/main/java/com/wansenai/dto/product/QueryProductStockKeepUnitDTO.java @@ -30,4 +30,6 @@ public class QueryProductStockKeepUnitDTO { private Long page; private Long pageSize; + + private String keywords; } diff --git a/core/service/src/main/java/com/wansenai/service/product/impl/ProductServiceImpl.java b/core/service/src/main/java/com/wansenai/service/product/impl/ProductServiceImpl.java index 68980643..398b068b 100644 --- a/core/service/src/main/java/com/wansenai/service/product/impl/ProductServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/product/impl/ProductServiceImpl.java @@ -280,6 +280,13 @@ public Response> getProductInfo(QueryProductDTO queryProductDTO) .like(StringUtils.hasLength(queryProductDTO.getExtendInfo()), Product::getOtherFieldOne, queryProductDTO.getExtendInfo()) .like(StringUtils.hasLength(queryProductDTO.getRemark()), Product::getRemark, queryProductDTO.getRemark()) .like(StringUtils.hasLength(queryProductDTO.getWarehouseShelves()), Product::getWarehouseShelves, queryProductDTO.getWarehouseShelves()) + .like(StringUtils.hasLength(queryProductDTO.getKeywords()), Product::getProductName, queryProductDTO.getKeywords()) + .or() + .like(StringUtils.hasLength(queryProductDTO.getKeywords()), Product::getProductStandard, queryProductDTO.getKeywords()) + .or() + .like(StringUtils.hasLength(queryProductDTO.getKeywords()), Product::getProductModel, queryProductDTO.getKeywords()) + .or() + .like(StringUtils.hasLength(queryProductDTO.getKeywords()), Product::getProductColor, queryProductDTO.getKeywords()) .eq(queryProductDTO.getProductCategoryId() != null, Product::getProductCategoryId, queryProductDTO.getProductCategoryId()) .eq(queryProductDTO.getStatus() != null, Product::getStatus, queryProductDTO.getStatus()) .eq(queryProductDTO.getEnableSerialNumber() != null, Product::getEnableSerialNumber, queryProductDTO.getEnableSerialNumber())