mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
-
This commit is contained in:
parent
f0881ba672
commit
a0a22b8449
@ -155,6 +155,8 @@ namespace OrmTest.Demo
|
||||
// group id,name take first
|
||||
var list3 = db.Queryable<Student>()
|
||||
.PartitionBy(it => new { it.Id, it.Name }).Take(1).ToList();
|
||||
var list31 = db.Queryable<Student>()
|
||||
.PartitionBy(it => new { it.Id, it.Name }).Take(1).Count();
|
||||
|
||||
int count = 0;
|
||||
|
||||
|
@ -225,7 +225,7 @@ namespace SqlSugar
|
||||
{
|
||||
string oldOrderBy = this.OrderByValue;
|
||||
string externalOrderBy = oldOrderBy;
|
||||
var isCount = this.IsCount;
|
||||
var isCount = this.IsCount&&this.PartitionByValue.IsNullOrEmpty();
|
||||
AppendFilter();
|
||||
sql = new StringBuilder();
|
||||
if (this.OrderByValue == null && (Skip != null || Take != null)) this.OrderByValue = " ORDER BY GetDate() ";
|
||||
@ -239,7 +239,7 @@ namespace SqlSugar
|
||||
string orderByValue = (!isRowNumber && this.OrderByValue.IsValuable()) ? GetOrderByString : null;
|
||||
if (isCount) { orderByValue = null; }
|
||||
sql.AppendFormat(SqlTemplate, GetSelectValue, GetTableNameString, GetWhereValueString, groupByValue, orderByValue);
|
||||
sql.Replace(UtilConstants.ReplaceKey, isRowNumber ? (this.IsCount ? null : rowNumberString) : null);
|
||||
sql.Replace(UtilConstants.ReplaceKey, isRowNumber ? (isCount ? null : rowNumberString) : null);
|
||||
if (isCount) { this.OrderByValue = oldOrderBy; return sql.ToString(); }
|
||||
var result = ToPageSql(sql.ToString(), this.Take, this.Skip);
|
||||
if (ExternalPageIndex > 0)
|
||||
@ -446,7 +446,7 @@ namespace SqlSugar
|
||||
get
|
||||
{
|
||||
if (this.OrderByValue == null) return null;
|
||||
if (IsCount) return null;
|
||||
if (IsCount&&this.PartitionByValue.IsNullOrEmpty()) return null;
|
||||
else
|
||||
{
|
||||
return this.OrderByValue;
|
||||
|
Loading…
Reference in New Issue
Block a user