Browse Source

Merge branch 'dev' into 'mp-server-test'

优化

See merge request quanshu/mp-server!873
jiang hao 2 years ago
parent
commit
c57abfb155

+ 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());
     }