零时方案修改
parent
e6a909bba0
commit
be3dde7657
|
@ -88,7 +88,8 @@ namespace IRaCIS.Core.Application.Services
|
||||||
{
|
{
|
||||||
return result.Data.CurrentPageData.First();
|
return result.Data.CurrentPageData.First();
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,14 +233,40 @@ namespace IRaCIS.Core.Application.Services
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#region 报错 奇怪的bug
|
||||||
|
//var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
|
||||||
|
// .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
||||||
|
// .WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
|
||||||
|
// .WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null)
|
||||||
|
// .WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null);
|
||||||
|
|
||||||
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
|
|
||||||
|
|
||||||
|
//var result = await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 临时方案
|
||||||
|
|
||||||
|
var list1 = systemDocumentQueryable
|
||||||
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
||||||
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
|
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
|
||||||
.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null)
|
.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null)
|
||||||
.WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null);
|
.WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null).ToList();
|
||||||
|
|
||||||
|
var list2 = trialDocQueryable
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
|
||||||
|
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
|
||||||
|
.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null)
|
||||||
|
.WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null).ToList();
|
||||||
|
|
||||||
|
var list3 = list1.Union(list2).ToList();
|
||||||
|
|
||||||
|
var result=list3.ToPagedList(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var result = await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
|
|
||||||
|
|
||||||
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == querySystemDocument.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
|
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == querySystemDocument.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
|
||||||
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
|
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
|
||||||
|
@ -254,9 +281,6 @@ namespace IRaCIS.Core.Application.Services
|
||||||
var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo<TrialProcessConfigDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
|
var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo<TrialProcessConfigDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
|
||||||
|
|
||||||
|
|
||||||
//var trialCriterionAdditionalAssessmentTypeList = _trialCriterionAdditionalAssessmentTypeRepository
|
|
||||||
// .Where(t => t.TrialReadingCriterion.TrialId == trialId && t.IsSelected == true && t.TrialReadingCriterion.IsSigned).Select(t=>new { t.CriterionType,t.AdditionalAssessmentType}).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
var isManualGenerateTask = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAutoCreate == false).Any();
|
var isManualGenerateTask = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAutoCreate == false).Any();
|
||||||
var isAdditionalAssessment = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAdditionalAssessment == true
|
var isAdditionalAssessment = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAdditionalAssessment == true
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
<PackageReference Include="EFCore.BulkExtensions" Version="6.5.6" />
|
<PackageReference Include="EFCore.BulkExtensions" Version="6.5.6" />
|
||||||
<PackageReference Include="EntityFrameworkCore.Triggered" Version="3.2.1" />
|
<PackageReference Include="EntityFrameworkCore.Triggered" Version="3.2.1" />
|
||||||
<PackageReference Include="EntityFrameworkCore.Projectables" Version="2.3.0" />
|
<PackageReference Include="EntityFrameworkCore.Projectables" Version="2.3.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.10" />
|
|
||||||
<PackageReference Include="EntityFrameworkCore.Exceptions.SqlServer" Version="6.0.3.2" />
|
<PackageReference Include="EntityFrameworkCore.Exceptions.SqlServer" Version="6.0.3.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||||
|
|
|
@ -257,11 +257,6 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Linq.Dynamic.Core;
|
using System.Linq.Dynamic.Core;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Infrastructure.Extention
|
namespace IRaCIS.Core.Infrastructure.Extention
|
||||||
{
|
{
|
||||||
|
@ -102,6 +104,45 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
||||||
return pagedList;
|
return pagedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static PageOutput<T> ToPagedList<T>(this IList<T> source, int pageIndex, int pageSize, string defaultSortFiled = "Id", bool isAsc = true)
|
||||||
|
{
|
||||||
|
if (pageIndex <= 0)
|
||||||
|
{
|
||||||
|
pageIndex = 1;
|
||||||
|
}
|
||||||
|
if (pageSize <= 0)
|
||||||
|
{
|
||||||
|
pageSize = 10;
|
||||||
|
}
|
||||||
|
var count = source.Count();
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
return new PageOutput<T>() { CurrentPageData = new List<T>() };
|
||||||
|
}
|
||||||
|
|
||||||
|
var propName = string.IsNullOrWhiteSpace(defaultSortFiled) ? "Id" : defaultSortFiled;
|
||||||
|
|
||||||
|
IQueryable<T> sourceQuery = isAsc ? source.AsQueryable().OrderBy(propName) : source.AsQueryable().OrderBy(propName + " desc");
|
||||||
|
|
||||||
|
sourceQuery = sourceQuery.Skip((pageIndex - 1) * pageSize);
|
||||||
|
|
||||||
|
var items = sourceQuery
|
||||||
|
.Take(pageSize)
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
var pagedList = new PageOutput<T>()
|
||||||
|
{
|
||||||
|
PageIndex = pageIndex,
|
||||||
|
PageSize = pageSize,
|
||||||
|
TotalCount = count,
|
||||||
|
CurrentPageData = items
|
||||||
|
};
|
||||||
|
|
||||||
|
return pagedList;
|
||||||
|
}
|
||||||
|
|
||||||
//多字段排序 ["a asc", "b desc", "c asc"]
|
//多字段排序 ["a asc", "b desc", "c asc"]
|
||||||
public static PageOutput<T> ToPagedList<T>(this IQueryable<T> source, int pageIndex, int pageSize, string[] sortArray)
|
public static PageOutput<T> ToPagedList<T>(this IQueryable<T> source, int pageIndex, int pageSize, string[] sortArray)
|
||||||
{
|
{
|
||||||
|
@ -180,5 +221,8 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
||||||
|
|
||||||
return pagedList;
|
return pagedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue