fix(租柜单元格): 修复查询租用单元格最新订单时的空列表问题

当租用单元格列表为空时,避免执行不必要的查询操作
This commit is contained in:
dzq 2025-07-01 15:28:09 +08:00
parent 2bf2494383
commit a068d54493
1 changed files with 11 additions and 9 deletions

View File

@ -41,6 +41,7 @@ public class CabinetCellApplicationService {
.filter(cell -> cell.getIsRented().equals(1)) .filter(cell -> cell.getIsRented().equals(1))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (!rentingCells.isEmpty()) {
List<CabinetCellLatestOrderDTO> cellLatestOrderDTOS = cabinetCellService.selectLatestOrderInfoByCell(rentingCells.stream() List<CabinetCellLatestOrderDTO> cellLatestOrderDTOS = cabinetCellService.selectLatestOrderInfoByCell(rentingCells.stream()
.map(CabinetCellWithOrderCountDTO::getCellId).collect(Collectors.toList())); .map(CabinetCellWithOrderCountDTO::getCellId).collect(Collectors.toList()));
@ -52,6 +53,7 @@ public class CabinetCellApplicationService {
BeanUtils.copyProperties(order, cell); BeanUtils.copyProperties(order, cell);
}); });
} }
}
return new PageDTO<>(list, page.getTotal()); return new PageDTO<>(list, page.getTotal());
} }