From eafcd87c75da1e405fe6cecfb6aeb1884cd23b0a Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 22 Nov 2022 13:34:34 +0800 Subject: [PATCH] Synchronization code --- .../SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs | 8 +++++++- .../SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs index 042615fdf..90e941505 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs @@ -42,13 +42,19 @@ namespace SqlSugar var exp = expression as MethodCallExpression; var argExp = exp.Arguments[0]; var copyContext = this.Context; + if (this.Context.JoinIndex > 0) { copyContext = this.Context.GetCopyContextWithMapping(); copyContext.IsSingle = false; } - var result = "AND " + SubTools.GetMethodValue(copyContext, argExp, ResolveExpressType.WhereMultiple); + var result = "AND " + SubTools.GetMethodValue(copyContext, argExp, ResolveExpressType.WhereMultiple); + + if (this.Context.JoinIndex > 0) + { + this.Context.Parameters.AddRange(copyContext.Parameters); + } var regex = @"^AND (\@Const\d+) $"; if (this.Context is OracleExpressionContext) diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs index 35d404c7e..85b6a201d 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs @@ -53,7 +53,10 @@ namespace SqlSugar } var result = "WHERE " + SubTools.GetMethodValue(copyContext, argExp, ResolveExpressType.WhereMultiple); - + if (this.Context.JoinIndex > 0) + { + this.Context.Parameters.AddRange(copyContext.Parameters); + } var regex = @"^WHERE (\@Const\d+) $"; if (this.Context is OracleExpressionContext)