From b2a1116f8c1a7aff3abf2d1eadeffe8e416c6fc5 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期一, 23 十二月 2024 10:35:07 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java |    7 +++++++
 1 files changed, 7 insertions(+), 0 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 0c1622f..a45c0d6 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
@@ -236,6 +236,10 @@
     private void saveGoodsVipList(List<GoodsVip> goodsVipList, Integer id) {
         goodsVipService.remove(new LambdaQueryWrapper<GoodsVip>()
                 .eq(GoodsVip::getGoodsId, id));
+        goodsVipList.forEach(item -> {
+            item.setId(null);
+            item.setGoodsId(id);
+        });
         goodsVipService.saveBatch(goodsVipList);
     }
 
@@ -337,6 +341,9 @@
 
     private List<VipSetting> getVipSettings(Stream<Integer> goodsVipList) {
         List<Integer> vipIds = goodsVipList.collect(Collectors.toList());
+        if (CollectionUtils.isEmpty(vipIds)){
+            return new ArrayList<>();
+        }
         return vipSettingService.listByIds(vipIds);
     }
 

--
Gitblit v1.7.1