refactor:删除不必要的方法
This commit is contained in:
@@ -162,7 +162,12 @@ public class VariableAppService : IVariableAppService
|
||||
try
|
||||
{
|
||||
await _repoManager.BeginTranAsync();
|
||||
var delRes = await _repoManager.Variables.DeleteByIdAsync(id);
|
||||
var variable = await _repoManager.Variables.GetByIdAsync(id);
|
||||
if (variable == null)
|
||||
{
|
||||
throw new InvalidOperationException($"删除变量失败:变量ID:{id},请检查变量Id是否存在");
|
||||
}
|
||||
var delRes = await _repoManager.Variables.DeleteAsync(variable);
|
||||
if (delRes == 0)
|
||||
{
|
||||
throw new InvalidOperationException($"删除变量失败:变量ID:{id},请检查变量Id是否存在");
|
||||
@@ -196,13 +201,13 @@ public class VariableAppService : IVariableAppService
|
||||
await _repoManager.BeginTranAsync();
|
||||
|
||||
// 批量删除变量
|
||||
var deletedCount = await _repoManager.Variables.DeleteByIdsAsync(ids);
|
||||
|
||||
// 检查是否所有变量都被成功删除
|
||||
if (deletedCount != ids.Count)
|
||||
{
|
||||
throw new InvalidOperationException($"删除变量失败:请求删除 {ids.Count} 个变量,实际删除 {deletedCount} 个变量");
|
||||
}
|
||||
// var deletedCount = await _repoManager.Variables.DeleteByIdsAsync(ids);
|
||||
//
|
||||
// // 检查是否所有变量都被成功删除
|
||||
// if (deletedCount != ids.Count)
|
||||
// {
|
||||
// throw new InvalidOperationException($"删除变量失败:请求删除 {ids.Count} 个变量,实际删除 {deletedCount} 个变量");
|
||||
// }
|
||||
|
||||
await _repoManager.CommitAsync();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user