From 5218702005af0f0f089a8d5f6b2975a263fb536a Mon Sep 17 00:00:00 2001 From: Chopper711 Date: Tue, 3 Jan 2023 11:52:30 +0800 Subject: [PATCH] =?UTF-8?q?'=E5=95=86=E5=93=81=E7=B4=A2=E5=BC=95=E7=A9=BA?= =?UTF-8?q?=E5=A4=84=E7=90=86'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/serviceimpl/PromotionGoodsServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java index 3502b2ed..5eb6d263 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import cn.lili.common.enums.PromotionTypeEnum; +import cn.lili.common.utils.StringUtils; import cn.lili.common.vo.PageVO; import cn.lili.modules.goods.entity.dos.GoodsSku; import cn.lili.modules.goods.entity.dto.GoodsSkuDTO; @@ -94,7 +95,12 @@ public class PromotionGoodsServiceImpl extends ServiceImpl categories = skus.stream().map(GoodsSku::getCategoryPath).collect(Collectors.toList()); List skuIds = skus.stream().map(GoodsSku::getId).collect(Collectors.toList()); List categoriesPath = new ArrayList<>(); - categories.forEach(i -> categoriesPath.addAll(Arrays.asList(i.split(",")))); + categories.forEach(i -> { + if (StringUtils.isNotEmpty(i)) { + categoriesPath.addAll(Arrays.asList(i.split(","))); + } + } + ); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.and(i -> i.or(j -> j.in(SKU_ID_COLUMN, skuIds))