1.添加购物车逻辑修改

This commit is contained in:
SongZhang 2024-09-05 11:28:56 +08:00
parent 6360d01041
commit 0600a1d90e
1 changed files with 25 additions and 1 deletions

View File

@ -285,7 +285,31 @@ public class OrderService {
cashierCartMapper.updateByPrimaryKeySelective(cart);
}
} else {
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
.notIn(TbCashierCart::getStatus, "final", "refund", "closed", "pending")
.eq(TbCashierCart::getShopId, cart.getShopId());
TbCashierCart finalCart = cart;
queryWrapper.eq(TbCashierCart::getTableId, cart.getTableId())
.and(q -> {
q.or(
query -> {
query.eq(TbCashierCart::getMasterId, finalCart.getMasterId())
.or()
.isNull(TbCashierCart::getMasterId)
.or()
.eq(TbCashierCart::getMasterId, "");
}
)
.or(query -> {
query.eq(TbCashierCart::getOrderId, finalCart.getOrderId())
.or()
.isNull(TbCashierCart::getOrderId);
});
});
List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper.eq(TbCashierCart::getStatus, "create"));
// List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
// TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid, tableId);
String finalMasterId = masterId;