- 优化 RawJoin 支持 FULL JOIN 等自定义联表映射;

This commit is contained in:
2881099
2022-05-18 10:45:29 +08:00
parent 766c5e97d3
commit 173f75f0a6
23 changed files with 83 additions and 24 deletions

View File

@ -302,6 +302,11 @@ namespace FreeSql.Internal.CommonProvider
{
if (string.IsNullOrEmpty(sql)) return this as TSelect;
_join.Append(" \r\n").Append(sql);
//fsql.Select<User1, UserGroup>().RawJoin("FULL JOIN UserGroup b ON b.id = a.GroupId").ToSql((a, b) => new { user = a, group = b });
foreach (var tb in _tables)
if (sql.Contains($" {tb.Table.DbName} ") || sql.Contains($" {_commonUtils.QuoteSqlName(tb.Table.DbName)} "))
tb.Type = SelectTableInfoType.RawJoin;
return this as TSelect;
}

View File

@ -24,5 +24,5 @@ namespace FreeSql.Internal.Model
public string Cascade { get; set; }
}
public enum SelectTableInfoType { From, LeftJoin, InnerJoin, RightJoin, Parent }
public enum SelectTableInfoType { From, LeftJoin, InnerJoin, RightJoin, RawJoin, Parent }
}