修改一版
parent
906c690fbc
commit
9230aed1ec
|
@ -378,7 +378,9 @@ namespace IRaCIS.Application.Services
|
|||
public async Task<List<GetSubjectReadVisitsOutDto>> GetSubjectReadVisitList(GetSubjectReadVisitsInDto inDto)
|
||||
{
|
||||
|
||||
var maxReadVisitNum = await _readModuleRepository.Where(x => x.SubjectId == inDto.SubjectId && x.ModuleType != ModuleTypeEnum.Global).MaxAsync(x => x.VisitNum);
|
||||
var maxReadVisit = await _readModuleRepository.Where(x => x.SubjectId == inDto.SubjectId&&x.ReadingSetType==inDto.ReadingSetType && x.ModuleType != ModuleTypeEnum.Global).OrderByDescending(x=>x.VisitNum).FirstOrDefaultAsync();
|
||||
|
||||
var maxReadVisitNum= maxReadVisit==null?0:maxReadVisit.VisitNum;
|
||||
|
||||
var visitQuery = _subjectVisitRepository.Where(x => x.SubjectId == inDto.SubjectId && x.LatestScanDate != null);
|
||||
|
||||
|
@ -386,7 +388,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
|
||||
var readModulequery = _readModuleRepository.AsQueryable();
|
||||
var resultlist= await visitQuery.WhereIf(finalVisitNum != null&& finalVisitNum!=0, x => x.VisitNum < finalVisitNum)
|
||||
var resultlist= await visitQuery.WhereIf(finalVisitNum != null&& finalVisitNum!=0, x => x.VisitNum <= finalVisitNum)
|
||||
.Where(x=>x.VisitNum>= maxReadVisitNum)
|
||||
.Where(x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.ReadingSetType == inDto.ReadingSetType).Count() == 0).OrderBy(x => finalVisitNum)
|
||||
.Select(x => new GetSubjectReadVisitsOutDto()
|
||||
|
|
Loading…
Reference in New Issue