From 8bb4f18be334043a73673ccf9883c081d27ad535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E6=89=8E=E6=A0=B9=E6=91=84=E5=BD=B1?= <1446802857@qq.com> Date: Wed, 15 Oct 2025 16:50:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/OrderDto.cs | 6 ++++++ .../ApplicationServices/OrderAppService.cs | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/OrderDto.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/OrderDto.cs index 6d28e3b..7996e16 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/OrderDto.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/OrderDto.cs @@ -22,4 +22,10 @@ namespace KonSoft.Admin.Dtos public AddressDto Address { get; set; } public string Remark { get; set; } } + + public class PageListInput + { + public int Index { get; set; } + public int PageSize { get; set; } + } } diff --git a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/OrderAppService.cs b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/OrderAppService.cs index c22394b..ad42859 100644 --- a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/OrderAppService.cs +++ b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/OrderAppService.cs @@ -8,7 +8,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Volo.Abp; +using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; using Volo.Abp.ObjectMapping; namespace KonSoft.Admin.ApplicationServices @@ -88,10 +90,10 @@ namespace KonSoft.Admin.ApplicationServices /// 根据订单ID删除订单 /// /// 订单ID - public async Task DeleteAsync(Guid id) + public async Task DeleteAsync(params Guid[] ids) { // 根据ID删除订单 - await _orderRepository.DeleteAsync(x => x.Id == id); + await _orderRepository.DeleteAsync(x => ids.Contains(x.Id)); } /// @@ -150,13 +152,17 @@ namespace KonSoft.Admin.ApplicationServices /// /// 获取所有订单列表 /// - public async Task> GetListAsync() + public async Task> GetListAsync(PageListInput input) { + var skipCount = (input.Index - 1) * input.PageSize; // 查询所有订单 - var orders = await _orderRepository.GetListAsync(); + var orders = await _orderRepository.GetPagedListAsync(skipCount, input.PageSize, "Id"); - // 转换为OrderDto列表返回 - return ObjectMapper.Map, List>(orders); + var totalCount = await _orderRepository.CountAsync(); + + var orderDtos = ObjectMapper.Map, List>(orders); + + return new PagedResultDto(totalCount, orderDtos); } } } \ No newline at end of file