From 263f43b1a9950b9a0bed95c0e6da97eb11cb586a Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 18 Feb 2025 13:35:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=B8=8B=E6=8B=89=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TrialSiteUser/PersonalWorkstation.cs | 4 +--- .../Service/TrialSiteUser/TrialService.cs | 13 +++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 5bcb1c088..6ac4fb9ab 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -1384,8 +1384,7 @@ namespace IRaCIS.Core.Application var isIR = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer; - var query = _trialRepository.AsQueryable().IgnoreQueryFilters() - + var query = _trialRepository.AsQueryable().IgnoreQueryFilters() .WhereIf(inQuery.SponsorId != null, o => o.SponsorId == inQuery.SponsorId) .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) .WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.ResearchProgramNo.Contains(inQuery.ResearchProgramNo)) @@ -1393,7 +1392,6 @@ namespace IRaCIS.Core.Application .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.IsDeleted == false && t.TrialUserRoleList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false)) - && (t.TrialStatusStr != StaticData.TrialState.TrialStopped || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) && t.IsDeleted == false) .WhereIf(inQuery.CriterionType != null, o => o.TrialReadingCriterionList.Any(t => t.CriterionType == inQuery.CriterionType && t.IsSigned && t.IsConfirm)) .WhereIf(!string.IsNullOrEmpty(inQuery.PM_EMail), o => o.TrialIdentityUserList.Any(t => t.IdentityUser.EMail.Contains(inQuery.PM_EMail))) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index 2fbb97757..35a1ba2ae 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -10,6 +10,7 @@ using IRaCIS.Core.Infrastructure.Extention; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; +using NPOI.SS.Formula.Functions; using Panda.DynamicWebApi.Attributes; using ZiggyCreatures.Caching.Fusion; @@ -104,15 +105,11 @@ namespace IRaCIS.Core.Application.Service //过滤废除的项目 public async Task> GetTrialSelect() { - - List userTypes = new List { (int)UserTypeEnum.SuperAdmin, (int)UserTypeEnum.Admin, (int)UserTypeEnum.OP }; - return await _trialRepository.AsQueryable() - .WhereIf( !userTypes.Contains(_userInfo.UserTypeEnumInt), - t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == _userInfo.UserTypeId)) - && (t.TrialStatusStr!= StaticData.TrialState.TrialStopped || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) - && t.IsDeleted == false) - + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, + t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == _userInfo.UserTypeId)) && t.IsDeleted == false) + .Where(t=>t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == _userInfo.UserTypeId)) + && (t.TrialStatusStr != StaticData.TrialState.TrialStopped || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); }