From 17e4c7e3e7b3ef60d9da6de3b2a39a14a53c38a0 Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期三, 12 三月 2025 14:11:33 +0800
Subject: [PATCH] 1

---
 WIDESEAWCS_Server/WIDESEAWCS_Core/AOP/SqlSugarAop.cs |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Core/AOP/SqlSugarAop.cs b/WIDESEAWCS_Server/WIDESEAWCS_Core/AOP/SqlSugarAop.cs
index 3dd4ce7..47bf712 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_Core/AOP/SqlSugarAop.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Core/AOP/SqlSugarAop.cs
@@ -31,7 +31,7 @@
                     }
 
                     PropertyInfo propertyInfo = entityInfo.EntityColumnInfo.PropertyInfo;
-                    SequenceAttirbute? sequenceAttirbute = propertyInfo.GetCustomAttribute<SequenceAttirbute>();
+                    SequenceAttribute? sequenceAttirbute = propertyInfo.GetCustomAttribute<SequenceAttribute>();
                     if (sequenceAttirbute != null)
                     {
                         if (propertyInfo.GetValue(entityInfo.EntityValue)?.ObjToInt() <= 0)
@@ -41,7 +41,7 @@
                                 ConfigId = MainDb.CurrentDbConnId,
                                 ConnectionString = DBContext.GetMainConnectionDb().Connection,
                                 IsAutoCloseConnection = true,
-                                DbType = MainDb.DbType,
+                                DbType = DBContext.DbType,
                             });
                             int count = sugarClient.Ado.GetScalar($"SELECT COUNT(*) FROM sys.sequences WHERE name = '{sequenceAttirbute.SequenceName}'").ObjToInt();
                             if (count == 0)
@@ -100,6 +100,14 @@
                     }
                 }
             }
+
+            if (entityInfo.EntityValue is IBaseHistoryEntity baseHistoryEntity)
+            {
+                if (entityInfo.OperationType == DataFilterType.InsertByObject && entityInfo.PropertyName == nameof(IBaseHistoryEntity.InsertTime))
+                {
+                    baseHistoryEntity.InsertTime = DateTime.Now;
+                }
+            }
         }
     }
 }

--
Gitblit v1.9.3