mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 01:58:13 +08:00
-
This commit is contained in:
@@ -223,7 +223,8 @@ namespace SqlSugar
|
|||||||
IsNullable = item.IsNullable,
|
IsNullable = item.IsNullable,
|
||||||
DefaultValue = item.DefaultValue,
|
DefaultValue = item.DefaultValue,
|
||||||
ColumnDescription = item.ColumnDescription,
|
ColumnDescription = item.ColumnDescription,
|
||||||
Length = item.Length
|
Length = item.Length,
|
||||||
|
DecimalDigits=item.DecimalDigits
|
||||||
};
|
};
|
||||||
if (!string.IsNullOrEmpty(item.DataType))
|
if (!string.IsNullOrEmpty(item.DataType))
|
||||||
{
|
{
|
||||||
|
@@ -248,25 +248,6 @@ namespace SqlSugar
|
|||||||
string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName), string.Join(",\r\n", columnArray));
|
string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName), string.Join(",\r\n", columnArray));
|
||||||
return tableString;
|
return tableString;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual string GetSize(DbColumnInfo item)
|
|
||||||
{
|
|
||||||
string dataSize = null;
|
|
||||||
var isMax = item.Length > 4000 || item.Length == -1;
|
|
||||||
if (isMax) {
|
|
||||||
dataSize = item.Length > 0 ? string.Format("({0})", "max") : null;
|
|
||||||
}
|
|
||||||
else if (item.Length > 0 && item.DecimalDigits == 0)
|
|
||||||
{
|
|
||||||
dataSize = item.Length > 0 ? string.Format("({0})", item.Length) : null;
|
|
||||||
}
|
|
||||||
else if (item.Length > 0 && item.DecimalDigits > 0)
|
|
||||||
{
|
|
||||||
dataSize = item.Length > 0 ? string.Format("({0},{1})", item.Length, item.DecimalDigits) : null;
|
|
||||||
}
|
|
||||||
return dataSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual string GetAddColumnSql(string tableName, DbColumnInfo columnInfo)
|
protected virtual string GetAddColumnSql(string tableName, DbColumnInfo columnInfo)
|
||||||
{
|
{
|
||||||
string columnName = this.SqlBuilder.GetTranslationColumnName(columnInfo.DbColumnName);
|
string columnName = this.SqlBuilder.GetTranslationColumnName(columnInfo.DbColumnName);
|
||||||
@@ -295,6 +276,24 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return this.Context.CurrentConnectionConfig.DbType + "." + this.Context.Ado.Connection.Database + "." + cacheKey;
|
return this.Context.CurrentConnectionConfig.DbType + "." + this.Context.Ado.Connection.Database + "." + cacheKey;
|
||||||
}
|
}
|
||||||
|
protected virtual string GetSize(DbColumnInfo item)
|
||||||
|
{
|
||||||
|
string dataSize = null;
|
||||||
|
var isMax = item.Length > 4000 || item.Length == -1;
|
||||||
|
if (isMax)
|
||||||
|
{
|
||||||
|
dataSize = item.Length > 0 ? string.Format("({0})", "max") : null;
|
||||||
|
}
|
||||||
|
else if (item.Length > 0 && item.DecimalDigits == 0)
|
||||||
|
{
|
||||||
|
dataSize = item.Length > 0 ? string.Format("({0})", item.Length) : null;
|
||||||
|
}
|
||||||
|
else if (item.Length > 0 && item.DecimalDigits > 0)
|
||||||
|
{
|
||||||
|
dataSize = item.Length > 0 ? string.Format("({0},{1})", item.Length, item.DecimalDigits) : null;
|
||||||
|
}
|
||||||
|
return dataSize;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -137,6 +137,7 @@ namespace SqlSugar
|
|||||||
column.Length = sugarColumn.Length;
|
column.Length = sugarColumn.Length;
|
||||||
column.OldDbColumnName = sugarColumn.OldColumnName;
|
column.OldDbColumnName = sugarColumn.OldColumnName;
|
||||||
column.DataType = sugarColumn.ColumnDataType;
|
column.DataType = sugarColumn.ColumnDataType;
|
||||||
|
column.DecimalDigits = sugarColumn.DecimalDigits;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -23,5 +23,6 @@ namespace SqlSugar
|
|||||||
public string DbTableName { get; set; }
|
public string DbTableName { get; set; }
|
||||||
public bool IsIgnore { get; set; }
|
public bool IsIgnore { get; set; }
|
||||||
public string DataType { get; set; }
|
public string DataType { get; set; }
|
||||||
|
public int DecimalDigits { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user