diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopDiscountController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopDiscountController.java index af432be..7b0be79 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopDiscountController.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopDiscountController.java @@ -160,10 +160,10 @@ public class ShopDiscountController { */ @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=cereShopDiscountService.getProducts(param); return new Result(page); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopDiscountDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopDiscountDAO.java index 9bde159..8849f9d 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopDiscountDAO.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopDiscountDAO.java @@ -35,7 +35,7 @@ public interface CereShopDiscountDAO extends BaseMapper { List getAll(ShopDiscountGetAllParam param); - List getProducts(@Param("shopId") Long shopId, @Param("shopDiscountId") Long shopDiscountId); + List getProducts(@Param("shopId") Long shopId, @Param("shopDiscountId") Long shopDiscountId, @Param("searchContent") String searchContent); List findDataProducts(@Param("shopDiscountId") Long shopDiscountId,@Param("shopId") Long shopId); diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopDiscountService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopDiscountService.java index 5d5bd54..dc11d65 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopDiscountService.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/CereShopDiscountService.java @@ -29,7 +29,7 @@ public interface CereShopDiscountService { Page getAll(ShopDiscountGetAllParam param) throws CoBusinessException; - Page getProducts(ToolProductParam param) throws CoBusinessException; + Page getProducts(ToolProductNewParam param) throws CoBusinessException; ShopDiscountData getData(ShopDiscountGetByIdParam param, Long shopId) throws CoBusinessException; diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopDiscountServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopDiscountServiceImpl.java index d120721..b1ad5d3 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopDiscountServiceImpl.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopDiscountServiceImpl.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.CereShopDiscountDAO; @@ -17,6 +18,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.CereShopDiscountDetailService; import com.shop.cereshop.business.service.tool.CereShopDiscountService; import com.shop.cereshop.commons.constant.CoReturnFormat; @@ -26,6 +28,7 @@ import com.shop.cereshop.commons.constant.StringEnum; import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser; import com.shop.cereshop.commons.domain.common.Page; import com.shop.cereshop.commons.domain.order.CereShopOrder; +import com.shop.cereshop.commons.domain.shop.CerePlatformShop; import com.shop.cereshop.commons.domain.tool.CereShopDiscount; import com.shop.cereshop.commons.domain.tool.CereShopDiscountDetail; import com.shop.cereshop.commons.exception.CoBusinessException; @@ -73,6 +76,9 @@ public class CereShopDiscountServiceImpl implements CereShopDiscountService{ @Autowired private ProjectInvokeUtil projectInvokeUtil; + @Autowired + private CerePlatformShopService platformShopService; + @Override @Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) public void save(ShopDiscountSaveParam param, CerePlatformBusinessUser user) throws CoBusinessException,Exception { @@ -389,9 +395,19 @@ public class CereShopDiscountServiceImpl implements CereShopDiscountService{ } @Override - public Page getProducts(ToolProductParam param) throws CoBusinessException { + public Page getProducts(ToolProductNewParam param) throws CoBusinessException { PageHelper.startPage(param.getPage(),param.getPageSize()); - List list=cereShopDiscountDAO.getProducts(param.getShopId(), param.getActivityId()); + List list=cereShopDiscountDAO.getProducts(param.getBusinessId(), param.getActivityId(), param.getSearchContent()); + for (ToolProduct toolProduct : list) { + 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/CereShopDiscountDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopDiscountDAO.xml index 680aeea..7434416 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopDiscountDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopDiscountDAO.xml @@ -265,6 +265,7 @@ resultType="com.shop.cereshop.business.page.tool.ToolProduct"> SELECT a.product_id, b.product_name, + b.shop_id, a.original_price, a.price, @@ -289,32 +290,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_group_work_detail a LEFT JOIN cere_shop_group_work b ON a.shop_group_work_id = b.shop_group_work_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_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_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},'%') +