perf: 台桌接口增加状态查询 选择台桌支持清空原有购物车
This commit is contained in:
@@ -2,7 +2,6 @@ package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import cn.ysk.cashier.enums.OrderStatusEnums;
|
||||
import cn.ysk.cashier.pojo.order.TbCashierCart;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
@@ -31,5 +30,14 @@ public interface MpCashierCartService extends IService<TbCashierCart> {
|
||||
* @return 购物车数量
|
||||
*/
|
||||
long countByTableId(Integer shopId, String tableId, OrderStatusEnums... statusEnums);
|
||||
|
||||
/**
|
||||
* 根据tableIdId和用餐类型清空购物车
|
||||
*
|
||||
* @param tableId 台桌id
|
||||
* @param useType 用餐类型
|
||||
* @param shopId 店铺id
|
||||
*/
|
||||
boolean clearCartByTableIdAndUseType(String tableId, String useType, Integer shopId);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,17 +4,13 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.ysk.cashier.enums.OrderStatusEnums;
|
||||
import cn.ysk.cashier.enums.OrderUseTypeEnum;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCashierCartMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbOrderDetailMapper;
|
||||
import cn.ysk.cashier.mybatis.service.MpCashierCartService;
|
||||
import cn.ysk.cashier.mybatis.service.MpOrderDetailService;
|
||||
import cn.ysk.cashier.pojo.order.TbCashierCart;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -49,5 +45,15 @@ public class MpCashierCartServiceImpl extends ServiceImpl<TbCashierCartMapper, T
|
||||
}
|
||||
return count(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearCartByTableIdAndUseType(String tableId, String useType, Integer shopId) {
|
||||
return remove(new LambdaQueryWrapper<TbCashierCart>()
|
||||
.in(TbCashierCart::getStatus, OrderStatusEnums.CREATE.getValue(), OrderStatusEnums.RETURN.getValue())
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
.eq(TbCashierCart::getShopId, shopId)
|
||||
.eq(TbCashierCart::getTableId, tableId)
|
||||
.eq(TbCashierCart::getUseType, useType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user