代码修改

This commit is contained in:
he
2023-08-17 14:25:15 +08:00
parent 6b6ab9e406
commit 8da1ab2413
3 changed files with 34 additions and 34 deletions
@@ -148,16 +148,16 @@ namespace IRaCIS.Application.Services
dto.SortField = nameof(ReadModuleView.SubjectCode);
dto.Asc = true;
}
dto.SortField = dto.Asc ? dto.SortField : dto.SortField + " desc";
var subjectQuery = _readModuleViewRepository.Where(x => x.TrialReadingCriterionId == dto.TrialReadingCriterionId)
.WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId)
.WhereIf(dto.SubjectId != null, x => x.SubjectId == dto.SubjectId)
.WhereIf(dto.TrialSiteCode != null && dto.TrialSiteCode != string.Empty, x => x.TrialSiteCode.Contains(dto.TrialSiteCode))
.WhereIf(dto.SubjectCode != null && dto.SubjectCode != string.Empty, x => x.SubjectCode.Contains(dto.SubjectCode))
.WhereIf(dto.ModuleType != null, x => x.ModuleType == dto.ModuleType)
.WhereIf(dto.ReadingStatus != null, x => x.ReadingStatus == dto.ReadingStatus)
.WhereIf(dto.Name != null, x => x.Name.Contains(dto.Name!)).OrderBy(x => x.SiteCode);
var subjectQuery = _readModuleViewRepository.Where(x => x.TrialReadingCriterionId == dto.TrialReadingCriterionId)
.WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId)
.WhereIf(dto.SubjectId != null, x => x.SubjectId == dto.SubjectId)
.WhereIf(dto.TrialSiteCode != null && dto.TrialSiteCode != string.Empty, x => x.TrialSiteCode.Contains(dto.TrialSiteCode))
.WhereIf(dto.SubjectCode != null && dto.SubjectCode != string.Empty, x => x.SubjectCode.Contains(dto.SubjectCode))
.WhereIf(dto.ModuleType != null, x => x.ModuleType == dto.ModuleType)
.WhereIf(dto.ReadingStatus != null, x => x.ReadingStatus == dto.ReadingStatus)
.WhereIf(dto.Name != null, x => x.Name.Contains(dto.Name!)).OrderBy(x => x.SiteCode);
var subjectIds = await subjectQuery.OrderBy(dto.SortField).Select(x => x.SubjectId).Distinct().Skip((dto.PageIndex - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();