Update Exp to sql

This commit is contained in:
sunkaixuan 2019-05-25 10:08:08 +08:00
parent 9a45e0cfe6
commit db1b8c5cd3
2 changed files with 15 additions and 0 deletions

View File

@ -253,6 +253,19 @@ namespace SqlSugar
this.Context.Result.Replace(ExpressionConst.FormatSymbol, "NOT");
}
}
protected void AppendNegate(object Value)
{
var isAppend = !this.Context.Result.Contains(ExpressionConst.FormatSymbol);
var lastCharIsSpace = this.Context.Result.LastCharIsSpace;
if (isAppend)
{
this.Context.Result.Append(lastCharIsSpace ? "-" : " -");
}
else
{
this.Context.Result.Replace(ExpressionConst.FormatSymbol, "-");
}
}
protected MethodCallExpressionArgs GetMethodCallArgs(ExpressionParameter parameter, Expression item)
{

View File

@ -123,6 +123,8 @@ namespace SqlSugar
parameter.CommonTempData = CommonTempDataType.Append;
if (nodeType == ExpressionType.Not)
AppendNot(parameter.CommonTempData);
if (nodeType == ExpressionType.Negate)
AppendNegate(parameter.CommonTempData);
base.Start();
parameter.BaseParameter.CommonTempData = parameter.CommonTempData;
parameter.BaseParameter.ChildExpression = base.Expression;