- 优化 ISelect<T1, T2> 对象 .LeftJoin<T2> 表别名;#1348

This commit is contained in:
2881099
2022-11-25 15:03:13 +08:00
parent 77d2a436d6
commit cc89a6c685
4 changed files with 41 additions and 1 deletions

View File

@ -615,18 +615,21 @@ namespace FreeSql.Internal.CommonProvider
{
if (exp == null) return this as TSelect;
_tables[0].Parameter = exp.Parameters[0];
if (_tables.Count > 1 && _tables[1].Table.Type == typeof(T2)) _tables[1].Parameter = exp.Parameters[1];
return this.InternalJoin(exp?.Body, SelectTableInfoType.LeftJoin);
}
public TSelect InnerJoin<T2>(Expression<Func<T1, T2, bool>> exp)
{
if (exp == null) return this as TSelect;
_tables[0].Parameter = exp.Parameters[0];
if (_tables.Count > 1 && _tables[1].Table.Type == typeof(T2)) _tables[1].Parameter = exp.Parameters[1];
return this.InternalJoin(exp?.Body, SelectTableInfoType.InnerJoin);
}
public TSelect RightJoin<T2>(Expression<Func<T1, T2, bool>> exp)
{
if (exp == null) return this as TSelect;
_tables[0].Parameter = exp.Parameters[0];
if (_tables.Count > 1 && _tables[1].Table.Type == typeof(T2)) _tables[1].Parameter = exp.Parameters[1];
return this.InternalJoin(exp?.Body, SelectTableInfoType.RightJoin);
}