mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 02:44:58 +08:00
Update navigate query
This commit is contained in:
@@ -514,12 +514,24 @@ namespace SqlSugar
|
|||||||
var method = item as MethodCallExpression;
|
var method = item as MethodCallExpression;
|
||||||
var queryable = this.Context.Queryable<object>();
|
var queryable = this.Context.Queryable<object>();
|
||||||
if (method.Method.Name == "Where")
|
if (method.Method.Name == "Where")
|
||||||
|
{
|
||||||
|
if (method.Arguments[1].Type == typeof(List<IConditionalModel>))
|
||||||
|
{
|
||||||
|
//var x=method.Arguments[1];
|
||||||
|
var conditionals = ExpressionTool.GetExpressionValue(method.Arguments[1]) as List<IConditionalModel>;
|
||||||
|
var whereObj = queryable.QueryBuilder.Builder.ConditionalModelToSql(conditionals);
|
||||||
|
where.Add(whereObj.Key);
|
||||||
|
if(whereObj.Value!=null)
|
||||||
|
result.Parameters.AddRange(whereObj.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
CheckHasRootShortName(method.Arguments[0], method.Arguments[1]);
|
CheckHasRootShortName(method.Arguments[0], method.Arguments[1]);
|
||||||
var exp = method.Arguments[1];
|
var exp = method.Arguments[1];
|
||||||
where.Add(" " + queryable.QueryBuilder.GetExpressionValue(exp, ResolveExpressType.WhereSingle).GetString());
|
where.Add(" " + queryable.QueryBuilder.GetExpressionValue(exp, ResolveExpressType.WhereSingle).GetString());
|
||||||
SetTableShortName(result, queryable);
|
SetTableShortName(result, queryable);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (method.Method.Name == "WhereIF")
|
else if (method.Method.Name == "WhereIF")
|
||||||
{
|
{
|
||||||
var isOk = LambdaExpression.Lambda(method.Arguments[1]).Compile().DynamicInvoke();
|
var isOk = LambdaExpression.Lambda(method.Arguments[1]).Compile().DynamicInvoke();
|
||||||
|
|||||||
@@ -28,7 +28,11 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return new List<T>() { thisValue };
|
return new List<T>() { thisValue };
|
||||||
}
|
}
|
||||||
public static bool Any<T>(this IEnumerable<T> thisValue, IEnumerable<IConditionalModel> conditionalModels)
|
public static bool Any<T>(this IEnumerable<T> thisValue, List<IConditionalModel> conditionalModels)
|
||||||
|
{
|
||||||
|
throw new Exception("Can only be used in expressions");
|
||||||
|
}
|
||||||
|
public static IEnumerable<T> Where<T>(this IEnumerable<T> thisValue, List<IConditionalModel> conditionalModels)
|
||||||
{
|
{
|
||||||
throw new Exception("Can only be used in expressions");
|
throw new Exception("Can only be used in expressions");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user