Synchronization code

This commit is contained in:
sunkaixuan
2024-03-14 19:39:27 +08:00
parent b5d564e11a
commit 8fe5556089
3 changed files with 17 additions and 5 deletions

View File

@@ -381,6 +381,21 @@ namespace SqlSugar
return column.PropertyInfo.GetValue(item, null);
}
}
private string GetSetSql(string value, Expression<Func<T, T>> columns)
{
if (value.Contains("= \"SYSDATE\""))
{
value = value.Replace("= \"SYSDATE\"", "= SYSDATE");
}
var shortName=(columns as LambdaExpression).Parameters.First().Name;
var replaceKey= "," + this.SqlBuilder.GetTranslationColumnName(shortName)+".";
var newKey = "," + this.SqlBuilder.GetTranslationColumnName(this.EntityInfo.DbTableName) + ".";
if (replaceKey != newKey)
{
value = value.Replace(replaceKey,",");
}
return value;
}
private void PreToSql()
{

View File

@@ -749,10 +749,7 @@ namespace SqlSugar
string key = key = keys[i].Key;
i++;
var value = item;
if (value.Contains("= \"SYSDATE\""))
{
value = value.Replace("= \"SYSDATE\"", "= SYSDATE");
}
value = GetSetSql(value, columns);
UpdateBuilder.SetValues.Add(new KeyValuePair<string, string>(SqlBuilder.GetTranslationColumnName(key), value));
}
}