mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-17 13:39:33 +08:00
Synchronization code
This commit is contained in:
parent
fd7cb5beed
commit
2cc36304c5
@ -1999,6 +1999,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
if (this.Context.CurrentConnectionConfig.DbType != DbType.SqlServer)
|
if (this.Context.CurrentConnectionConfig.DbType != DbType.SqlServer)
|
||||||
{
|
{
|
||||||
|
this.QueryBuilder.Offset = "true";
|
||||||
return this.ToPageList(pageIndex, pageSize);
|
return this.ToPageList(pageIndex, pageSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -22,6 +22,10 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public override string ToSqlString()
|
public override string ToSqlString()
|
||||||
{
|
{
|
||||||
|
if (this.Offset == "true")
|
||||||
|
{
|
||||||
|
return OffsetPage();
|
||||||
|
}
|
||||||
var oldTake = Take;
|
var oldTake = Take;
|
||||||
var oldSkip = Skip;
|
var oldSkip = Skip;
|
||||||
var isDistinctPage = IsDistinct && (Take > 1 || Skip > 1);
|
var isDistinctPage = IsDistinct && (Take > 1 || Skip > 1);
|
||||||
@ -50,6 +54,18 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string OffsetPage()
|
||||||
|
{
|
||||||
|
var skip = this.Skip;
|
||||||
|
var take = this.Take;
|
||||||
|
this.Skip = null;
|
||||||
|
this.Take = null;
|
||||||
|
this.Offset = null;
|
||||||
|
var pageSql = $"SELECT * FROM ( SELECT PAGETABLE1.*,ROWNUM PAGEINDEX FROM( { this.ToSqlString() }) PAGETABLE1 WHERE ROWNUM<={skip+take}) WHERE PAGEINDEX>={(skip==0?skip:(skip+1))}";
|
||||||
|
return pageSql;
|
||||||
|
}
|
||||||
|
|
||||||
public string _ToSqlString()
|
public string _ToSqlString()
|
||||||
{
|
{
|
||||||
string oldOrderBy = this.OrderByValue;
|
string oldOrderBy = this.OrderByValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user