mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update
This commit is contained in:
@@ -6302,25 +6302,23 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
.orderStatus(dto.getOrderStatus())
|
||||
.build();
|
||||
|
||||
// 分页参数处理
|
||||
// 1. 分页参数处理
|
||||
int pageNum = dto.getPageNum() == null || dto.getPageNum() <= 0 ? 1 : dto.getPageNum();
|
||||
int pageSize = dto.getPageSize() == null || dto.getPageSize() <= 0 ? 10 : dto.getPageSize();
|
||||
|
||||
// 使用聚合 SQL 统计订单数量和总金额
|
||||
OrderStatisticsVO statistics = orderBasicInfoMapper.countBusinessOrderStatistics(queryOrderDTO);
|
||||
|
||||
// 订单数量和总金额的为空判断
|
||||
long orderCount = statistics != null && statistics.getOrderCount() != null
|
||||
? statistics.getOrderCount() : 0L;
|
||||
BigDecimal totalOrderAmount = statistics != null && statistics.getOrderAmount() != null
|
||||
? statistics.getOrderAmount() : BigDecimal.ZERO;
|
||||
|
||||
// 分页查询订单列表
|
||||
// 2. 分页查询订单列表
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<OrderListVO> orderListVOS = selectOrderBasicInfoList(queryOrderDTO);
|
||||
PageInfo<OrderListVO> pageInfo = new PageInfo<>(orderListVOS);
|
||||
|
||||
// 转换为BusinessOrderListVO(
|
||||
long orderCount = pageInfo.getTotal();
|
||||
|
||||
// 3. 统计总金额(使用聚合 SQL,避免查询所有数据到内存
|
||||
OrderStatisticsVO statistics = orderBasicInfoMapper.countBusinessOrderStatistics(queryOrderDTO);
|
||||
BigDecimal totalOrderAmount = statistics != null && statistics.getOrderAmount() != null
|
||||
? statistics.getOrderAmount() : BigDecimal.ZERO;
|
||||
|
||||
//4. 转换为 BusinessOrderListVO
|
||||
List<BusinessOrderListVO> businessOrderList = orderListVOS.stream()
|
||||
.map(order -> BusinessOrderListVO.builder()
|
||||
.createTime(order.getCreateTime())
|
||||
@@ -6334,8 +6332,8 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 构建分页响应
|
||||
com.jsowell.common.core.page.PageResponse pageResponse = com.jsowell.common.core.page.PageResponse.builder()
|
||||
// 5. 构建分页响应
|
||||
PageResponse pageResponse = PageResponse.builder()
|
||||
.pageNum(pageNum)
|
||||
.pageSize(pageSize)
|
||||
.total(pageInfo.getTotal())
|
||||
@@ -6343,12 +6341,11 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
.list(businessOrderList)
|
||||
.build();
|
||||
|
||||
// 构建返回结果
|
||||
// 6. 构建返回结果
|
||||
return BusinessOrderQueryResultVO.builder()
|
||||
.orderCount(orderCount)
|
||||
.orderAmount(totalOrderAmount)
|
||||
.pageResponse(pageResponse)
|
||||
.orderList(businessOrderList)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,5 @@ public class BusinessOrderQueryResultVO {
|
||||
*/
|
||||
private PageResponse pageResponse;
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
*/
|
||||
private List<BusinessOrderListVO> orderList;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user