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_QuartzJob/Seed/QuartzJobCreateDataTabel.cs |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Seed/QuartzJobCreateDataTabel.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Seed/QuartzJobCreateDataTabel.cs
index 20b2651..e96cc65 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Seed/QuartzJobCreateDataTabel.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Seed/QuartzJobCreateDataTabel.cs
@@ -29,6 +29,11 @@
 
 namespace WIDESEAWCS_QuartzJob.Seed
 {
+    /// <summary>
+    /// 鏄犲皠QuartzJob鏁版嵁搴撹〃
+    /// </summary>
+    /// <param name="dbContext"></param>
+    /// <returns></returns>
     public class QuartzJobCreateDataTabel
     {
         private static string SeedDataFolder = "WIDESEAWCS_DB.DBSeed.Json/{0}.tsv";
@@ -106,13 +111,21 @@
                                         else
                                             dic[i].Add("CreateDate", DateTime.Now);
                                     }
-                                    string str = $"SET IDENTITY_INSERT {t.Name} ON;";
+                                    string str = "";
+                                    if (DBContext.DbType == SqlSugar.DbType.SqlServer)
+                                    {
+                                        str += $"SET IDENTITY_INSERT {t.Name} ON;";
 
-                                    str += dbContext.Db.Insertable(dic).AS(t.Name).ToSqlString();
+                                        str += dbContext.Db.Insertable(dic).AS(t.Name).ToSqlString();
 
-                                    str += ($"SET IDENTITY_INSERT {t.Name} OFF;");
+                                        str += ($"SET IDENTITY_INSERT {t.Name} OFF;");
 
-                                    dbContext.Db.Ado.ExecuteCommand(str);
+                                        dbContext.Db.Ado.ExecuteCommand(str);
+                                    }
+                                    else
+                                    {
+                                        dbContext.Db.Insertable(dic).AS(t.Name).ExecuteCommand();
+                                    }
 
                                     ConsoleHelper.WriteSuccessLine($"Table [{t.Name}] SeedData Added Successfully");
                                 }

--
Gitblit v1.9.3