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);