Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing Details

IRC_NewDev
he 2024-08-20 16:03:18 +08:00
commit 2edacc9ff5
8 changed files with 44 additions and 41 deletions

View File

@ -21,7 +21,7 @@ namespace IRaCIS.Core.SCP
//这个注入没有成功--注入是没问题的构造函数也只是支持参数就好错在注入的地方不能写DbContext
//Web程序中通过重用池中DbContext实例可提高高并发场景下的吞吐量 这在概念上类似于ADO.NET Provider原生的连接池操作方式具有节省DbContext实例化成本的优点
services.AddDbContextPool<IRaCISDBContext>((sp, options) =>
services.AddDbContext<IRaCISDBContext>((sp, options) =>
{
// 在控制台
//public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); });

View File

@ -37,8 +37,8 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(queryCommonDocument.CriterionTypeEnum != null, t => t.CriterionTypeEnum == queryCommonDocument.CriterionTypeEnum)
.WhereIf(queryCommonDocument.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == queryCommonDocument.BusinessScenarioEnum)
.WhereIf(string.IsNullOrEmpty(queryCommonDocument.Code), t => t.Code.Contains(queryCommonDocument.Code))
.WhereIf(string.IsNullOrEmpty(queryCommonDocument.Name), t => t.Name.Contains(queryCommonDocument.Name))
.WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Code), t => t.Code.Contains(queryCommonDocument.Code))
.WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Name), t => t.Name.Contains(queryCommonDocument.Name))
.ProjectTo<CommonDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id });
return await commonDocumentQueryable.ToPagedListAsync(queryCommonDocument);

View File

@ -206,7 +206,8 @@ namespace IRaCIS.Core.Application.Service.Common
var isIR = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer;
var query = _trialRepository.AsQueryable().IgnoreQueryFilters()
var query = _trialRepository.AsQueryable()
.WhereIf(inQuery.TrialIdList.Count()>0, o => inQuery.TrialIdList.Contains(o.Id))
.WhereIf(inQuery.SponsorId != null, o => o.SponsorId == inQuery.SponsorId)
.WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code))

View File

@ -107,7 +107,7 @@ namespace IRaCIS.Core.Application.Contracts
var defalutSortArray = new string[] { nameof(QCQuestionConfigureView.LanguageType) + " desc", nameof(QCQuestionConfigureView.ShowOrder) };
return await QCQuestionQueryable.ToPagedListAsync(queryQCQuestionConfigure, queryQCQuestionConfigure.SortField.IsNullOrEmpty(), defalutSortArray);
return await QCQuestionQueryable.ToPagedListAsync(queryQCQuestionConfigure, defalutSortArray);
}
public async Task<IResponseOutput> AddOrUpdateQCQuestionConfigure(QCQuestionAddOrEdit addOrEditQCQuestionConfigure)

View File

@ -639,7 +639,7 @@ namespace IRaCIS.Core.Application.Service
var defalutSortArray = new string[] { nameof(GetCRCConfirmListOutDto.SubjectCode) + " desc", nameof(GetCRCConfirmListOutDto.LatestScanDate) };
var result = await query.ToPagedListAsync(inDto,inDto.SortField.IsNullOrEmpty(), defalutSortArray);
var result = await query.ToPagedListAsync(inDto, defalutSortArray);
var formList = await _clinicalFormRepository.Where(x => x.TrialId == inDto.TrialId)
.Where(x => x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC)

View File

@ -67,7 +67,7 @@ namespace IRaCIS.Core.Application.Service
var defalutSortArray = new string[] { nameof(ReadingMedicineSystemQuestionView.LanguageType) + " desc", nameof(ReadingMedicineSystemQuestionView.ShowOrder) };
return await query.ToPagedListAsync(inDto, inDto.SortField.IsNullOrEmpty(), defalutSortArray);
return await query.ToPagedListAsync(inDto, defalutSortArray);
}
/// <summary>

View File

@ -279,6 +279,8 @@ namespace IRaCIS.Core.Application.Contracts
public CriterionType? CriterionType { get; set; }
public string? PM_EMail { get; set; }
public List<Guid> TrialIdList { get; set; }=new List<Guid>();
}
public class TrialToBeDoneDto : TrialBaseInfoDto

View File

@ -14,15 +14,15 @@ namespace IRaCIS.Core.Infrastructure.Extention
{
//单字段排序 异步 (或者默认排序字段是空,多字段排序,传递了,就以传递的单字段为准)
public static async Task<PageOutput<T>> ToPagedListAsync<T>(this IQueryable<T> source, PageInput pageInput, bool isMultiSortFiled = false, string[] sortArray = default, CancellationToken cancellationToken = default)
public static async Task<PageOutput<T>> ToPagedListAsync<T>(this IQueryable<T> source, PageInput pageInput, string[] sortArray = default, CancellationToken cancellationToken = default)
{
var isMultiSortFiled = false;
if (isMultiSortFiled && sortArray == default)
if (string.IsNullOrWhiteSpace(pageInput.SortField) && sortArray != default && sortArray != null)
{
throw new InvalidOperationException("The sort field must be specified");
isMultiSortFiled = true;
}
if (pageInput.PageIndex <= 0)
{
pageInput.PageIndex = 1;
@ -39,41 +39,41 @@ namespace IRaCIS.Core.Infrastructure.Extention
return new PageOutput<T>() { CurrentPageData = new T[0] };
}
var propName=string.Empty;
if (string.IsNullOrWhiteSpace(pageInput.SortField))
{
//没有指定优先以Id排序否则从属性里面随便取出来一个排序
var propertyNameList = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(t => t.CanWrite).Select(t => t.Name).OrderBy(t => t).ToList();
if (propertyNameList.Count == 0)
{
throw new InvalidOperationException("no default sort field.");
}
else
{
propName= propertyNameList.Contains("Id") ? "Id" : propertyNameList.FirstOrDefault();
}
}
else
{
//有值,以前段传输的为主
propName = pageInput.SortField;
}
if (!isMultiSortFiled)
{
source = pageInput.Asc ? source.OrderBy(propName) : source.OrderBy(propName + " desc");
}
else
if (isMultiSortFiled)
{
var sortString = string.Join(',', sortArray);
source = source.OrderBy(sortString);
}
else
{
var propName = string.Empty;
if (string.IsNullOrWhiteSpace(pageInput.SortField))
{
//没有指定优先以Id排序否则从属性里面随便取出来一个排序
var propertyNameList = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(t => t.CanWrite).Select(t => t.Name).OrderBy(t => t).ToList();
if (propertyNameList.Count == 0)
{
throw new InvalidOperationException("no default sort field.");
}
else
{
propName = propertyNameList.Contains("Id") ? "Id" : propertyNameList.FirstOrDefault();
}
}
else
{
//有值,以前段传输的为主
propName = pageInput.SortField;
}
source = pageInput.Asc ? source.OrderBy(propName) : source.OrderBy(propName + " desc");
}
source = source.Skip((pageInput.PageIndex - 1) * pageInput.PageSize);
var items = await source