接口优化

optimize
wet 2 years ago
parent f6f36e2353
commit 8f11de034b

@ -4595,23 +4595,23 @@ namespace Myshipping.Application
var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == bookingId).OrderByDescending(x => x.OpTime).ToListAsync(); var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == bookingId).OrderByDescending(x => x.OpTime).ToListAsync();
var dto = statuslog.Adapt<List<BookingStatusLogDto>>(); var dto = statuslog.Adapt<List<BookingStatusLogDto>>();
var statuslogdetail = _statuslogdetail.AsQueryable(); var statuslogdetail =await _statuslogdetail.AsQueryable().ToListAsync();
foreach (var item in dto) foreach (var item in dto)
{ {
var detail =await statuslogdetail.Where(x => x.PId == item.Id).ToListAsync(); var detail = statuslogdetail.Where(x => x.PId == item.Id).ToList();
item.detail = detail.Adapt<List<BookingStatusLogDetailDto>>(); item.detail = detail.Adapt<List<BookingStatusLogDetailDto>>();
} }
allData.statuslog = dto; allData.statuslog = dto;
var bookinglog = _bookinglog.AsQueryable(); var bookinglog =await _bookinglog.AsQueryable().ToListAsync();
List<BookingLogDto> list = new List<BookingLogDto>(); List<BookingLogDto> list = new List<BookingLogDto>();
var main = await bookinglog.Where(u => u.BookingId == bookingId).ToListAsync(); var main = bookinglog.Where(u => u.BookingId == bookingId).ToList();
list = main.Adapt<List<BookingLogDto>>(); list = main.Adapt<List<BookingLogDto>>();
if (list != null) if (list != null)
{ {
var bookinglogdetail = _bookinglogdetail.AsQueryable(); var bookinglogdetail = await _bookinglogdetail.AsQueryable().ToListAsync();
foreach (var item in list) foreach (var item in list)
{ {
var details = await bookinglogdetail.Where(x => x.PId == item.Id).ToListAsync(); var details = bookinglogdetail.Where(x => x.PId == item.Id).ToList();
item.details = details; item.details = details;
} }
} }

Loading…
Cancel
Save