Update TDengine

This commit is contained in:
sunkaixuan 2025-02-26 19:40:26 +08:00
parent f2baf9ec70
commit bfdbdf39a6
3 changed files with 19 additions and 5 deletions

View File

@ -12,7 +12,7 @@ namespace SqlSugar.TDengine
{
protected override void Execute(Type entityType, EntityInfo entityInfo)
{
var attr = entityInfo.Type.GetCustomAttribute<STableAttribute>();
var attr =GetCommonSTableAttribute( entityInfo.Type.GetCustomAttribute<STableAttribute>());
if (attr?.STableName!=null&&attr?.Tag1!=null)
{
entityInfo.DbTableName = attr.STableName;
@ -98,7 +98,7 @@ namespace SqlSugar.TDengine
var tableName = GetTableName(entityInfo);
var dbColumns = this.Context.DbMaintenance.GetColumnInfosByTableName(tableName, false);
ConvertColumns(dbColumns);
var attr = entityInfo.Type.GetCustomAttribute<STableAttribute>();
var attr =GetCommonSTableAttribute( entityInfo.Type.GetCustomAttribute<STableAttribute>());
var entityColumns = entityInfo.Columns.Where(it => it.IsIgnore == false).ToList();
if (attr != null && attr.Tag1 != null)
{
@ -222,7 +222,7 @@ namespace SqlSugar.TDengine
var addItem = EntityColumnToDbColumn(entityInfo, entityInfo.DbTableName, item);
dbColumns.Add(addItem);
}
var attr = entityInfo.Type.GetCustomAttribute<STableAttribute>();
var attr =GetCommonSTableAttribute( entityInfo.Type.GetCustomAttribute<STableAttribute>());
var oldTableName = entityInfo.DbTableName;
if (attr != null)
{
@ -249,7 +249,11 @@ namespace SqlSugar.TDengine
}
return result;
}
private STableAttribute GetCommonSTableAttribute(STableAttribute sTableAttribute)
{
return sTableAttribute;
}
public string GetDatabaseTypeName(string typeName)
{
switch (typeName.ToLower())

View File

@ -473,7 +473,7 @@ namespace SqlSugar.TDengine
public override void AddDefaultValue(EntityInfo entityInfo)
{
var talbeName = entityInfo.DbTableName;
var attr = entityInfo.Type.GetCustomAttribute<STableAttribute>();
var attr = GetCommonSTableAttribute(entityInfo.Type.GetCustomAttribute<STableAttribute>());
if (attr?.Tag1 != null)
{
talbeName = attr.STableName;
@ -493,6 +493,11 @@ namespace SqlSugar.TDengine
}
}
private STableAttribute GetCommonSTableAttribute(STableAttribute sTableAttribute)
{
return sTableAttribute;
}
public override List<DbColumnInfo> GetColumnInfosByTableName(string tableName, bool isCache = true)
{

View File

@ -124,5 +124,10 @@ namespace SqlSugar
});
return groups;
}
private STableAttribute GetCommonSTableAttribute(STableAttribute sTableAttribute)
{
return sTableAttribute;
}
}
}