Selaa lähdekoodia

bugfix:用户端查询福利缺少name字段

lyx 1 päivä sitten
vanhempi
commit
3fbf1a0178

+ 5 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StorePlatformBenefitsVo.java

@@ -25,5 +25,10 @@ public class StorePlatformBenefitsVo extends StorePlatformBenefits {
      * 数量
      */
     private Integer quantity;
+
+    /**
+     * 优惠券名称
+     */
+     private String couponName;
 }
 

+ 43 - 3
alien-entity/src/main/java/shop/alien/mapper/StorePlatformBenefitsMapper.java

@@ -9,6 +9,8 @@ import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.StorePlatformBenefits;
 import shop.alien.entity.store.vo.StorePlatformBenefitsVo;
 
+import java.util.List;
+
 /**
  * 福利表 Mapper 接口
  *
@@ -37,17 +39,55 @@ public interface StorePlatformBenefitsMapper extends BaseMapper<StorePlatformBen
             "from\n" +
             "\tstore_platform_benefits spb\n" +
             "inner join life_discount_coupon ldc on\n" +
-            "\tspb.business_id = ldc.id and spb.delete_flag = 0 " +
+            "\tspb.business_id = ldc.id and spb.delete_flag = 0 and spb.type = 1 " +
             " union all " +
             " select spb.id, spb.type, spb.business_id, spb.usage_conditions, svc.name, spb.created_time,svc.quantity  " +
             " from store_platform_benefits spb " +
-            " inner join store_virtual_currency svc on spb.business_id = svc.id  and spb.delete_flag = 0  ) a " +
+            " inner join store_virtual_currency svc on spb.business_id = svc.id  and spb.delete_flag = 0 and spb.type = 2 " +
+            " ) a " +
             " ${ew.customSqlSegment}" +
             "</script>")
     IPage<StorePlatformBenefitsVo> getPlatformBenefitsPage(
             IPage<StorePlatformBenefitsVo> page,
             @Param(Constants.WRAPPER) QueryWrapper<StorePlatformBenefitsVo> queryWrapper
     );
-
+    /**
+     * 查询所有福利信息,包含优惠券信息和U币信息
+     *
+     * @return 福利信息列表
+     */
+    @Select("select * from ( " +
+            " select " +
+            " spb.id, " +
+            " spb.type, " +
+            " spb.business_id, " +
+            " spb.usage_conditions, " +
+            " spb.status, " +
+            " spb.delete_flag, " +
+            " spb.created_time, " +
+            " spb.created_user_id, " +
+            " spb.updated_time, " +
+            " spb.updated_user_id, " +
+            " ldc.name couponName" +
+            " from store_platform_benefits spb " +
+            " inner join life_discount_coupon ldc on spb.business_id = ldc.id and spb.delete_flag = 0 and spb.type = 1 " +
+            " union all " +
+            " select " +
+            " spb.id, " +
+            " spb.type, " +
+            " spb.business_id, " +
+            " spb.usage_conditions, " +
+            " spb.status, " +
+            " spb.delete_flag, " +
+            " spb.created_time, " +
+            " spb.created_user_id, " +
+            " spb.updated_time, " +
+            " spb.updated_user_id, " +
+            " svc.name couponName" +
+            " from store_platform_benefits spb " +
+            " inner join store_virtual_currency svc on spb.business_id = svc.id and spb.delete_flag = 0 and spb.type = 2 " +
+            " ) a " +
+            " order by created_time desc")
+    List<StorePlatformBenefitsVo> selectListAndCoupon();
 }
 

+ 2 - 2
alien-store/src/main/java/shop/alien/store/service/impl/StorePlatformBenefitsServiceImpl.java

@@ -205,9 +205,9 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
         List<Integer> couponIdList = lifeDiscountCouponUsers.stream().filter(x -> x.getCouponId() != null).map(LifeDiscountCouponUser::getCouponId).collect(Collectors.toList());
         List<Integer> ubIdList = lifeDiscountCouponUsers.stream().filter(x -> x.getUbId() != null).map(LifeDiscountCouponUser::getUbId).collect(Collectors.toList());
         couponIdList.addAll(ubIdList);
-        List<StorePlatformBenefits> storePlatformBenefits = super.list();
+        List<StorePlatformBenefitsVo> storePlatformBenefits = benefitsMapper.selectListAndCoupon();
         List<StorePlatformBenefitsVo> result = new ArrayList<>();
-        for (StorePlatformBenefits storePlatformBenefit : storePlatformBenefits) {
+        for (StorePlatformBenefitsVo storePlatformBenefit : storePlatformBenefits) {
             StorePlatformBenefitsVo  storePlatformBenefitVo = new StorePlatformBenefitsVo();
             cn.hutool.core.bean.BeanUtil.copyProperties(storePlatformBenefit, storePlatformBenefitVo);
             if (couponIdList.contains(storePlatformBenefitVo.getId())) {