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; PropertyText = PropertyDescriptionText + PropertyText;
classText = classText.Replace(DbFirstTemplate.KeyPropertyName, PropertyText + (isLast ? "" : ("\r\n" + DbFirstTemplate.KeyPropertyName))); 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()); var hasDefaultValue = columns.Skip(index + 1).Any(it => it.DefaultValue.HasValue());
if (item.DefaultValue.EqualCase("CURRENT_TIMESTAMP")) 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; ConstructorText = null;
} }
@@ -570,6 +570,10 @@ namespace SqlSugar
return "null"; return "null";
} }
string result = this.Context.Ado.DbBind.GetConvertString(item.DataType) + "(\"" + convertString + "\")"; 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; return result;
} }
private string GetPropertyDescriptionText(DbColumnInfo item, string propertyDescriptionText) private string GetPropertyDescriptionText(DbColumnInfo item, string propertyDescriptionText)

View File

@@ -483,6 +483,7 @@ WHERE table_name = '" + tableName + "'");
if (current != null) if (current != null)
{ {
column.OracleDataType = current.DataType; column.OracleDataType = current.DataType;
column.DefaultValue = current.DefaultValue?.TrimStart('\'')?.TrimEnd('\'');
} }
result.Add(column); result.Add(column);
} }
@@ -504,6 +505,7 @@ WHERE table_name = '" + tableName + "'");
t1.data_precision, t1.data_precision,
t1.data_scale, t1.data_scale,
t1.nullable, t1.nullable,
t1.data_default as DefaultValue,
t4.index_name, t4.index_name,
t4.column_position, t4.column_position,
t4.descend t4.descend