From 1f66defb6e0fadfbcb3f8e1461f0caab1f16876d Mon Sep 17 00:00:00 2001 From: Caps <279205343@qq.com> Date: Wed, 25 Dec 2019 15:19:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E7=AE=A1=E7=90=86=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ProductManageController.java | 17 ++--------------- .../polaris/service/ProductBaseService.java | 11 +++-------- .../service/impl/ProductBaseServiceImpl.java | 15 ++++++--------- 3 files changed, 11 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/hxtec/polaris/controller/ProductManageController.java b/src/main/java/com/hxtec/polaris/controller/ProductManageController.java index ebeaa1f..9115266 100644 --- a/src/main/java/com/hxtec/polaris/controller/ProductManageController.java +++ b/src/main/java/com/hxtec/polaris/controller/ProductManageController.java @@ -76,19 +76,6 @@ public class ProductManageController { return Result.ok("success"); } - /** - * 根据分类获取spu信息 - * @param catalogId - * @return - */ - @GetMapping("spuList") - @ApiOperation(value="根据分类获取spu信息", notes="根据分类获取spu信息") - @ResponseBody - public Result spuList(String catalogId){ - List pmsProductInfos = spuService.spuList(catalogId); - return Result.ok(pmsProductInfos); - } - /** * 根据二级分类获取三级分类 @@ -151,8 +138,8 @@ public class ProductManageController { @GetMapping("getSpuListInfo") @ApiOperation(value="spu列表信息", notes="spu列表信息") @ResponseBody - public Result spuInfoList(Integer currentPage,Integer pageSize,String productName){ - PageInfo spuList=spuService.getSpuListInfo(currentPage,pageSize,productName); + public Result spuInfoList(Integer currentPage,Integer pageSize,String productName,String productCode,String catalogId){ + PageInfo spuList=spuService.getSpuListInfo(currentPage,pageSize,productName,productCode,catalogId); return Result.ok(spuList); } diff --git a/src/main/java/com/hxtec/polaris/service/ProductBaseService.java b/src/main/java/com/hxtec/polaris/service/ProductBaseService.java index 974d7f2..025703c 100644 --- a/src/main/java/com/hxtec/polaris/service/ProductBaseService.java +++ b/src/main/java/com/hxtec/polaris/service/ProductBaseService.java @@ -22,13 +22,6 @@ public interface ProductBaseService { */ void saveSpuInfo(ShopProductBase pmsProductInfo); - /** - * 显示分类列表下的spu - * @param catalogId - * @return - */ - List spuList(String catalogId); - /** * 获取spu图片列表 * @param spuId @@ -36,5 +29,7 @@ public interface ProductBaseService { */ List spuImageList(String spuId); - PageInfo getSpuListInfo(Integer currentPage, Integer pageSize, String productName); + PageInfo getSpuListInfo(Integer currentPage, Integer pageSize, String productName,String productCode,String catalogId); + + } diff --git a/src/main/java/com/hxtec/polaris/service/impl/ProductBaseServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/ProductBaseServiceImpl.java index e118854..ecc2e74 100644 --- a/src/main/java/com/hxtec/polaris/service/impl/ProductBaseServiceImpl.java +++ b/src/main/java/com/hxtec/polaris/service/impl/ProductBaseServiceImpl.java @@ -8,6 +8,7 @@ import com.hxtec.polaris.mapper.ShopProductImageMapper; import com.hxtec.polaris.mapper.ShopProductSaleAttrMapper; import com.hxtec.polaris.mapper.ShopProductSaleAttrValueMapper; import com.hxtec.polaris.service.ProductBaseService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import tk.mybatis.mapper.entity.Example; @@ -76,13 +77,6 @@ public class ProductBaseServiceImpl implements ProductBaseService { } - @Override - public List spuList(String catalogId) { - Example example=new Example(ShopProductVariant.class); - example.createCriteria().andEqualTo("categoryId",catalogId); - return spuMapper.selectByExample(example); - } - @Override public List spuImageList(String spuId) { Example example=new Example(ShopProductImage.class); @@ -91,12 +85,15 @@ public class ProductBaseServiceImpl implements ProductBaseService { } @Override - public PageInfo getSpuListInfo(Integer currentPage, Integer pageSize, String productName) { + public PageInfo getSpuListInfo(Integer currentPage, Integer pageSize, String productName,String productCode,String catalogId) { Example example=new Example(ShopProductBase.class); example.createCriteria() - .andLike("name",productName!=null?"%"+productName+"%":null); + .andEqualTo("categoryId",StringUtils.isNotEmpty(catalogId) ?catalogId:null) + .andLike("name", StringUtils.isNotEmpty(productName) ?"%"+productName+"%":null) + .andEqualTo("spu",StringUtils.isNotEmpty(productCode)?productCode:null); PageHelper.startPage(currentPage,pageSize); PageInfo pageInfo=new PageInfo<>(spuMapper.selectByExample(example)); return pageInfo; } + } -- Gitee