From d7b3c61e01aadf99ce6a1d8ebf18c4e6dd81cc2b Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期四, 12 十二月 2024 18:05:34 +0800
Subject: [PATCH] 12.12

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java |   25 +++++++++++++++++++++----
 1 files changed, 21 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..7176262 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,25 +7,26 @@
 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;
 import com.ruoyi.other.vo.GoodsVO;
 import com.ruoyi.system.api.model.LoginUser;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -49,6 +50,10 @@
     private GoodsVipService goodsVipService;
     @Resource
     private AppUserClient appUserClient;
+    @Resource
+    private GoodsShopMapper goodsShopMapper;
+    @Resource
+    private ShopMapper shopMapper;
 
     @Override
     public List<GoodsVO> goodsList(Goods search) {
@@ -101,8 +106,20 @@
         Goods goods = this.getById(goodsId);
         GoodsVO goodsVO = new GoodsVO();
         BeanUtils.copyBeanProp(goodsVO, goods);
+        goodsVO.setGoodsId(goods.getId());
+        goodsVO.setGoodsName(goods.getName());
         goodsVO.setSellingPrice(sellingPrice);
         goodsVO.setIntegral(integral);
+
+        List<GoodsShop> goodsShopList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>()
+                .eq(GoodsShop::getGoodsId, goodsId));
+        if (!CollectionUtils.isEmpty(goodsShopList)){
+            List<Integer> shopIds = goodsShopList.stream().map(GoodsShop::getShopId).collect(Collectors.toList());
+            List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>()
+                    .in(Shop::getId, shopIds));
+
+            goodsVO.setShopList(shopList);
+        }
         return goodsVO;
     }
 

--
Gitblit v1.7.1