mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-24 04:53:45 +08:00
Update exp to sql
This commit is contained in:
@@ -515,6 +515,11 @@ namespace SqlSugar
|
|||||||
});
|
});
|
||||||
parameter.Context.Result.Append(this.Context.GetAsString(asName, sql));
|
parameter.Context.Result.Append(this.Context.GetAsString(asName, sql));
|
||||||
}
|
}
|
||||||
|
else if (item.NodeType == ExpressionType.Not && (item as UnaryExpression).Operand is MethodCallExpression)
|
||||||
|
{
|
||||||
|
var asValue = packIfElse(GetNewExpressionValue(item)).ObjToString();
|
||||||
|
parameter.Context.Result.Append(this.Context.GetAsString(asName, asValue));
|
||||||
|
}
|
||||||
else if (item is MethodCallExpression || item is UnaryExpression || item is ConditionalExpression || item.NodeType == ExpressionType.Coalesce)
|
else if (item is MethodCallExpression || item is UnaryExpression || item is ConditionalExpression || item.NodeType == ExpressionType.Coalesce)
|
||||||
{
|
{
|
||||||
this.Expression = item;
|
this.Expression = item;
|
||||||
@@ -526,7 +531,15 @@ namespace SqlSugar
|
|||||||
Check.ThrowNotSupportedException(item.GetType().Name);
|
Check.ThrowNotSupportedException(item.GetType().Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public object packIfElse(object methodValue)
|
||||||
|
{
|
||||||
|
methodValue = this.Context.DbMehtods.CaseWhen(new List<KeyValuePair<string, string>>() {
|
||||||
|
new KeyValuePair<string, string>("IF",methodValue.ObjToString()),
|
||||||
|
new KeyValuePair<string, string>("Return","1"),
|
||||||
|
new KeyValuePair<string, string>("End","0")
|
||||||
|
});
|
||||||
|
return methodValue;
|
||||||
|
}
|
||||||
private static bool IsNotCaseExpression(Expression item)
|
private static bool IsNotCaseExpression(Expression item)
|
||||||
{
|
{
|
||||||
if ((item as MethodCallExpression).Method.Name == "IIF")
|
if ((item as MethodCallExpression).Method.Name == "IIF")
|
||||||
|
Reference in New Issue
Block a user