mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update TDengine
This commit is contained in:
parent
3a22318eb3
commit
4ec8dcdbb1
@ -6,7 +6,13 @@ namespace SqlSugar.TDengine
|
||||
{
|
||||
public class STable
|
||||
{
|
||||
[SugarColumn(IsOnlyIgnoreInsert =true ,IsOnlyIgnoreUpdate =true)]
|
||||
[SugarColumn(IsOnlyIgnoreInsert = true, IsOnlyIgnoreUpdate = true)]
|
||||
public string TagsTypeId { get; set; }
|
||||
public static List<ColumnTagInfo> Tags = null;
|
||||
}
|
||||
public class ColumnTagInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
<projectUrl>https://github.com/sunkaixuan/SqlSugar</projectUrl>
|
||||
<iconUrl>https://secure.gravatar.com/avatar/a82c03402497b2e58fd65038a3699b30</iconUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description> SqlSugar TDengine 核心库 </description>
|
||||
<description> SqlSugar TDengine 核心库 ,DEMO用例: https://github.com/DotNetNext/SqlSugar </description>
|
||||
<copyright>Copyright 2016</copyright>
|
||||
<tags>TDengine Tdengine tdengine</tags>
|
||||
<dependencies>
|
||||
|
@ -414,8 +414,18 @@ namespace SqlSugar.TDengine
|
||||
string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName("STable_"+tableName.ToLower(isAutoToLowerCodeFirst)), string.Join(",\r\n", columnArray));
|
||||
var childTableName = this.SqlBuilder.GetTranslationTableName(tableName.ToLower(isAutoToLowerCodeFirst));
|
||||
var stableName = this.SqlBuilder.GetTranslationTableName("STable_"+tableName.ToLower(isAutoToLowerCodeFirst));
|
||||
if (STable.Tags?.Any() == true)
|
||||
{
|
||||
var colums = STable.Tags.Select(it => this.SqlBuilder.GetTranslationTableName(it.Name)+ " VARCHAR(20) ");
|
||||
tableString=tableString.Replace(SqlBuilder.GetTranslationColumnName("TagsTypeId"), string.Join(",", colums)); ;
|
||||
}
|
||||
this.Context.Ado.ExecuteCommand(tableString);
|
||||
var createChildSql = $"CREATE TABLE IF NOT EXISTS {childTableName} USING {stableName} TAGS('default')";
|
||||
if (STable.Tags?.Any() == true)
|
||||
{
|
||||
var colums = STable.Tags.Select(it => it.Value.ToSqlValue());
|
||||
createChildSql = tableString.Replace("TAGS('default')", $"TAGS({string.Join(",", colums)})"); ;
|
||||
}
|
||||
this.Context.Ado.ExecuteCommand(createChildSql);
|
||||
return tableString;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user