From eaff2518ab6159c360ec2a865b45002b26fdc4cd Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期一, 19 八月 2024 14:25:47 +0800 Subject: [PATCH] 增加资产删除方法报错提醒 --- Service/HStation.Service.Assets.Core/04-dal/02-postgresql/PumpMain.cs | 89 ++++++++++++++++++++++---------------------- 1 files changed, 44 insertions(+), 45 deletions(-) diff --git a/Service/HStation.Service.Assets.Core/04-dal/02-postgresql/PumpMain.cs b/Service/HStation.Service.Assets.Core/04-dal/02-postgresql/PumpMain.cs index 8f3ab79..32b4625 100644 --- a/Service/HStation.Service.Assets.Core/04-dal/02-postgresql/PumpMain.cs +++ b/Service/HStation.Service.Assets.Core/04-dal/02-postgresql/PumpMain.cs @@ -1,5 +1,4 @@ -锘縰sing log4net.ObjectRenderer; -using Yw.DAL.PostgreSql; +锘縰sing Yw.DAL.PostgreSql; namespace HStation.DAL.PostgreSql { @@ -13,49 +12,7 @@ /// </summary> public override ConnectionConfig ConnectionConfig { - get { return Xhs.ConfigHelper.PostgreSqlConnectionConfig; } - } - - //鎻掑叆鎷撳睍 - public long InsertsEx(Entity.PumpMain pumpMain, Entity.PumpGroupAndMainMap pumpGroupAndMainMap) - { - if (pumpMain == null) - { - return default; - } - using (var db = new SqlSugarClient(ConnectionConfig)) - { - try - { - db.BeginTran(); - var result = db.Insertable(pumpMain).ExecuteReturnSnowflakeId(); - if (result < 0) - { - db.RollbackTran(); - return default; - } - else - { - if (pumpGroupAndMainMap != null) - { - pumpGroupAndMainMap.PumpMainID = result; - var mapresult = db.Insertable(pumpGroupAndMainMap).ExecuteReturnSnowflakeId(); - if (mapresult < 0) - { - db.RollbackTran(); - return default; - } - } - db.CommitTran(); - return result; - } - } - catch (Exception ex) - { - db.RollbackTran(); - throw; - } - } + get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; } } //鍒犻櫎鎷撳睍 @@ -100,5 +57,47 @@ } } } + + //鎻掑叆鎷撳睍 + public long InsertsEx(Entity.PumpMain pumpMain, Entity.PumpGroupAndMainMap pumpGroupAndMainMap) + { + if (pumpMain == null) + { + return default; + } + using (var db = new SqlSugarClient(ConnectionConfig)) + { + try + { + db.BeginTran(); + var result = db.Insertable(pumpMain).ExecuteReturnSnowflakeId(); + if (result < 0) + { + db.RollbackTran(); + return default; + } + else + { + if (pumpGroupAndMainMap != null) + { + pumpGroupAndMainMap.PumpMainID = result; + var mapresult = db.Insertable(pumpGroupAndMainMap).ExecuteReturnSnowflakeId(); + if (mapresult < 0) + { + db.RollbackTran(); + return default; + } + } + } + db.CommitTran(); + return result; + } + catch (Exception ex) + { + db.RollbackTran(); + throw; + } + } + } } } \ No newline at end of file -- Gitblit v1.9.3