mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
code optimization
This commit is contained in:
parent
b1be604dc2
commit
ccfd52d223
@ -442,22 +442,7 @@ namespace SqlSugar
|
||||
}
|
||||
else
|
||||
{
|
||||
var propertyName = property.Name;
|
||||
var dbColumnName = propertyName;
|
||||
var mappingInfo = this.Context.MappingColumns.FirstOrDefault(it => it.EntityName == item.Type.Name && it.PropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||
if (mappingInfo.HasValue())
|
||||
{
|
||||
dbColumnName = mappingInfo.DbColumnName;
|
||||
}
|
||||
asName = this.Context.GetTranslationText(item.Type.Name + "." + propertyName);
|
||||
if (Context.IsJoin)
|
||||
{
|
||||
this.Context.Result.Append(Context.GetAsString(asName, dbColumnName, shortName.ObjToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Context.Result.Append(Context.GetAsString(asName, dbColumnName));
|
||||
}
|
||||
asName = GetAsName(item, shortName, property);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -496,6 +481,29 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
|
||||
private string GetAsName(Expression item, object shortName, PropertyInfo property)
|
||||
{
|
||||
string asName;
|
||||
var propertyName = property.Name;
|
||||
var dbColumnName = propertyName;
|
||||
var mappingInfo = this.Context.MappingColumns.FirstOrDefault(it => it.EntityName == item.Type.Name && it.PropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||
if (mappingInfo.HasValue())
|
||||
{
|
||||
dbColumnName = mappingInfo.DbColumnName;
|
||||
}
|
||||
asName = this.Context.GetTranslationText(item.Type.Name + "." + propertyName);
|
||||
if (Context.IsJoin)
|
||||
{
|
||||
this.Context.Result.Append(Context.GetAsString(asName, dbColumnName, shortName.ObjToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Context.Result.Append(Context.GetAsString(asName, dbColumnName));
|
||||
}
|
||||
|
||||
return asName;
|
||||
}
|
||||
|
||||
private static bool IsBoolValue(Expression item)
|
||||
{
|
||||
return item.Type == UtilConstants.BoolType &&
|
||||
|
Loading…
Reference in New Issue
Block a user