Browse Source

Synchronization code

pull/40/head
sunkaixuan 1 year ago
parent
commit
ff2f73c7d4
  1. 12
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs
  2. 12
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs
  3. 4
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Subquerable.cs
  4. 20
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/SubqueryableN.cs

12
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs

@ -54,7 +54,17 @@ namespace SqlSugar
argExp = ExpressionTool.DynamicInvoke(argExp) as Expression;
}
var result = "AND " + SubTools.GetMethodValue(copyContext, argExp, ResolveExpressType.WhereMultiple);
if (argExp.Type == typeof(List<IConditionalModel>))
{
var p = this.Context.Parameters.Last();
this.Context.Parameters.Remove(p);
var cols = p.Value as List<IConditionalModel>;
var sqlObj = this.Context.SugarContext.QueryBuilder.Builder.ConditionalModelToSql(cols, this.Context.ParameterIndex * 100);
this.Context.ParameterIndex = this.Context.ParameterIndex + this.Context.ParameterIndex * 100;
result = "AND " + sqlObj.Key;
this.Context.Parameters.AddRange(sqlObj.Value);
return result;
}
if (this.Context.JoinIndex > 0 || pars.Count() > 1)
{
this.Context.Parameters.AddRange(copyContext.Parameters);

12
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs

@ -57,7 +57,17 @@ namespace SqlSugar
copyContext.IsSingle = false;
}
var result = "WHERE " + SubTools.GetMethodValue(copyContext, argExp, ResolveExpressType.WhereMultiple);
if (argExp.Type == typeof(List<IConditionalModel>))
{
var p= this.Context.Parameters.Last();
this.Context.Parameters.Remove(p);
var cols = p.Value as List<IConditionalModel>;
var sqlObj=this.Context.SugarContext.QueryBuilder.Builder.ConditionalModelToSql(cols,this.Context.ParameterIndex*100);
this.Context.ParameterIndex= this.Context.ParameterIndex+this.Context.ParameterIndex * 100;
result = "WHERE " + sqlObj.Key;
this.Context.Parameters.AddRange(sqlObj.Value);
return result;
}
if (this.Context.JoinIndex > 0 ||pars.Count() > 1)
{
this.Context.Parameters.AddRange(copyContext.Parameters);

4
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Subquerable.cs

@ -26,6 +26,10 @@ namespace SqlSugar
{
return this;
}
public Subqueryable<T> Where(List<IConditionalModel> conditionals)
{
return this;
}
public Subqueryable<T> Where(Expression exp)
{
return this;

20
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/SubqueryableN.cs

@ -150,6 +150,10 @@ namespace SqlSugar
}
public class Subqueryable<T1, T2, T3, T4, T5, T6> : Subqueryable<T1> where T1 : class, new()
{
public new Subqueryable<T1, T2, T3, T4, T5, T6> Where(List<IConditionalModel> conditionals)
{
return this;
}
public Subqueryable<T1, T2, T3, T4, T5, T6, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, JoinType, bool> expression)
{
return new Subqueryable<T1, T2, T3, T4, T5, T6, JoinType>();
@ -189,6 +193,10 @@ namespace SqlSugar
}
public class Subqueryable<T1, T2, T3, T4, T5> : Subqueryable<T1> where T1 : class, new()
{
public new Subqueryable<T1, T2, T3, T4,T5> Where(List<IConditionalModel> conditionals)
{
return this;
}
public Subqueryable<T1, T2, T3, T4, T5, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, T5, JoinType, bool> expression)
{
return new Subqueryable<T1, T2, T3, T4, T5, JoinType>();
@ -224,6 +232,10 @@ namespace SqlSugar
}
public class Subqueryable<T1, T2, T3, T4> : Subqueryable<T1> where T1 : class, new()
{
public new Subqueryable<T1, T2, T3,T4> Where(List<IConditionalModel> conditionals)
{
return this;
}
public Subqueryable<T1, T2, T3, T4, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, JoinType, bool> expression)
{
return new Subqueryable<T1, T2, T3, T4, JoinType>();
@ -324,6 +336,10 @@ namespace SqlSugar
}
public class Subqueryable<T1, T2, T3> : Subqueryable<T1> where T1 : class, new()
{
public new Subqueryable<T1, T2,T3> Where(List<IConditionalModel> conditionals)
{
return this;
}
public Subqueryable<T1, T2, T3, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, JoinType, bool> expression)
{
return new Subqueryable<T1, T2, T3, JoinType>();
@ -420,6 +436,10 @@ namespace SqlSugar
}
public class Subqueryable<T1, T2> : Subqueryable<T1> where T1 : class, new()
{
public new Subqueryable<T1,T2> Where(List<IConditionalModel> conditionals)
{
return this;
}
public Subqueryable<T1, T2, JoinType> InnerJoin<JoinType>(Func<T1, T2, JoinType, bool> expression)
{
return new Subqueryable<T1, T2, JoinType>();

Loading…
Cancel
Save