From 609d91e1e62b1e8932b34b15b09baf02e7f09a93 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期一, 09 十二月 2024 10:36:47 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 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 3253aaf..a299b54 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 @@ -7,13 +7,12 @@ import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.security.service.TokenService; -import com.ruoyi.other.api.domain.Goods; -import com.ruoyi.other.api.domain.GoodsArea; -import com.ruoyi.other.api.domain.GoodsVip; -import com.ruoyi.other.api.domain.VipSetting; +import com.ruoyi.other.api.domain.*; import com.ruoyi.other.enums.GoodsStatus; import com.ruoyi.other.mapper.GoodsAreaMapper; import com.ruoyi.other.mapper.GoodsMapper; +import com.ruoyi.other.mapper.GoodsShopMapper; +import com.ruoyi.other.mapper.ShopMapper; import com.ruoyi.other.service.GoodsService; import com.ruoyi.other.service.GoodsVipService; import com.ruoyi.other.service.VipSettingService; @@ -26,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** * <p> @@ -49,6 +49,10 @@ private GoodsVipService goodsVipService; @Resource private AppUserClient appUserClient; + @Resource + private GoodsShopMapper goodsShopMapper; + @Resource + private ShopMapper shopMapper; @Override public List<GoodsVO> goodsList(Goods search) { @@ -99,8 +103,17 @@ } Goods goods = this.getById(goodsId); + + List<GoodsShop> goodsShopList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>() + .eq(GoodsShop::getGoodsId, goodsId)); + List<Integer> shopIds = goodsShopList.stream().map(GoodsShop::getShopId).collect(Collectors.toList()); + List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>() + .in(Shop::getId, shopIds)); GoodsVO goodsVO = new GoodsVO(); + goodsVO.setShopList(shopList); BeanUtils.copyBeanProp(goodsVO, goods); + goodsVO.setGoodsId(goods.getId()); + goodsVO.setGoodsName(goods.getName()); goodsVO.setSellingPrice(sellingPrice); goodsVO.setIntegral(integral); return goodsVO; -- Gitblit v1.7.1