refactor:删除不必要的方法

This commit is contained in:
2025-10-21 13:01:27 +08:00
parent 6872631933
commit 3116e4ce92
27 changed files with 105 additions and 608 deletions

View File

@@ -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;