Synchronization code

This commit is contained in:
sunkaixuan 2024-06-26 20:37:26 +08:00
parent 1f7e6eaafc
commit 27aebe5784
2 changed files with 10 additions and 4 deletions

View File

@ -329,7 +329,7 @@ namespace SqlSugar
}
PropertyText = PropertyDescriptionText + PropertyText;
classText = classText.Replace(DbFirstTemplate.KeyPropertyName, PropertyText + (isLast ? "" : ("\r\n" + DbFirstTemplate.KeyPropertyName)));
if (ConstructorText.HasValue() && item.DefaultValue != null)
if (ConstructorText.HasValue() && item.DefaultValue != null&&item.IsIdentity!=true)
{
var hasDefaultValue = columns.Skip(index + 1).Any(it => it.DefaultValue.HasValue());
if (item.DefaultValue.EqualCase("CURRENT_TIMESTAMP"))
@ -345,7 +345,7 @@ namespace SqlSugar
}
}
}
if (!columns.Any(it => it.DefaultValue != null))
if (!columns.Any(it => it.DefaultValue != null&&it.IsIdentity==false))
{
ConstructorText = null;
}
@ -570,6 +570,10 @@ namespace SqlSugar
return "null";
}
string result = this.Context.Ado.DbBind.GetConvertString(item.DataType) + "(\"" + convertString + "\")";
if (this.SqlBuilder.SqlParameterKeyWord == ":"&&!string.IsNullOrEmpty(item.OracleDataType))
{
result = this.Context.Ado.DbBind.GetConvertString(item.OracleDataType) + "(\"" + convertString + "\")";
}
return result;
}
private string GetPropertyDescriptionText(DbColumnInfo item, string propertyDescriptionText)

View File

@ -482,7 +482,8 @@ WHERE table_name = '" + tableName + "'");
var current = columns.FirstOrDefault(it => it.DbColumnName.EqualCase(column.DbColumnName));
if (current != null)
{
column.OracleDataType = current.DataType;
column.OracleDataType = current.DataType;
column.DefaultValue = current.DefaultValue?.TrimStart('\'')?.TrimEnd('\'');
}
result.Add(column);
}
@ -503,7 +504,8 @@ WHERE table_name = '" + tableName + "'");
t1.char_length,
t1.data_precision,
t1.data_scale,
t1.nullable,
t1.nullable,
t1.data_default as DefaultValue,
t4.index_name,
t4.column_position,
t4.descend