From 19df67e19f23cd2a04d1c7f355e1e656f4140af4 Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期四, 17 四月 2025 20:04:14 +0800 Subject: [PATCH] 后台:首页统计、系统管理、广告管理、用户管理、商品分类管理 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java index 2e21724..5035619 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java @@ -39,6 +39,7 @@ import java.time.LocalDateTime; import java.time.ZoneId; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -196,6 +197,7 @@ } Goods goods = this.getById(goodsId); + if(null == goods || goods.getDelFlag() == 1){ throw new RuntimeException("商品不存在"); } @@ -226,12 +228,12 @@ GoodsShop goodsShop = goodsShopMapper.selectOne(new LambdaQueryWrapper<GoodsShop>() .eq(GoodsShop::getGoodsId, goodsId)); Shop shop1 = shopMapper.selectById(goodsShop.getShopId()); - ArrayList<Shop> shops = new ArrayList<>(); - shops.add(shop1); - goodsVO.setShopList(shops); + + goodsVO.setShop(shop1); //已售数量 Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData(); goodsVO.setSaleNum(integer); + return goodsVO; } @@ -241,6 +243,9 @@ public List<GoodsVO> getGoodsListByShopId(PageInfo<GoodsVO> pageInfo, Integer shopId) { //查询该门店商品 List<GoodsVO> goods = goodsMapper.selectListByShopId(pageInfo, shopId); + if (goods == null) { + return null; + } for (GoodsVO good : goods) { //价格 Price price = getPrice( good.getGoodsId()); -- Gitblit v1.7.1