mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
Optimized code
This commit is contained in:
@@ -381,6 +381,21 @@ namespace SqlSugar
|
|||||||
return column.PropertyInfo.GetValue(item, null);
|
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()
|
private void PreToSql()
|
||||||
{
|
{
|
||||||
|
@@ -749,10 +749,7 @@ namespace SqlSugar
|
|||||||
string key = key = keys[i].Key;
|
string key = key = keys[i].Key;
|
||||||
i++;
|
i++;
|
||||||
var value = item;
|
var value = item;
|
||||||
if (value.Contains("= \"SYSDATE\""))
|
value = GetSetSql(value, columns);
|
||||||
{
|
|
||||||
value = value.Replace("= \"SYSDATE\"", "= SYSDATE");
|
|
||||||
}
|
|
||||||
UpdateBuilder.SetValues.Add(new KeyValuePair<string, string>(SqlBuilder.GetTranslationColumnName(key), value));
|
UpdateBuilder.SetValues.Add(new KeyValuePair<string, string>(SqlBuilder.GetTranslationColumnName(key), value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user