mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
秒杀活动:纠正秒杀库存和秒杀总库存扣减错误的问题
This commit is contained in:
parent
42fcbe0501
commit
fdbebc406c
@ -77,8 +77,7 @@ public class SeckillActivityDO extends BaseDO {
|
||||
private Integer singleLimitCount;
|
||||
|
||||
/**
|
||||
* 秒杀库存-秒杀下单时怎加,恢复库存是减少
|
||||
* 也就是说这个是记录当前秒杀活动用户购买的商品数量和
|
||||
* 秒杀库存(剩余库存秒杀时扣减)
|
||||
*/
|
||||
private Integer stock;
|
||||
/**
|
||||
|
@ -50,9 +50,8 @@ public interface SeckillActivityMapper extends BaseMapperX<SeckillActivityDO> {
|
||||
Assert.isTrue(count > 0);
|
||||
return update(null, new LambdaUpdateWrapper<SeckillActivityDO>()
|
||||
.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<SeckillActivityDO> {
|
||||
Assert.isTrue(count > 0);
|
||||
return update(null, new LambdaUpdateWrapper<SeckillActivityDO>()
|
||||
.eq(SeckillActivityDO::getId, id)
|
||||
.setSql("stock = stock - " + count)
|
||||
.setSql("total_stock = total_stock + " + count));
|
||||
.setSql("stock = stock + " + count));
|
||||
}
|
||||
|
||||
default PageResult<SeckillActivityDO> selectPage(AppSeckillActivityPageReqVO pageReqVO, Integer status) {
|
||||
|
Loading…
Reference in New Issue
Block a user