cup 2 years ago
parent
commit
68315a19c3

+ 14 - 2
mp-service/src/main/java/com/qs/mp/admin/service/impl/TicketBoxServiceImpl.java

@@ -134,9 +134,15 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
 
     // 关联商品
     if (CollectionUtils.isNotEmpty(param.getGoodsList())) {
-      // 设置boxId
+      // 设置boxId和商品信息
       for (TicketBoxGoods ticketBoxGoods : param.getGoodsList()) {
         ticketBoxGoods.setBoxId(ticketBox.getBoxId());
+        Goods goods = goodsService.getById(ticketBoxGoods.getRefId());
+        if (goods != null) {
+          ticketBoxGoods.setTitle(goods.getTitle());
+          ticketBoxGoods.setPicUrl(goods.getPicUrl());
+          ticketBoxGoods.setValue(goods.getValue());
+        }
       }
       ticketBoxGoodsService.saveBatch(param.getGoodsList());
     }
@@ -342,9 +348,15 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
 
     // 关联商品
     if (CollectionUtils.isNotEmpty(param.getGoodsList())) {
-      // 设置boxId
+      // 设置boxId和商品信息
       for (TicketBoxGoods ticketBoxGoods : param.getGoodsList()) {
         ticketBoxGoods.setBoxId(ticketBox.getBoxId());
+        Goods goods = goodsService.getById(ticketBoxGoods.getRefId());
+        if (goods != null) {
+          ticketBoxGoods.setTitle(goods.getTitle());
+          ticketBoxGoods.setPicUrl(goods.getPicUrl());
+          ticketBoxGoods.setValue(goods.getValue());
+        }
       }
       ticketBoxGoodsService.saveBatch(param.getGoodsList());
     }