查出来0条
public async Task<PagedResultDto<ProFileListDto>> GetAll(ProFileListInput input) { var query = from a in _proFileRepository.GetAll() join b in _filingAgreementRepository.GetAll() on a.Id equals b.ProFileId into list from c in list.DefaultIfEmpty() join d in _filesRepository.GetAll() on c.PdfFileUrlId equals d.Id where (string.IsNullOrEmpty(input.Name) || a.Name == input.Name) && (!input.GraduationTime.HasValue || a.GraduationTime.Year == input.GraduationTime.Value) && (!input.Birthday.HasValue || a.Birthday.Value.Year == input.Birthday.Value.Year && a.Birthday.Value.Month == input.Birthday.Value.Month) && (string.IsNullOrEmpty(input.IdCard) || a.IdCard == input.IdCard) && (!input.ProFileState.HasValue || a.ProFileState == input.ProFileState) && (!input.ProFileType.HasValue || a.ProFileType == input.ProFileType) && (string.IsNullOrEmpty(input.GraduatedSchool) || a.GraduatedSchool == input.GraduatedSchool) select new { a, url=d==null?"":d.FliePath }; var count = await query.CountAsync(); var items = await query.OrderBy(input.Sorting).PageBy(input).ToListAsync(); return new PagedResultDto<ProFileListDto>( count, items.Select(item => { var dto = ObjectMapper.Map<ProFileListDto>(item.a); //if (item.c != null) //{ // dto.FilingAgreementFileUrl = ( _filesRepository.Get(item.c.PdfFileUrlId)).FliePath; //} dto.FilingAgreementFileUrl = item.url; return dto; }).ToList()); }
正常
public async Task<PagedResultDto<ProFileListDto>> GetAll(ProFileListInput input) { var query = from a in _proFileRepository.GetAll() join b in _filingAgreementRepository.GetAll() on a.Id equals b.ProFileId into list from c in list.DefaultIfEmpty() join d in _filesRepository.GetAll() on c.PdfFileUrlId equals d.Id into list2 from e in list2.DefaultIfEmpty() where (string.IsNullOrEmpty(input.Name) || a.Name == input.Name) && (!input.GraduationTime.HasValue || a.GraduationTime.Year == input.GraduationTime.Value) && (!input.Birthday.HasValue || a.Birthday.Value.Year == input.Birthday.Value.Year && a.Birthday.Value.Month == input.Birthday.Value.Month) && (string.IsNullOrEmpty(input.IdCard) || a.IdCard == input.IdCard) && (!input.ProFileState.HasValue || a.ProFileState == input.ProFileState) && (!input.ProFileType.HasValue || a.ProFileType == input.ProFileType) && (string.IsNullOrEmpty(input.GraduatedSchool) || a.GraduatedSchool == input.GraduatedSchool) select new { a, url = e == null ? "" : e.FliePath }; var count = await query.CountAsync(); var items = await query.OrderBy(input.Sorting).PageBy(input).ToListAsync(); return new PagedResultDto<ProFileListDto>( count, items.Select(item => { var dto = ObjectMapper.Map<ProFileListDto>(item.a); //if (item.c != null) //{ // dto.FilingAgreementFileUrl = (_filesRepository.Get(item.c.PdfFileUrlId)).FliePath; //} dto.FilingAgreementFileUrl = item.url; return dto; }).ToList()); }