其他分享
首页 > 其他分享> > LambdaUpdateWrapper 防止扣减为0

LambdaUpdateWrapper 防止扣减为0

作者:互联网

LambdaUpdateWrapper<Goods> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(Goods::getUpdateTime, new Date());
updateWrapper.setSql("good_total_qty = good_total_qty - " + vo.getGoodTotalSumQty());
updateWrapper.setSql("good_avail_qty = good_avail_qty - " + vo.getGoodTotalQty());
updateWrapper.setSql("good_lock_qty = good_lock_qty + " + vo.getGoodLockQty());
//校验可用库存
updateWrapper.ge(Goods::getGoodAvailQty, vo.getGoodTotalQty());
updateWrapper.eq(Goods::getId, goods.getId());

 

标签:good,扣减,qty,setSql,Goods,updateWrapper,防止,vo,LambdaUpdateWrapper
来源: https://www.cnblogs.com/deepalley/p/16457321.html