修改仓储批量更新和批量删除方法

This commit is contained in:
2022-04-19 09:01:59 +08:00
parent 7c1fdde2f3
commit eda7ac40bf
53 changed files with 316 additions and 254 deletions
@@ -42,7 +42,7 @@ namespace IRaCIS.Application.Services
// File.Delete(temp);
//}
var success =await _attachmentrepository.DeleteFromQueryAsync(a => a.Id == param.Id);
var success =await _attachmentrepository.BatchDeleteAsync(a => a.Id == param.Id);
return ResponseOutput.Result(success);
}
@@ -139,7 +139,7 @@ namespace IRaCIS.Application.Services
//重传的时候,发现 相同语言的官方简历数量为2 那么将重传的简历设置为非官方
if (attachments.Count(t => t.Language == reUpload.Language && t.IsOfficial) == 2)
{
await _attachmentrepository.UpdateFromQueryAsync(t => t.Id == reUpload.Id, u => new Attachment()
await _attachmentrepository.BatchUpdateAsync(t => t.Id == reUpload.Id, u => new Attachment()
{
Path = reUpload.Path,
CreateTime = DateTime.Now,
@@ -150,7 +150,7 @@ namespace IRaCIS.Application.Services
}
else //相同语言的重传
{
await _attachmentrepository.UpdateFromQueryAsync(t => t.Id == reUpload.Id, u => new Attachment()
await _attachmentrepository.BatchUpdateAsync(t => t.Id == reUpload.Id, u => new Attachment()
{
Path = reUpload.Path,
CreateTime = DateTime.Now,
@@ -241,7 +241,7 @@ namespace IRaCIS.Application.Services
[HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")]
public async Task<IResponseOutput> SetLanguage(Guid doctorId, Guid attachmentId, int language)
{
bool result =await _attachmentrepository.UpdateFromQueryAsync(t => t.Id == attachmentId, a => new Attachment
bool result =await _attachmentrepository.BatchUpdateAsync(t => t.Id == attachmentId, a => new Attachment
{
Language = language,
IsOfficial = false
@@ -113,7 +113,7 @@ namespace IRaCIS.Application.Services
var doctor = await _doctorRepository.FirstOrDefaultAsync(t => t.Id == updateModel.Id).IfNullThrowException();
//删除中间表 Title对应的记录
await _repository.DeleteFromQueryAsync<DoctorDictionary>(t => t.DoctorId == updateModel.Id && t.KeyName == StaticData.Title);
await _repository.BatchDeleteAsync<DoctorDictionary>(t => t.DoctorId == updateModel.Id && t.KeyName == StaticData.Title);
var adddata=new List<DoctorDictionary>();
@@ -383,7 +383,7 @@ namespace IRaCIS.Application.Services
//_doctorDictionaryRepository.Delete(t =>
// t.DoctorId == specialtyUpdateModel.Id && t.KeyName == StaticData.ReadingType);
await _repository.DeleteFromQueryAsync<DoctorDictionary>(t =>
await _repository.BatchDeleteAsync<DoctorDictionary>(t =>
t.DoctorId == specialtyUpdateModel.Id && (t.KeyName == StaticData.Subspeciality || t.KeyName == StaticData.ReadingType));
@@ -431,7 +431,7 @@ namespace IRaCIS.Application.Services
{
return ResponseOutput.NotOk("Resume & Consultant Agreement must be upload ");
}
var success = await _doctorRepository.UpdateFromQueryAsync(o => o.Id == auditResumeParam.Id, u => new Doctor()
var success = await _doctorRepository.BatchUpdateAsync(o => o.Id == auditResumeParam.Id, u => new Doctor()
{
CooperateStatus = auditResumeParam.CooperateStatus,
ResumeStatus = auditResumeParam.ResumeStatus,
@@ -92,7 +92,7 @@ namespace IRaCIS.Application.Services
[HttpDelete, Route("{doctorId:guid}")]
public async Task<IResponseOutput> DeleteEducationInfo(Guid id)
{
var success = await _educationRepository.DeleteFromQueryAsync(o => o.Id == id);
var success = await _educationRepository.BatchDeleteAsync(o => o.Id == id);
return ResponseOutput.Result(success);
}
@@ -133,7 +133,7 @@ namespace IRaCIS.Application.Services
[HttpDelete("{doctorId:guid}")]
public async Task<IResponseOutput> DeletePostgraduateInfo(Guid doctorId)
{
var success = await _repository.DeleteFromQueryAsync<Postgraduate>(o => o.Id == doctorId);
var success = await _repository.BatchDeleteAsync<Postgraduate>(o => o.Id == doctorId);
return ResponseOutput.Result(success);
}
}
@@ -112,7 +112,7 @@ namespace IRaCIS.Application.Services
_mapper.Map(trialExperienceViewModel, needUpdate);
await _repository.UpdateAsync(needUpdate);
await _repository.DeleteFromQueryAsync<TrialExperienceCriteria>(t => t.TrialExperienceId == needUpdate.Id);
await _repository.BatchDeleteAsync<TrialExperienceCriteria>(t => t.TrialExperienceId == needUpdate.Id);
List<TrialExperienceCriteria> criteriaList = new List<TrialExperienceCriteria>();
@@ -138,7 +138,7 @@ namespace IRaCIS.Application.Services
[HttpDelete, Route("{doctorId:guid}")]
public async Task<IResponseOutput> DeleteTrialExperience(Guid doctorId)
{
var success = await _repository.DeleteFromQueryAsync<TrialExperience>(o => o.Id == doctorId);
var success = await _repository.BatchDeleteAsync<TrialExperience>(o => o.Id == doctorId);
return ResponseOutput.Result(success);
}
/// <summary>
@@ -152,7 +152,7 @@ namespace IRaCIS.Application.Services
{
//_attachmentRepository.Delete(t => t.DoctorId == updateGCPExperienceParam.Id && t.Type == StaticData.GCP);
var successs = await _repository.UpdateFromQueryAsync<Doctor>(o => o.Id == updateGCPExperienceParam.Id, u => new Doctor()
var successs = await _repository.BatchUpdateAsync<Doctor>(o => o.Id == updateGCPExperienceParam.Id, u => new Doctor()
{
GCP = updateGCPExperienceParam.GCP,
GCPId = updateGCPExperienceParam.GCP==0&&updateGCPExperienceParam.GCPId==null?Guid.Empty: updateGCPExperienceParam.GCPId!.Value
@@ -160,7 +160,7 @@ namespace IRaCIS.Application.Services
if (updateGCPExperienceParam.GCP == 0 && updateGCPExperienceParam.GCPId != null)
{
await _repository.DeleteFromQueryAsync<Attachment>(a => a.Id == updateGCPExperienceParam.GCPId);
await _repository.BatchDeleteAsync<Attachment>(a => a.Id == updateGCPExperienceParam.GCPId);
}
@@ -176,7 +176,7 @@ namespace IRaCIS.Application.Services
[HttpPost]
public async Task<IResponseOutput> UpdateOtherExperience(ClinicalExperienceCommand updateOtherClinicalExperience)
{
var success = await _repository.UpdateFromQueryAsync<Doctor>(o => o.Id == updateOtherClinicalExperience.DoctorId, u => new Doctor()
var success = await _repository.BatchUpdateAsync<Doctor>(o => o.Id == updateOtherClinicalExperience.DoctorId, u => new Doctor()
{
OtherClinicalExperience = updateOtherClinicalExperience.OtherClinicalExperience ?? string.Empty,
OtherClinicalExperienceCN = updateOtherClinicalExperience.OtherClinicalExperienceCN ?? string.Empty
@@ -35,7 +35,7 @@ namespace IRaCIS.Application.Services
}
else
{
var success = await _vacationRepository.UpdateFromQueryAsync(u => u.Id == param.Id,
var success = await _vacationRepository.BatchUpdateAsync(u => u.Id == param.Id,
h => new Vacation
{
StartDate = param.StartDate,
@@ -56,7 +56,7 @@ namespace IRaCIS.Application.Services
[HttpDelete("{holidayId:guid}")]
public async Task<IResponseOutput> DeleteVacation(Guid holidayId)
{
var success = await _vacationRepository.DeleteFromQueryAsync(u => u.Id == holidayId);
var success = await _vacationRepository.BatchDeleteAsync(u => u.Id == holidayId);
return ResponseOutput.Result(success);