Browse Source

修改已下架状态的代金券库存状态及销售状态问题

ldz 2 months ago
parent
commit
6ba4bb167c

+ 6 - 0
alien-store/src/main/java/shop/alien/store/service/impl/LifeCouponServiceImpl.java

@@ -1,5 +1,6 @@
 package shop.alien.store.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -136,6 +137,11 @@ public class LifeCouponServiceImpl extends ServiceImpl<LifeCouponMapper, LifeCou
         wrapper.eq(LifeCoupon::getDataType, dataType);
         wrapper.orderByDesc(LifeCoupon::getCreatedTime);
         IPage<LifeCoupon> lifeCouponIPage = new Page<>(page, size);
+        //如果singleQty的数量<=0,则修改status状态为已结束
+        LifeCoupon lifeCouponNew = new LifeCoupon();
+        lifeCouponNew.setStoreId(storeId);
+        lifeCouponNew.setStatus(4);
+        lifeCouponMapper.update(lifeCouponNew, new LambdaUpdateWrapper<LifeCoupon>().eq(LifeCoupon::getSingleQty, 0));
         return lifeCouponMapper.selectPage(lifeCouponIPage, wrapper);
     }