mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:07:23 +08:00
code optimization
This commit is contained in:
parent
b1be604dc2
commit
ccfd52d223
@ -442,22 +442,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var propertyName = property.Name;
|
asName = GetAsName(item, shortName, property);
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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)
|
private static bool IsBoolValue(Expression item)
|
||||||
{
|
{
|
||||||
return item.Type == UtilConstants.BoolType &&
|
return item.Type == UtilConstants.BoolType &&
|
||||||
|
Loading…
Reference in New Issue
Block a user