From 6ae670780041c98a82cb11bbe5fe2f82e1c82154 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期一, 19 八月 2024 10:21:13 +0800 Subject: [PATCH] 修改资产命名空间,修改vmo引用 --- Service/HStation.Service.Assets.Core/04-dal/02-postgresql/PumpMain.cs | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 103 insertions(+), 0 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 new file mode 100644 index 0000000..32b4625 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/04-dal/02-postgresql/PumpMain.cs @@ -0,0 +1,103 @@ +锘縰sing Yw.DAL.PostgreSql; + +namespace HStation.DAL.PostgreSql +{ + /// <summary> + /// + /// </summary> + public partial class PumpMain : BaseDAL_Paras_Flags_TagName_Sorter<Entity.PumpMain>, IPumpMain + { + /// <summary> + /// + /// </summary> + public override ConnectionConfig ConnectionConfig + { + get { return Assets.ConfigHelper.PostgreSqlConnectionConfig; } + } + + //鍒犻櫎鎷撳睍 + public bool DeleteEx(long ID) + { + if (ID <= 0) + { + return default; + } + using (var db = new SqlSugarClient(ConnectionConfig)) + { + try + { + db.BeginTran(); + var main = db.Queryable<Entity.PumpMain>().ToList().Find(x => x.ID == ID); + var result = db.Deleteable(main).ExecuteCommand() > 0; + if (!result) + { + db.RollbackTran(); + return default; + } + else + { + var map = db.Queryable<Entity.PumpGroupAndMainMap>().ToList().Find(x => x.PumpMainID == ID); + if (map != null) + { + var mapresult = db.Deleteable(map).ExecuteCommand() > 0; + if (!mapresult) + { + db.RollbackTran(); + return default; + } + } + } + db.CommitTran(); + return true; + } + catch (Exception ex) + { + db.RollbackTran(); + throw; + } + } + } + + //鎻掑叆鎷撳睍 + 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