v3.2.801-preview20230915 #1615

This commit is contained in:
2881099
2023-09-13 12:20:16 +08:00
parent 04a01c86df
commit b2eb165182
33 changed files with 139 additions and 32 deletions

View File

@ -694,7 +694,11 @@ namespace FreeSql.Internal.CommonProvider
public TSelect OrderBy(bool condition, string sql, object parms = null)
{
if (condition == false) return this as TSelect;
if (string.IsNullOrEmpty(sql)) _orderby = null;
if (string.IsNullOrEmpty(sql))
{
_orderby = null;
return this as TSelect;
}
var isnull = string.IsNullOrEmpty(_orderby);
_orderby = string.Concat(isnull ? " \r\nORDER BY " : "", _orderby, isnull ? "" : ", ", sql);
if (parms != null) _params.AddRange(_commonUtils.GetDbParamtersByObject(sql, parms));
@ -1264,6 +1268,11 @@ namespace FreeSql.Internal.CommonProvider
_tables[a].Parameter = lambdaExp.Parameters[a];
}
var parser = new WithTempQueryParser(this, null, selector, ret._tables[0]);
if (this._select.StartsWith("WITH "))
{
ret._select = this._select;
this._select = "SELECT ";
}
var sql = $"\r\n{this.ToSql(parser._insideSelectList[0].InsideField)}";
ret.WithSql(sql);
ret._diymemexpWithTempQuery = parser;