| | |
| | | using log4net.ObjectRenderer; |
| | | using Yw.DAL.PostgreSql; |
| | | using Yw.DAL.PostgreSql; |
| | | |
| | | namespace HStation.DAL.PostgreSql |
| | | { |
| | |
| | | /// </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; } |
| | | } |
| | | |
| | | //删除拓展 |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //插入拓展 |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |