From 2cec6a92104432885eeacf2603f71503cd500309 Mon Sep 17 00:00:00 2001 From: dy-hu Date: Fri, 28 Jun 2024 15:34:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=AE=B6=E7=AB=AF=E6=8B=BC=E5=9B=A2?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E8=AE=BE=E7=BD=AE=E5=95=86=E5=93=81=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=96=B0=E5=A2=9E=E5=95=86=E5=93=81=E6=89=80=E5=B1=9E?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E6=98=BE=E7=A4=BA=E3=80=81=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/controller/ShopGroupWorkController.java | 4 ++-- .../business/dao/tool/CereShopGroupWorkDAO.java | 2 +- .../service/tool/CereShopGroupWorkService.java | 2 +- .../tool/impl/CereShopGroupWorkServiceImpl.java | 20 ++++++++++++++++++-- .../mybatis/mapper/tool/CereShopGroupWorkDAO.xml | 14 +++++++++----- 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopGroupWorkController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopGroupWorkController.java index 53a3cbc..836e82a 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopGroupWorkController.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopGroupWorkController.java @@ -164,10 +164,10 @@ public class ShopGroupWorkController { */ @PostMapping(value = "getProducts") @ApiOperation(value = "选择商品查询") - public Result> getProducts(@RequestBody ToolProductParam param, HttpServletRequest request) throws CoBusinessException{ + public Result> getProducts(@RequestBody ToolProductNewParam param, HttpServletRequest request) throws CoBusinessException{ //获取当前登录账户 CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); - param.setShopId(user.getBusinessId()); + param.setBusinessId(user.getBusinessId()); Page page=cereShopGroupWorkService.getProducts(param); return new Result(page); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopGroupWorkDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopGroupWorkDAO.java index 8d67f7f..2a8f656 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopGroupWorkDAO.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopGroupWorkDAO.java @@ -32,7 +32,7 @@ public interface CereShopGroupWorkDAO extends BaseMapper { ShopGroupWorkUDetail getById(@Param("shopGroupWorkId") Long shopGroupWorkId); - List getProducts(@Param("shopId") Long shopId, @Param("shopGroupWorkId") Long shopGroupWorkId); + List getProducts(@Param("shopId") Long shopId, @Param("shopGroupWorkId") Long shopGroupWorkId, @Param("searchContent") String searchContent); List getAll(ShopGroupWorkGetAllParam param); diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopGroupWorkService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopGroupWorkService.java index 4a1e1b1..e16f5f1 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopGroupWorkService.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopGroupWorkService.java @@ -27,7 +27,7 @@ public interface CereShopGroupWorkService { ShopGroupWorkUDetail getById(Long shopGroupWorkId) throws CoBusinessException; - Page getProducts(ToolProductParam param) throws CoBusinessException; + Page getProducts(ToolProductNewParam param) throws CoBusinessException; Page getAll(ShopGroupWorkGetAllParam param) throws CoBusinessException; diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopGroupWorkServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopGroupWorkServiceImpl.java index cb8e00b..84f9b5f 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopGroupWorkServiceImpl.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopGroupWorkServiceImpl.java @@ -5,6 +5,7 @@ */ package com.shop.cereshop.business.service.tool.impl; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.shop.cereshop.business.dao.tool.CereShopGroupWorkDAO; @@ -19,6 +20,7 @@ import com.shop.cereshop.business.service.order.CereShopOrderService; import com.shop.cereshop.business.service.platformtool.CerePlatformDiscountService; import com.shop.cereshop.business.service.platformtool.CerePlatformSeckillService; import com.shop.cereshop.business.service.redis.CereRedisKeyServcice; +import com.shop.cereshop.business.service.shop.CerePlatformShopService; import com.shop.cereshop.business.service.tool.CereShopGroupWorkDetailService; import com.shop.cereshop.business.service.tool.CereShopGroupWorkService; import com.shop.cereshop.commons.constant.CoReturnFormat; @@ -28,6 +30,7 @@ import com.shop.cereshop.commons.constant.StringEnum; import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser; import com.shop.cereshop.commons.domain.collage.CereCollageOrder; import com.shop.cereshop.commons.domain.common.Page; +import com.shop.cereshop.commons.domain.shop.CerePlatformShop; import com.shop.cereshop.commons.domain.tool.CereShopGroupWork; import com.shop.cereshop.commons.domain.tool.CereShopGroupWorkDetail; import com.shop.cereshop.commons.exception.CoBusinessException; @@ -81,6 +84,9 @@ public class CereShopGroupWorkServiceImpl implements CereShopGroupWorkService { @Autowired private ProjectInvokeUtil projectInvokeUtil; + @Autowired + private CerePlatformShopService platformShopService; + @Override @Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) public void save(ShopGroupWorkSaveParam param, CerePlatformBusinessUser user) throws CoBusinessException,Exception { @@ -382,9 +388,19 @@ public class CereShopGroupWorkServiceImpl implements CereShopGroupWorkService { } @Override - public Page getProducts(ToolProductParam param) throws CoBusinessException { + public Page getProducts(ToolProductNewParam param) throws CoBusinessException { PageHelper.startPage(param.getPage(),param.getPageSize()); - List list=cereShopGroupWorkDAO.getProducts(param.getShopId(), param.getActivityId()); + List list=cereShopGroupWorkDAO.getProducts(param.getBusinessId(), param.getActivityId(), param.getSearchContent()); + list.forEach(toolProduct -> { + try { + CerePlatformShop platformShop = platformShopService.getById(toolProduct.getShopId()); + if (ObjectUtils.isNotEmpty(platformShop)){ + toolProduct.setShopName(platformShop.getShopName()); + } + } catch (CoBusinessException e) { + e.printStackTrace(); + } + }); PageInfo pageInfo=new PageInfo<>(list); Page page=new Page(pageInfo.getList(),pageInfo.getTotal()); return page; diff --git a/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopGroupWorkDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopGroupWorkDAO.xml index 0b743ad..7c5c704 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopGroupWorkDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopGroupWorkDAO.xml @@ -248,6 +248,7 @@ resultType="com.shop.cereshop.business.page.tool.ToolProduct"> SELECT a.product_id, b.product_name, + b.shop_id, a.price, a.original_price, @@ -272,32 +273,35 @@ LEFT JOIN cere_product_classify d ON b.classify_id = d.classify_id LEFT JOIN (SELECT GROUP_CONCAT(sku_value) `value`, sku_id FROM cere_sku_name GROUP BY sku_id) e ON a.sku_id = e.sku_id - where b.shop_id = #{shopId} + where b.shop_id in (select shop_id from cere_platform_shop where business_id = #{shopId}) and b.shelve_state = 1 and a.product_id NOT in (SELECT a.product_id FROM cere_shop_seckill_detail a LEFT JOIN cere_shop_seckill b ON a.shop_seckill_id = b.shop_seckill_id - where b.shop_id = #{shopId} + where b.shop_id in (select shop_id from cere_platform_shop where business_id = #{shopId}) and b.state=1) and a.product_id NOT in (SELECT a.product_id FROM cere_shop_discount_detail a LEFT JOIN cere_shop_discount b ON a.shop_discount_id = b.shop_discount_id - where b.shop_id = #{shopId} + where b.shop_id in (select shop_id from cere_platform_shop where business_id = #{shopId}) and b.state=1) and a.product_id NOT in (SELECT a.product_id FROM cere_sign_product a LEFT JOIN cere_activity_sign b ON a.sign_id = b.sign_id LEFT JOIN cere_platform_seckill c ON b.activity_id = c.seckill_id and b.sign_type = 2 - where b.shop_id = #{shopId} + where b.shop_id in (select shop_id from cere_platform_shop where business_id = #{shopId}) and c.state=3) and a.product_id NOT in (SELECT a.product_id FROM cere_sign_product a LEFT JOIN cere_activity_sign b ON a.sign_id = b.sign_id LEFT JOIN cere_platform_discount c ON b.activity_id = c.discount_id and b.sign_type = 3 - where b.shop_id = #{shopId} + where b.shop_id in (select shop_id from cere_platform_shop where business_id = #{shopId}) and c.state=3) + + and b.product_name like concat('%',#{searchContent},'%') +