perf: 台桌接口增加状态查询 选择台桌支持清空原有购物车

This commit is contained in:
2024-10-25 11:02:39 +08:00
parent 56d8195450
commit 35ad186a9d
5 changed files with 33 additions and 7 deletions

View File

@@ -236,6 +236,10 @@ public class TbShopTableServiceImpl implements TbShopTableService {
query.eq(TbShopTable::getQrcode, criteria.getQrcode());
}
if (StrUtil.isNotBlank(criteria.getState())) {
query.eq(TbShopTable::getStatus, criteria.getState());
}
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbShopTable> shopTablePage =
mpShopTableService.page(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(criteria.getPage(), criteria.getSize()), query);
List<TbShopTable> tbShopTableList = shopTablePage.getRecords();
@@ -281,10 +285,9 @@ public class TbShopTableServiceImpl implements TbShopTableService {
itemMap.put("masterId", orderInfo == null ? null : orderInfo.getMasterId());
infoList.add(itemMap);
}
int i = tbShopTableRepository.countAllByShopId(criteria.getShopId());
HashMap<String, Object> map = new HashMap<>();
map.put("content", infoList);
map.put("total", i);
map.put("total", shopTablePage.getTotal());
return map;
}
@@ -1786,6 +1789,11 @@ public class TbShopTableServiceImpl implements TbShopTableService {
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(choseTableDTO.getShopId(), choseTableDTO.getTableId());
// 清空原有桌台商品
if (choseTableDTO.getIsClear()) {
mpCashierCartService.clearCartByTableIdAndUseType(choseTableDTO.getTableId(), shopEatTypeInfoDTO.getUseType(), choseTableDTO.getShopId());
}
ArrayList<Integer> cartIds = new ArrayList<>();
Integer orderId = null;
for (TbCashierCart item : tbCashierCarts) {