分页
This commit is contained in:
		| @ -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); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user