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

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
@@ -93,7 +93,7 @@ namespace IRaCIS.Application.Services
return ResponseOutput.NotOk("不允许直接删除父节点");
}
var success =await menuRepository.DeleteFromQueryAsync(u => u.Id == menuId);
var success =await menuRepository.BatchDeleteAsync(u => u.Id == menuId);
return ResponseOutput.Result(success);
}
@@ -108,13 +108,13 @@ namespace IRaCIS.Application.Services
return ResponseOutput.NotOk("The mailbox for this user type already exists");
}
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
var success = await _userRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new User()
{
EMail = newEmail
});
//删除验证码历史记录
await _verificationCodeRepository.DeleteFromQueryAsync(t => t.UserId == _userInfo.Id && t.CodeType == 0);
await _verificationCodeRepository.BatchDeleteAsync(t => t.UserId == _userInfo.Id && t.CodeType == 0);
return ResponseOutput.Result(success);
@@ -128,7 +128,7 @@ namespace IRaCIS.Application.Services
{
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
var success = await _userRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new User()
{
Phone = newPhone
});
@@ -145,7 +145,7 @@ namespace IRaCIS.Application.Services
{
return ResponseOutput.NotOk("UserId already exists");
}
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
var success = await _userRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new User()
{
UserName = newUserName
});
@@ -163,7 +163,7 @@ namespace IRaCIS.Application.Services
public async Task<IResponseOutput> ResetPassword(Guid userId)
{
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == userId, u => new User()
var success = await _userRepository.BatchUpdateAsync(t => t.Id == userId, u => new User()
{
Password = MD5Helper.Md5(StaticData.DefaultPassword),
IsFirstAdd = true
@@ -243,7 +243,7 @@ namespace IRaCIS.Application.Services
{
//删除验证码历史记录
await _verificationCodeRepository.DeleteFromQueryAsync(t => t.Id == verificationRecord.Id);
await _verificationCodeRepository.BatchDeleteAsync(t => t.Id == verificationRecord.Id);
}
}
@@ -275,7 +275,7 @@ namespace IRaCIS.Application.Services
return ResponseOutput.NotOk("password not change");
}
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == userId, u => new User()
var success = await _userRepository.BatchUpdateAsync(t => t.Id == userId, u => new User()
{
Password = newPwd,
IsFirstAdd = false
@@ -312,14 +312,14 @@ namespace IRaCIS.Application.Services
return ResponseOutput.NotOk("UserId already exists");
}
await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
await _userRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new User()
{
UserName = editPwModel.NewUserName,
});
}
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
var success = await _userRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new User()
{
Password = editPwModel.NewPassWord,
IsFirstAdd = false
@@ -333,7 +333,7 @@ namespace IRaCIS.Application.Services
//医生密码
if (await _doctorRepository.AnyAsync(t => t.Id == _userInfo.Id && t.Password == editPwModel.OldPassWord))
{
var success = await _doctorRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new Doctor()
var success = await _doctorRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new Doctor()
{
Password = editPwModel.NewPassWord
@@ -460,7 +460,7 @@ namespace IRaCIS.Application.Services
return ResponseOutput.NotOk("This user has participated in the trial and couldn't be deleted");
}
var success = await _userRepository.DeleteFromQueryAsync(t => t.Id == userId);
var success = await _userRepository.BatchDeleteAsync(t => t.Id == userId);
return ResponseOutput.Result(success);
}
@@ -475,7 +475,7 @@ namespace IRaCIS.Application.Services
[HttpPost("{userId:guid}/{state:int}")]
public async Task<IResponseOutput> UpdateUserState(Guid userId, UserStateEnum state)
{
var success = await _userRepository.UpdateFromQueryAsync(u => u.Id == userId, t => new User
var success = await _userRepository.BatchUpdateAsync(u => u.Id == userId, t => new User
{
Status = state
});
@@ -83,7 +83,7 @@ namespace IRaCIS.Core.Application.Contracts
return ResponseOutput.NotOk("该用户类型,被某些用户已使用,不能删除");
}
var success = await userTypeServiceRepository.DeleteFromQueryAsync(t => t.Id == userTypeId);
var success = await userTypeServiceRepository.BatchDeleteAsync(t => t.Id == userTypeId);
return ResponseOutput.Result(success);
}