From fdbebc406cb9d593e4c9fffc4c136eedc85270af Mon Sep 17 00:00:00 2001 From: puhui999 Date: Tue, 10 Oct 2023 10:57:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=92=E6=9D=80=E6=B4=BB=E5=8A=A8=EF=BC=9A?= =?UTF-8?q?=E7=BA=A0=E6=AD=A3=E7=A7=92=E6=9D=80=E5=BA=93=E5=AD=98=E5=92=8C?= =?UTF-8?q?=E7=A7=92=E6=9D=80=E6=80=BB=E5=BA=93=E5=AD=98=E6=89=A3=E5=87=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/dataobject/seckill/SeckillActivityDO.java | 3 +-- .../seckill/seckillactivity/SeckillActivityMapper.java | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/SeckillActivityDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/SeckillActivityDO.java index 67d074903..76a08ac70 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/SeckillActivityDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/SeckillActivityDO.java @@ -77,8 +77,7 @@ public class SeckillActivityDO extends BaseDO { private Integer singleLimitCount; /** - * 秒杀库存-秒杀下单时怎加,恢复库存是减少 - * 也就是说这个是记录当前秒杀活动用户购买的商品数量和 + * 秒杀库存(剩余库存秒杀时扣减) */ private Integer stock; /** diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java index e2d33991c..528ea07f9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java @@ -50,9 +50,8 @@ public interface SeckillActivityMapper extends BaseMapperX { Assert.isTrue(count > 0); return update(null, new LambdaUpdateWrapper() .eq(SeckillActivityDO::getId, id) - .gt(SeckillActivityDO::getTotalStock, 0) - .setSql("stock = stock + " + count) - .setSql("total_stock = total_stock - " + count)); + .gt(SeckillActivityDO::getStock, count) + .setSql("stock = stock - " + count)); } /** @@ -66,8 +65,7 @@ public interface SeckillActivityMapper extends BaseMapperX { Assert.isTrue(count > 0); return update(null, new LambdaUpdateWrapper() .eq(SeckillActivityDO::getId, id) - .setSql("stock = stock - " + count) - .setSql("total_stock = total_stock + " + count)); + .setSql("stock = stock + " + count)); } default PageResult selectPage(AppSeckillActivityPageReqVO pageReqVO, Integer status) {