Compare commits

...

2 Commits

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 AddressDto Address { get; set; }
public string Remark { 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.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping; using Volo.Abp.ObjectMapping;
namespace KonSoft.Admin.ApplicationServices namespace KonSoft.Admin.ApplicationServices
@ -88,10 +90,10 @@ namespace KonSoft.Admin.ApplicationServices
/// 根据订单ID删除订单 /// 根据订单ID删除订单
/// </summary> /// </summary>
/// <param name="id">订单ID</param> /// <param name="id">订单ID</param>
public async Task DeleteAsync(Guid id) public async Task DeleteAsync(params Guid[] ids)
{ {
// 根据ID删除订单 // 根据ID删除订单
await _orderRepository.DeleteAsync(x => x.Id == id); await _orderRepository.DeleteAsync(x => ids.Contains(x.Id));
} }
/// <summary> /// <summary>
@ -150,13 +152,17 @@ namespace KonSoft.Admin.ApplicationServices
/// <summary> /// <summary>
/// 获取所有订单列表 /// 获取所有订单列表
/// </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列表返回 var totalCount = await _orderRepository.CountAsync();
return ObjectMapper.Map<List<Order>, List<OrderDto>>(orders);
var orderDtos = ObjectMapper.Map<List<Order>, List<OrderDto>>(orders);
return new PagedResultDto<OrderDto>(totalCount, orderDtos);
} }
} }
} }