Browse Source

Update exp to sql

pull/31/head
sunkaixuan 2 years ago
parent
commit
dceb6d1a5c
  1. 6
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ExpressionContext.cs
  2. 7
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve_Item.cs

6
Src/Asp.Net/SqlSugar/ExpressionsToSql/ExpressionContext.cs

@ -246,6 +246,12 @@ namespace SqlSugar
return string.Format(" {0} {1} {2} ", GetTranslationColumnName(fieldValue), "AS", GetTranslationColumnName(asName));
}
public virtual string GetAsString2(string asName, string fieldValue)
{
if (fieldValue.Contains(".*") || fieldValue == "*") return fieldValue;
return string.Format(" {0} {1} {2} ",fieldValue, "AS", GetTranslationColumnName(asName));
}
public virtual string GetEqString(string eqName, string fieldValue)
{
return string.Format(" {0} {1} {2} ", GetTranslationColumnName(eqName), "=", GetTranslationColumnName(fieldValue));

7
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve_Item.cs

@ -15,8 +15,15 @@ namespace SqlSugar
{
this.Expression = item;
this.Start();
if (ExpressionTool.GetMethodName(item) == "MappingColumn")
{
parameter.Context.Result.Append(this.Context.GetAsString2(asName, parameter.CommonTempData.ObjToString()));
}
else
{
parameter.Context.Result.Append(this.Context.GetAsString(asName, parameter.CommonTempData.ObjToString()));
}
}
private void ResloveCountAny(ExpressionParameter parameter, Expression item, string asName)
{

Loading…
Cancel
Save