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},'%') +