This commit is contained in:
2025-10-15 16:50:24 +08:00
parent 36759da784
commit 8bb4f18be3
2 changed files with 18 additions and 6 deletions

View File

@ -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; }
}
}

View File

@ -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删除订单
/// </summary>
/// <param name="id">订单ID</param>
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));
}
/// <summary>
@ -150,13 +152,17 @@ namespace KonSoft.Admin.ApplicationServices
/// <summary>
/// 获取所有订单列表
/// </summary>
public async Task<List<OrderDto>> GetListAsync()
public async Task<PagedResultDto<OrderDto>> 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<Order>, List<OrderDto>>(orders);
var totalCount = await _orderRepository.CountAsync();
var orderDtos = ObjectMapper.Map<List<Order>, List<OrderDto>>(orders);
return new PagedResultDto<OrderDto>(totalCount, orderDtos);
}
}
}