diff --git a/Src/Asp.NetCore2/SqlSugar.TDengineCore/TDengine/DbMaintenance/TDengineDbMaintenance.cs b/Src/Asp.NetCore2/SqlSugar.TDengineCore/TDengine/DbMaintenance/TDengineDbMaintenance.cs index d5234dea6..d7640f725 100644 --- a/Src/Asp.NetCore2/SqlSugar.TDengineCore/TDengine/DbMaintenance/TDengineDbMaintenance.cs +++ b/Src/Asp.NetCore2/SqlSugar.TDengineCore/TDengine/DbMaintenance/TDengineDbMaintenance.cs @@ -1,4 +1,4 @@ - using SqlSugar.TDengineAdo; +using SqlSugar.TDengineAdo; using System; using System.Collections.Generic; using System.Data; diff --git a/Src/Asp.NetCore2/SqlSugar.TDengineCore/Tools/SqlSugarExtensions.cs b/Src/Asp.NetCore2/SqlSugar.TDengineCore/Tools/SqlSugarExtensions.cs new file mode 100644 index 000000000..5860cac78 --- /dev/null +++ b/Src/Asp.NetCore2/SqlSugar.TDengineCore/Tools/SqlSugarExtensions.cs @@ -0,0 +1,29 @@ +using SqlSugar.TDengine; +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; + +namespace SqlSugar +{ + public static class SqlSugarExtensions + { + public static void MappingSTableName(this ISqlSugarClient db,string newSTableName) + { + STableAttribute sTableAttribute = typeof(T).GetCustomAttribute(); + if (db.TempItems == null) + { + db.TempItems = new Dictionary(); + } + if (sTableAttribute != null) + { + var key = "GetCommonSTableAttribute_" + sTableAttribute.STableName; + if (db.TempItems.ContainsKey(key)) + { + db.TempItems.Remove(key); + } + db.TempItems.Add(key, newSTableName); + } + } + } +} diff --git a/Src/Asp.NetCore2/SqlSugar.TDengineCore/Tools/UtilMethods.cs b/Src/Asp.NetCore2/SqlSugar.TDengineCore/Tools/UtilMethods.cs index 41b0acf42..58b4360c4 100644 --- a/Src/Asp.NetCore2/SqlSugar.TDengineCore/Tools/UtilMethods.cs +++ b/Src/Asp.NetCore2/SqlSugar.TDengineCore/Tools/UtilMethods.cs @@ -19,7 +19,12 @@ namespace SqlSugar.TDengine { public static STableAttribute GetCommonSTableAttribute(ISqlSugarClient db,STableAttribute sTableAttribute) { - return sTableAttribute; + var key = "GetCommonSTableAttribute_" + sTableAttribute?.STableName; + if (db.TempItems?.ContainsKey(key) == true) + { + sTableAttribute.STableName = db.TempItems[key] +""; + } + return sTableAttribute!; } public static long ToUnixTimestamp(DateTime dateTime) {