Browse Source

Update exp to sql

pull/33/head
sunkaixuan 2 years ago
parent
commit
a47eaa44a4
  1. 5
      Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs
  2. 5
      Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs

5
Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs

@ -43,7 +43,8 @@ namespace SqlSugar
var argExp = exp.Arguments[0];
var copyContext = this.Context;
if (this.Context.JoinIndex > 0)
var pars = ExpressionTool.GetParameters(expression).Distinct();
if (this.Context.JoinIndex > 0|| pars.Count()>1)
{
copyContext = this.Context.GetCopyContextWithMapping();
copyContext.IsSingle = false;
@ -51,7 +52,7 @@ namespace SqlSugar
var result = "AND " + SubTools.GetMethodValue(copyContext, argExp, ResolveExpressType.WhereMultiple);
if (this.Context.JoinIndex > 0)
if (this.Context.JoinIndex > 0 || pars.Count() > 1)
{
this.Context.Parameters.AddRange(copyContext.Parameters);
this.Context.Index = copyContext.Index;

5
Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs

@ -46,14 +46,15 @@ namespace SqlSugar
}
var argExp = exp.Arguments[0];
var copyContext = this.Context;
if (this.Context.JoinIndex > 0)
var pars=ExpressionTool.GetParameters(expression).Distinct();
if (this.Context.JoinIndex > 0|| pars.Count()>1)
{
copyContext = this.Context.GetCopyContextWithMapping();
copyContext.IsSingle = false;
}
var result = "WHERE " + SubTools.GetMethodValue(copyContext, argExp, ResolveExpressType.WhereMultiple);
if (this.Context.JoinIndex > 0)
if (this.Context.JoinIndex > 0 ||pars.Count() > 1)
{
this.Context.Parameters.AddRange(copyContext.Parameters);
this.Context.Index = copyContext.Index;

Loading…
Cancel
Save