|
|
@ -48,13 +48,20 @@ namespace SqlSugar |
|
|
|
{ |
|
|
|
var isFirst = allMethods.First() == methodExp; |
|
|
|
var isLast = allMethods.Last() == methodExp; |
|
|
|
var isIsNegate = false; |
|
|
|
if (methodExp.Arguments.Count == 0) |
|
|
|
{ |
|
|
|
sqls.Add(new KeyValuePair<string, string>(methodExp.Method.Name, "null")); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var sql = SubTools.GetMethodValue(this.context, methodExp.Arguments[0], this.context.IsSingle ? ResolveExpressType.WhereSingle : ResolveExpressType.WhereMultiple); |
|
|
|
var exp = methodExp.Arguments[0]; |
|
|
|
if (ExpressionTool.IsNegate(exp)) |
|
|
|
{ |
|
|
|
isIsNegate = true; |
|
|
|
exp = (exp as UnaryExpression).Operand; |
|
|
|
} |
|
|
|
var sql = SubTools.GetMethodValue(this.context, exp, this.context.IsSingle ? ResolveExpressType.WhereSingle : ResolveExpressType.WhereMultiple); |
|
|
|
if (methodExp.Method.Name == "IF") |
|
|
|
{ |
|
|
|
var parameter = this.context.Parameters.FirstOrDefault(it => it.ParameterName == sql.Trim()); |
|
|
@ -64,6 +71,10 @@ namespace SqlSugar |
|
|
|
this.context.Parameters.Remove(parameter); |
|
|
|
} |
|
|
|
} |
|
|
|
if (isIsNegate) |
|
|
|
{ |
|
|
|
sql = " ("+sql + "*-1) "; |
|
|
|
} |
|
|
|
sqls.Add(new KeyValuePair<string, string>(methodExp.Method.Name, sql)); |
|
|
|
} |
|
|
|
} |
|
|
|