From da6ebf9b858ae529ece3309feec04b08ca072699 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 21 Apr 2023 10:58:44 +0800 Subject: [PATCH] - --- .../QueryableProvider06-10.cs | 18 ++++++++++++++++++ Src/Asp.Net/SqlSugar/Interface/IQueryable.cs | 2 ++ 2 files changed, 20 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider06-10.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider06-10.cs index e1a5a6574..9ba0bc9a9 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider06-10.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider06-10.cs @@ -1349,6 +1349,15 @@ namespace SqlSugar { return this.Select(expression).MergeTable(); } + public ISugarQueryable LeftJoinIF(bool isLeftJoin, Expression> joinExpression) + { + var result = LeftJoin(joinExpression); + if (isLeftJoin == false) + { + result.QueryBuilder.JoinQueryInfos.Remove(result.QueryBuilder.JoinQueryInfos.Last()); + } + return result; + } public ISugarQueryable LeftJoin(ISugarQueryable joinQueryable, Expression> joinExpression) { this.Context.InitMappingInfo(); @@ -1978,6 +1987,15 @@ namespace SqlSugar { return this.Select(expression).MergeTable(); } + public ISugarQueryable LeftJoinIF(bool isLeftJoin, Expression> joinExpression) + { + var result = LeftJoin(joinExpression); + if (isLeftJoin == false) + { + result.QueryBuilder.JoinQueryInfos.Remove(result.QueryBuilder.JoinQueryInfos.Last()); + } + return result; + } public ISugarQueryable LeftJoin(ISugarQueryable joinQueryable, Expression> joinExpression) { this.Context.InitMappingInfo(); diff --git a/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs b/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs index 428f10544..4ecf119bd 100644 --- a/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs +++ b/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs @@ -1040,6 +1040,7 @@ namespace SqlSugar public partial interface ISugarQueryable : ISugarQueryable { ISugarQueryable SelectMergeTable(Expression> expression); + ISugarQueryable LeftJoinIF(bool isLeftJoin, Expression> joinExpression); ISugarQueryable LeftJoin(ISugarQueryable joinQueryable, Expression> joinExpression); ISugarQueryable InnerJoin(ISugarQueryable joinQueryable, Expression> joinExpression); ISugarQueryable RightJoin(ISugarQueryable joinQueryable, Expression> joinExpression); @@ -1173,6 +1174,7 @@ namespace SqlSugar public partial interface ISugarQueryable : ISugarQueryable { ISugarQueryable SelectMergeTable(Expression> expression); + ISugarQueryable LeftJoinIF(bool isLeftJoin, Expression> joinExpression); ISugarQueryable LeftJoin(ISugarQueryable joinQueryable, Expression> joinExpression); ISugarQueryable InnerJoin(ISugarQueryable joinQueryable, Expression> joinExpression); ISugarQueryable RightJoin(ISugarQueryable joinQueryable, Expression> joinExpression);