mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-29 10:49:36 +08:00
Update exp to sql
This commit is contained in:
parent
9e35ad6842
commit
2c43911cb9
@ -546,5 +546,18 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static bool IsSubQuery(Expression it)
|
||||||
|
{
|
||||||
|
if (it is MethodCallExpression)
|
||||||
|
{
|
||||||
|
var method = (MethodCallExpression)it;
|
||||||
|
if (method.Object != null && method.Object.Type.Name.StartsWith("Subquery"))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,6 +489,21 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
item = (item as UnaryExpression).Operand;
|
item = (item as UnaryExpression).Operand;
|
||||||
}
|
}
|
||||||
|
if (this.Context.IsSingle&& args.Any(it=>ExpressionTool.IsSubQuery(it))&&base.BaseParameter?.BaseParameter?.BaseParameter?.CurrentExpression!=null)
|
||||||
|
{
|
||||||
|
var exp = base.BaseParameter?.BaseParameter?.BaseParameter?.CurrentExpression;
|
||||||
|
if (exp is LambdaExpression)
|
||||||
|
{
|
||||||
|
var lamExp = (exp as LambdaExpression);
|
||||||
|
if (lamExp.Parameters != null && lamExp.Parameters.Count == 1)
|
||||||
|
{
|
||||||
|
if (this.Context.CurrentShortName == null)
|
||||||
|
{
|
||||||
|
this.Context.SingleTableNameSubqueryShortName = lamExp.Parameters.First().Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
var isBinaryExpression = item is BinaryExpression || item is MethodCallExpression;
|
var isBinaryExpression = item is BinaryExpression || item is MethodCallExpression;
|
||||||
var isConst = item is ConstantExpression;
|
var isConst = item is ConstantExpression;
|
||||||
var isIIF = name == "IIF";
|
var isIIF = name == "IIF";
|
||||||
|
Loading…
Reference in New Issue
Block a user