Просмотр исходного кода

计算优惠使用商品券返回商品信息

qmj 1 неделя назад
Родитель
Сommit
5939ef4008

+ 8 - 7
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PromotionUserCouponServiceImpl.java

@@ -172,15 +172,16 @@ public class PromotionUserCouponServiceImpl extends ServiceImpl<PromotionUserCou
                 vo.setCouponType(batch.getCouponType());
             }
 
-            // 查询规则信息
-            PromotionCouponRule rule = ruleMapper.selectOne(
+            // 查询规则信息(商品券可含多条,取第一条用于列表展示)
+            List<PromotionCouponRule> rules = ruleMapper.selectList(
                 new LambdaQueryWrapper<PromotionCouponRule>()
                     .eq(PromotionCouponRule::getBatchId, coupon.getBatchId()));
-            if (rule != null) {
-                vo.setThreshold(rule.getThreshold());
-                vo.setAmount(rule.getAmount());
-                vo.setDiscountRate(rule.getDiscountRate());
-                vo.setIsMutex(rule.getIsMutex());
+            if (!rules.isEmpty()) {
+                PromotionCouponRule first = rules.get(0);
+                vo.setThreshold(first.getThreshold());
+                vo.setAmount(first.getAmount());
+                vo.setDiscountRate(first.getDiscountRate());
+                vo.setIsMutex(first.getIsMutex());
             }
 
             result.add(vo);