From 9e1cc1521f62df3fe26996d0525fcff26435fb0c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 20 Aug 2024 13:59:52 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/QC/QCQuestionService.cs | 2 +- .../ClinicalData/ClinicalAnswerService.cs | 2 +- .../ReadingMedicineQuestionService.cs | 2 +- .../_IRaCIS/IQueryablePageListExtensions.cs | 68 +++++++++---------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/IRaCIS.Core.Application/Service/QC/QCQuestionService.cs b/IRaCIS.Core.Application/Service/QC/QCQuestionService.cs index a72e93ea7..4c8ebacc0 100644 --- a/IRaCIS.Core.Application/Service/QC/QCQuestionService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCQuestionService.cs @@ -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 AddOrUpdateQCQuestionConfigure(QCQuestionAddOrEdit addOrEditQCQuestionConfigure) diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs index 246cfc8b7..e5aa5e786 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs @@ -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) diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs index a64666ede..187d7c502 100644 --- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs @@ -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); } /// diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs index 9bc8ea98c..8ea41c369 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs @@ -14,15 +14,15 @@ namespace IRaCIS.Core.Infrastructure.Extention { //单字段排序 异步 (或者默认排序字段是空,多字段排序,传递了,就以传递的单字段为准) - public static async Task> ToPagedListAsync(this IQueryable source, PageInput pageInput, bool isMultiSortFiled = false, string[] sortArray = default, CancellationToken cancellationToken = default) + public static async Task> ToPagedListAsync(this IQueryable source, PageInput pageInput, string[] sortArray = default, CancellationToken cancellationToken = default) { + var isMultiSortFiled = true; - if (isMultiSortFiled && sortArray == default) + if (string.IsNullOrWhiteSpace(pageInput.SortField) && sortArray != default) { - 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() { 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 From a6102490c8da0f4c9901a1b334c6da7ff75ea471 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 20 Aug 2024 14:03:42 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=AF=BC=E8=A1=A8-=E6=8C=87=E5=AE=9A=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/ExcelExportService.cs | 3 ++- .../Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 830742482..a87afe8a4 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -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)) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs index c833214ef..833bf4163 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs @@ -279,6 +279,8 @@ namespace IRaCIS.Core.Application.Contracts public CriterionType? CriterionType { get; set; } public string? PM_EMail { get; set; } + + public List TrialIdList { get; set; } } public class TrialToBeDoneDto : TrialBaseInfoDto From 30966715954753f0d70cf33a82af89ff433e09fa Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 20 Aug 2024 14:09:01 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=95=B0=E7=BB=84=E7=BB=99=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs index 833bf4163..c0affbebf 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs @@ -280,7 +280,7 @@ namespace IRaCIS.Core.Application.Contracts public string? PM_EMail { get; set; } - public List TrialIdList { get; set; } + public List TrialIdList { get; set; }=new List(); } public class TrialToBeDoneDto : TrialBaseInfoDto From 8e8b55fa4678d7917ace6938fc7f484cab31037a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 20 Aug 2024 14:58:35 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=88=97=E8=A1=A8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Common/CommonDocumentService.cs | 4 ++-- .../_IRaCIS/IQueryablePageListExtensions.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs b/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs index 35eac6a73..8e0f9aae2 100644 --- a/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs @@ -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(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); return await commonDocumentQueryable.ToPagedListAsync(queryCommonDocument); diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs index 8ea41c369..caf5bac61 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs @@ -16,9 +16,9 @@ namespace IRaCIS.Core.Infrastructure.Extention //单字段排序 异步 (或者默认排序字段是空,多字段排序,传递了,就以传递的单字段为准) public static async Task> ToPagedListAsync(this IQueryable source, PageInput pageInput, string[] sortArray = default, CancellationToken cancellationToken = default) { - var isMultiSortFiled = true; + var isMultiSortFiled = false; - if (string.IsNullOrWhiteSpace(pageInput.SortField) && sortArray != default) + if (string.IsNullOrWhiteSpace(pageInput.SortField) && sortArray != default && sortArray != null) { isMultiSortFiled = true; } From 1937804e4761f2759e7e22d36b30e5bf5a2f56d9 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 20 Aug 2024 15:08:03 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9scp=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRC.Core.SCP/HostConfig/EFSetup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRC.Core.SCP/HostConfig/EFSetup.cs b/IRC.Core.SCP/HostConfig/EFSetup.cs index 73b279ffc..709942cd6 100644 --- a/IRC.Core.SCP/HostConfig/EFSetup.cs +++ b/IRC.Core.SCP/HostConfig/EFSetup.cs @@ -21,7 +21,7 @@ namespace IRaCIS.Core.SCP //这个注入没有成功--注入是没问题的,构造函数也只是支持参数就好,错在注入的地方不能写DbContext //Web程序中通过重用池中DbContext实例可提高高并发场景下的吞吐量, 这在概念上类似于ADO.NET Provider原生的连接池操作方式,具有节省DbContext实例化成本的优点 - services.AddDbContextPool((sp, options) => + services.AddDbContext((sp, options) => { // 在控制台 //public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); });