This commit is contained in:
sunkaixuan 2017-08-28 02:11:43 +08:00
parent 8600287654
commit a296f55b4f
2 changed files with 2 additions and 2 deletions

View File

@ -236,7 +236,7 @@ namespace SqlSugar
var rowNumberString = string.Format(",ROW_NUMBER() OVER({0}) AS RowIndex ", GetOrderByString);
string groupByValue = GetGroupByString + HavingInfos;
string orderByValue = (!isRowNumber && this.OrderByValue.IsValuable()) ? GetOrderByString : null;
if (this.IsCount) { orderByValue = null; }
if (this.IsCount) { orderByValue = null; this.OrderByValue = oldOrderBy; }
sql.AppendFormat(SqlTemplate, GetSelectValue, GetTableNameString, GetWhereValueString, groupByValue, orderByValue);
sql.Replace(UtilConstants.OrderReplace, isRowNumber ? (this.IsCount ? null : rowNumberString) : null);
if (this.IsCount) { return sql.ToString(); }

View File

@ -35,7 +35,7 @@ namespace SqlSugar
var rowNumberString = string.Format(",ROW_NUMBER() OVER({0}) AS RowIndex ", GetOrderByString);
string groupByValue = GetGroupByString + HavingInfos;
string orderByValue = (!isRowNumber && this.OrderByValue.IsValuable()) ? GetOrderByString : null;
if (this.IsCount) { orderByValue = null; }
if (this.IsCount) { orderByValue = null; this.OrderByValue = oldOrderBy; }
sql.AppendFormat(SqlTemplate, GetSelectValue, GetTableNameString, GetWhereValueString, groupByValue, orderByValue);
sql.Replace(UtilConstants.OrderReplace, isRowNumber ? (this.IsCount ? null : rowNumberString) : null);
if (this.IsCount) { return sql.ToString(); }