完成保存修改后的变量,和离开视图时提示有变量没有保存

This commit is contained in:
2025-07-03 22:16:47 +08:00
parent 6726085496
commit fdaaf50c1d
7 changed files with 134 additions and 37 deletions

View File

@@ -86,6 +86,26 @@ public class VarDataRepository
return result;
}
}
/// <summary>
/// 更新VariableData
/// </summary>
/// <param name="variableData">VariableData实体</param>
/// <returns></returns>
public async Task<int> UpdateAsync(List<VariableData> variableDatas)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
using (var _db = DbContext.GetInstance())
{
var dbVarDatas = variableDatas.Select(vd=>vd.CopyTo<DbVariableData>());
var result = await _db.Updateable(dbVarDatas.ToList()).ExecuteCommandAsync();
stopwatch.Stop();
Logger.Info($"更新VariableData {variableDatas.Count()}个 耗时:{stopwatch.ElapsedMilliseconds}ms");
return result;
}
}
/// <summary>
/// 根据ID删除VariableData