diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 012c5bef3..466756478 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -1531,9 +1531,6 @@
一致性核查 excel上传 支持三种格式
-
-
-
@@ -1598,7 +1595,6 @@
-
@@ -1633,13 +1629,6 @@
-
-
- 验证QC是否可以操作 数据库查询判断当前QC执行人和登陆的用户是否一致
-
-
-
-
映射配置
diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs
index 0b51f1ccf..a414f206f 100644
--- a/IRaCIS.Core.Application/Service/Management/UserService.cs
+++ b/IRaCIS.Core.Application/Service/Management/UserService.cs
@@ -93,7 +93,7 @@ namespace IRaCIS.Application.Services
return ResponseOutput.NotOk("The mailbox for this user type already exists");
}
- await _userRepository.UpdateNowNoQueryAsync(_userInfo.Id, u => new User()
+ await _userRepository.UpdatePartialNowNoQueryAsync(_userInfo.Id, u => new User()
{
EMail = newEmail
});
@@ -113,7 +113,7 @@ namespace IRaCIS.Application.Services
{
- await _userRepository.UpdateNowNoQueryAsync(_userInfo.Id, u => new User()
+ await _userRepository.UpdatePartialNowNoQueryAsync(_userInfo.Id, u => new User()
{
Phone = newPhone
});
@@ -130,7 +130,7 @@ namespace IRaCIS.Application.Services
{
return ResponseOutput.NotOk("UserId already exists");
}
- await _userRepository.UpdateNowNoQueryAsync(_userInfo.Id, u => new User()
+ await _userRepository.UpdatePartialNowNoQueryAsync(_userInfo.Id, u => new User()
{
UserName = newUserName
});
@@ -148,7 +148,7 @@ namespace IRaCIS.Application.Services
public async Task ResetPassword(Guid userId)
{
- await _userRepository.UpdateNowNoQueryAsync(userId, u => new User()
+ await _userRepository.UpdatePartialNowNoQueryAsync(userId, u => new User()
{
Password = MD5Helper.Md5(StaticData.DefaultPassword),
IsFirstAdd = true
diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs
index 0c4e39ff3..b11cf0b2c 100644
--- a/IRaCIS.Core.Application/Service/QC/QCListService.cs
+++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs
@@ -185,7 +185,6 @@ namespace IRaCIS.Core.Application.Image.QA
var config = await _repository.Where(t => t.Id == challengeQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException();
return ResponseOutput.Ok(pageList, config);
-
}
#endregion
diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
index 4aa316ac3..6cf2bce3a 100644
--- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
+++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
@@ -1277,7 +1277,7 @@ namespace IRaCIS.Core.Application.Image.QA
if (existObj != null)
{
- return ResponseOutput.NotOk($"系统检测发现该受试者当前访视之前的访视:{existObj.VisitName},未提交,疾病进展确认对阅片时限要求很高,请将上述访视提交或标记失访后,再提交当前访视!", ApiResponseCodeEnum.BusinessValidationFailed);
+ return ResponseOutput.NotOk($"系统检测发现该受试者当前访视之前的访视:{existObj.VisitName},未提交,疾病进展确认对阅片时限要求很高,请将上述访视提交或标记失访后,再提交当前访视!", 1);
}
}
else
@@ -1285,7 +1285,7 @@ namespace IRaCIS.Core.Application.Image.QA
if (existObj != null)
{
- return ResponseOutput.NotOk($"系统检测发现该受试者当前访视之前的访视:{existObj.VisitName},未提交。请尽快完成上述访视的影像上传和提交!", ApiResponseCodeEnum.NeedTips);
+ return ResponseOutput.NotOk($"系统检测发现该受试者当前访视之前的访视:{existObj.VisitName},未提交。请尽快完成上述访视的影像上传和提交!", 0);
}
}
}
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs
index c961ccd29..0d072fa0e 100644
--- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs
+++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs
@@ -279,7 +279,7 @@ namespace IRaCIS.Core.Application
[HttpPut("{trialId:guid}/{isAbandon:bool}")]
public async Task AbandonTrial(Guid trialId, /*Guid? signId,*/ bool isAbandon)
{
- await _trialRepository.UpdateNowNoQueryAsync(trialId, u => new Trial() { IsDeleted = isAbandon });
+ await _trialRepository.UpdatePartialNowNoQueryAsync(trialId, u => new Trial() { IsDeleted = isAbandon });
diff --git a/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs b/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs
index cedc82509..1b515b22b 100644
--- a/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs
+++ b/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs
@@ -248,7 +248,7 @@ namespace IRaCIS.Application.Services
//更新项目访视计划状态为已确认 必定生成更新的sql 通过状态改变 触发操作
- await _trialRepository.UpdateNowNoQueryAsync(trialId, t => new Trial() { VisitPlanConfirmed = true });
+ await _trialRepository.UpdatePartialNowNoQueryAsync(trialId, t => new Trial() { VisitPlanConfirmed = true });
//找到访视计划修改的Item
diff --git a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs
index 1b4bc0494..11414b0a2 100644
--- a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs
+++ b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs
@@ -65,7 +65,7 @@ namespace IRaCIS.Application.Services
var attachment = await _attachmentRepository.InsertFromDTOAsync(attachmentViewModel);
//intoGroupItem.AttachmentId = attachment.Id;
- await _enrollRepository.UpdateNoQueryAsync(intoGroupItem.Id,u=>new Enroll(){AttachmentId = attachment.Id});
+ await _enrollRepository.UpdatePartialNoQueryAsync(intoGroupItem.Id,u=>new Enroll(){AttachmentId = attachment.Id});
var success = await _enrollRepository.SaveChangesAsync();
diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs
index d1bdf2fdb..b4b7593a9 100644
--- a/IRaCIS.Core.Application/TestService.cs
+++ b/IRaCIS.Core.Application/TestService.cs
@@ -34,7 +34,7 @@ namespace IRaCIS.Application.Services
- var tt2 = _trialRepository.UpdateFromQueryAsync(Guid.Parse("543d0000-3e10-0016-77e9-08da2827228a"), t => new Trial() { Indication = "WCH测试稽查002" }, true).Result;
+ var tt2 = _trialRepository.UpdatePartialFromQueryAsync(Guid.Parse("543d0000-3e10-0016-77e9-08da2827228a"), t => new Trial() { Indication = "WCH测试稽查002" }, true).Result;
diff --git a/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs b/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs
index 5a7b7c415..ec94617d5 100644
--- a/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs
+++ b/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs
@@ -9,25 +9,58 @@ using Microsoft.EntityFrameworkCore.ChangeTracking;
namespace IRaCIS.Core.Infra.EFCore
{
- public interface ICommandRepository: ICommandRepository where TEntity : Entity
+ public interface ICommandRepository : ICommandRepository where TEntity : Entity
{
+
Task InsertOrUpdateAsync(TFrom from, bool autoSave = false, params EntityVerifyExp[] verify);
Task InsertFromDTOAsync(TFrom from, bool autoSave = false, params EntityVerifyExp[] verify);
+ /// EF 跟踪方式,先查询出完整的实体
+
Task UpdateFromDTOAsync(TFrom from, bool autoSave = false, bool ignoreDtoNullProperty = true, params EntityVerifyExp[] verify);
- /// EF跟踪方式 生成 部分字段更新 (只更新传递的字段名 new[] {nameof(User.Name), nameof(User.Age))
- Task UpdatePartialFieldsAsync(TEntity entity, string[] propertyNames, bool autoSave = false, bool ignoreEntityNullProperty = true, params EntityVerifyExp[] verify);
-
- /// EF跟踪方式 生成 部分字段立即更新,默认会去处理更新更新人 更新时间
-
- Task UpdateNowNoQueryAsync(Guid id, Expression> updateFactory, params EntityVerifyExp[] verify);
-
- /// EF跟踪方式 生成 部分字段更新, 通过主键id 和表达式树 更新部分字段,默认不提交事务,一般用于服务里面 和别的操作 一起提交事务
- Task UpdateNoQueryAsync(Guid id, Expression> updateFactory, bool autoSave = false, params EntityVerifyExp[] verify);
+ #region EF 跟踪方式删除 (先查询完整实体,再删除)
+
+ /// 批量删除,EF跟踪方式(所有查询出来,再删除 浪费性能,但是稽查 或者触发某些操作时,需要知道数据库实体信息 不可避免用这种)
+ Task> DeleteFromQueryAsync(Expression> deleteFilter, bool autoSave = false, bool ignoreQueryFilter = false);
+
+ Task DeleteFromQueryAsync(Guid id, bool autoSave = false, bool ignoreQueryFilter = false);
+
+
+ #endregion
+
+
+ #region EF跟踪方式 部分字段更新 会查询出来完整的实体
+
+ /// EF跟踪方式 已有查询好的,再更新部分字段
+ Task UpdateAsync(TEntity entity, Expression> updateFactory,
+ bool autoSave = false, CancellationToken cancellationToken = default);
+
+ /// EF跟踪方式 先查询出来,再更新部分字段
+ Task UpdatePartialFromQueryAsync(Guid id, Expression> updateFactory,
+ bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default);
+
+ /// EF跟踪方式 先查询出来所有实体,再更新部分字段
+ Task UpdatePartialFromQueryAsync(Expression> updateFilter,
+ Expression> updateFactory,
+ bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default);
+
+ #endregion
+
+ #region EF跟踪方式 部分字段更新,不会去数据库查询完整实体
+
+ /// EF跟踪方式 生成 部分字段立即更新,不会去数据库查询完整的实体
+
+ Task UpdatePartialNowNoQueryAsync(Guid id, Expression> updateFactory, params EntityVerifyExp[] verify);
+
+ /// EF跟踪方式 生成 部分字段更新,不会去数据库查询完整的实体
+ Task UpdatePartialNoQueryAsync(Guid id, Expression> updateFactory, bool autoSave = false, params EntityVerifyExp[] verify);
+ #endregion
+
+ #region 不走EF 跟踪机制,直接生成sql 批量更新或者删除
/// 批量删除,相当于原生sql, 没用EF跟踪方式(所有查询出来,再删除 浪费性能)
Task BatchDeleteNoTrackingAsync(Expression> deleteFilter);
@@ -35,45 +68,32 @@ namespace IRaCIS.Core.Infra.EFCore
/// 批量更新,相当于原生sql, 没用EF跟踪方式(所有查询出来,再更新 浪费性能)
Task BatchUpdateNoTrackingAsync(Expression> where, Expression> updateFactory);
+ #endregion
- /// 批量删除,EF跟踪方式(所有查询出来,再删除 浪费性能,但是稽查 或者触发某些操作时,需要知道数据库实体信息 不可避免用这种)
- Task> DeleteFromQueryAsync(Expression> deleteFilter, bool autoSave = false,bool ignoreQueryFilter = false);
-
- Task DeleteFromQueryAsync(Guid id, bool autoSave = false, bool ignoreQueryFilter = false);
-
- /// EF跟踪方式 已有查询好的,再更新部分字段 稽查的时候需要完整的实体信息
- Task UpdateAsync(TEntity entity, Expression> updateFactory,
- bool autoSave = false, CancellationToken cancellationToken = default);
-
- /// EF跟踪方式 先查询出来,再更新部分字段 稽查的时候需要完整的实体信息
- Task UpdateFromQueryAsync(Guid id, Expression> updateFactory,
- bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default);
-
- Task UpdateFromQueryAsync(Expression> updateFilter,
- Expression> updateFactory,
- bool autoSave = false , bool ignoreQueryFilter = false,CancellationToken cancellationToken = default);
+ /// 不常用 暂时废弃
+ Task UpdatePartialFieldsAsync(TEntity entity, string[] propertyNames, bool autoSave = false, bool ignoreEntityNullProperty = true, params EntityVerifyExp[] verify);
}
- public interface ICommandRepository where TEntity : class
+ public interface ICommandRepository where TEntity : class
{
EntityEntry Attach(TEntity entity);
- EntityEntry Entry(TEntity t);
+ EntityEntry Entry(TEntity t);
Task FirstOrDefaultAsync(Expression> exp = null, bool ignoreQueryFilters = false);
- Task AnyAsync(Expression> exp,bool ignoreQueryFilters=false);
+ Task AnyAsync(Expression> exp, bool ignoreQueryFilters = false);
Task MaxAsync(Expression> selector);
Task CountAsync(Expression> whereLambda = null, bool ignoreQueryFilters = false);
- ValueTask AddAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default,bool isSaveAudit=false);
+ ValueTask AddAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default, bool isSaveAudit = false);
Task> AddRangeAsync(IEnumerable entities, bool isSaveAudit = false);
@@ -87,10 +107,6 @@ namespace IRaCIS.Core.Infra.EFCore
- //Task DeleteManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default);
- //Task UpdateManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default);
-
-
}
diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
index b8dc1adf4..3e00821d2 100644
--- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
+++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
@@ -140,7 +140,7 @@ namespace IRaCIS.Core.Infra.EFCore
/// EF跟踪方式 生成 部分字段更新, 通过主键id 和表达式树 更新部分字段
/// 例如 Guid.Parse("8a90c96e-0776-4f7b-82a6-18933d339584"),u => new Dictionary() { ParentId = null, Code = "test" }默认会去处理更新更新人 更新时间
- public async Task UpdateNoQueryAsync(Guid id, Expression> updateFactory, bool autoSave = false, params EntityVerifyExp[] verify)
+ public async Task UpdatePartialNoQueryAsync(Guid id, Expression> updateFactory, bool autoSave = false, params EntityVerifyExp[] verify)
{
await SetPartialFieldUpdateAsync(id, updateFactory, verify);
@@ -150,7 +150,7 @@ namespace IRaCIS.Core.Infra.EFCore
/// EF跟踪方式 生成 部分字段立即更新,默认会去处理更新更新人 更新时间
- public async Task UpdateNowNoQueryAsync(Guid id, Expression> updateFactory,
+ public async Task UpdatePartialNowNoQueryAsync(Guid id, Expression> updateFactory,
params EntityVerifyExp[] verify)
{
await SetPartialFieldUpdateAsync(id, updateFactory, verify);
@@ -242,7 +242,7 @@ namespace IRaCIS.Core.Infra.EFCore
/// EF跟踪方式 先查询出来,再更新部分字段 稽查的时候需要完整的实体信息
- public async Task UpdateFromQueryAsync(Guid id, Expression> updateFactory,
+ public async Task UpdatePartialFromQueryAsync(Guid id, Expression> updateFactory,
bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default)
{
@@ -265,7 +265,7 @@ namespace IRaCIS.Core.Infra.EFCore
return searchEntity;
}
- public async Task UpdateFromQueryAsync(Expression> updateFilter,
+ public async Task UpdatePartialFromQueryAsync(Expression> updateFilter,
Expression> updateFactory,
bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default)
{
diff --git a/IRaCIS.Core.Infrastructure/Extention/Output/ResponseOutput.cs b/IRaCIS.Core.Infrastructure/Extention/Output/ResponseOutput.cs
index 5529aa461..def844ddd 100644
--- a/IRaCIS.Core.Infrastructure/Extention/Output/ResponseOutput.cs
+++ b/IRaCIS.Core.Infrastructure/Extention/Output/ResponseOutput.cs
@@ -147,12 +147,12 @@ namespace IRaCIS.Core.Infrastructure.Extention
/// 消息
/// 数据
///
- public static IResponseOutput NotOk(string msg = "", T data = default, ApiResponseCodeEnum code = ApiResponseCodeEnum.OK)
+ public static IResponseOutput NotOk(string msg = "", T data = default, ApiResponseCodeEnum code = ApiResponseCodeEnum.BusinessValidationFailed)
{
return new ResponseOutput().NotOk(msg, data, code);
}
- public static IResponseOutput NotOk( T data = default, ApiResponseCodeEnum code = ApiResponseCodeEnum.OK)
+ public static IResponseOutput NotOk( T data = default, ApiResponseCodeEnum code = ApiResponseCodeEnum.BusinessValidationFailed)
{
return new ResponseOutput().NotOk("", data, code);
}
@@ -162,7 +162,7 @@ namespace IRaCIS.Core.Infrastructure.Extention
///
/// 消息
///
- public static IResponseOutput NotOk(string msg = "", ApiResponseCodeEnum code = ApiResponseCodeEnum.OK)
+ public static IResponseOutput NotOk(string msg = "", ApiResponseCodeEnum code = ApiResponseCodeEnum.BusinessValidationFailed)
{
return new ResponseOutput().NotOk(msg,code:code);
}