mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-12-30 19:25:49 +08:00
Merge main branches
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -993,7 +993,8 @@ namespace FreeSql.Internal.CommonProvider
|
||||
List<object> midList = new List<object>();
|
||||
var tbref2 = _commonUtils.GetTableByEntity(tbref.RefEntityType);
|
||||
var tbrefMid = _commonUtils.GetTableByEntity(tbref.RefMiddleEntityType);
|
||||
var sbJoin = new StringBuilder().Append($"{_commonUtils.QuoteSqlName(tbrefMid.DbName)} midtb ON ");
|
||||
var tbrefMidName = _tableRules?.FirstOrDefault()?.Invoke(tbref.RefMiddleEntityType, tbrefMid.DbName) ?? tbrefMid.DbName;
|
||||
var sbJoin = new StringBuilder().Append($"{_commonUtils.QuoteSqlName(tbrefMidName)} midtb ON ");
|
||||
for (var z = 0; z < tbref.RefColumns.Count; z++)
|
||||
{
|
||||
if (z > 0) sbJoin.Append(" AND ");
|
||||
|
||||
@@ -226,6 +226,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this;
|
||||
}
|
||||
|
||||
public ISelectGrouping<TKey, TValue> HavingIf(bool condition, Expression<Func<ISelectGroupingAggregate<TKey, TValue>, bool>> exp) => condition ? Having(exp) : this;
|
||||
public ISelectGrouping<TKey, TValue> Having(Expression<Func<ISelectGroupingAggregate<TKey, TValue>, bool>> exp)
|
||||
{
|
||||
_lambdaParameter = exp?.Parameters[0];
|
||||
|
||||
Reference in New Issue
Block a user