fix: 订单列表增加异常捕获,防止查询明细失败导致整体失败
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -196,6 +196,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 查询每个订单的明细
|
||||
if (result.getRecords() != null && !result.getRecords().isEmpty()) {
|
||||
for (Order order : result.getRecords()) {
|
||||
try {
|
||||
if (order.getOrderId() != null) {
|
||||
List<OrderItem> items = orderItemMapper.selectList(
|
||||
new LambdaQueryWrapper<OrderItem>().eq(OrderItem::getOrderId, order.getOrderId()));
|
||||
@@ -203,6 +204,10 @@ public class OrderServiceImpl implements OrderService {
|
||||
} else {
|
||||
order.setItems(new ArrayList<>());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 查询明细失败时设置空列表
|
||||
order.setItems(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user