From a8d2cb07f6440dc54dc4005b0b06d5a47cb1517d Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期一, 16 十二月 2024 13:34:03 +0800
Subject: [PATCH] 12.16

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java |   18 ++++++++++++++----
 1 files changed, 14 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 f66abae..6e1ea7f 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
@@ -164,12 +164,20 @@
         goodsMapper.insert(goods);
 
         // 指定门店
-        List<GoodsShop> goodsShopList = goods.getGoodsShopList();
-        goodsShopService.saveBatch(goodsShopList);
+        Integer appointStore = goods.getAppointStore();
+        if (appointStore == 1){
+            List<GoodsShop> goodsShopList = goods.getGoodsShopList();
+            if (CollectionUtils.isEmpty(goodsShopList)){
+                throw new NullPointerException("请选择指定门店");
+            }
+            goodsShopService.saveBatch(goodsShopList);
+        }
 
         // 指定用户
         List<GoodsAppUser> goodsAppUserList = goods.getGoodsAppUserList();
-        goodsAppUserService.saveBatch(goodsAppUserList);
+        if (!CollectionUtils.isEmpty(goodsAppUserList)){
+            goodsAppUserService.saveBatch(goodsAppUserList);
+        }
 
         // 会员价格配置
         List<GoodsVip> goodsVipList = goods.getGoodsVipList();
@@ -177,7 +185,9 @@
 
         // 特殊地区售价设置
         List<GoodsArea> goodsAreaList = goods.getGoodsAreaList();
-        goodsAreaService.saveBatch(goodsAreaList);
+        if (!CollectionUtils.isEmpty(goodsAreaList)){
+            goodsAreaService.saveBatch(goodsAreaList);
+        }
     }
 
     @Override

--
Gitblit v1.7.1