public override string GetPageListSql(string sql, int start = 1) { string[] sqls = DBProviderHelper.SplitSql(sql); var pageSql = new StringBuilder(); if (start > 1) { pageSql.AppendFormat("{0} limit @PageStart,@PageLimit", sql); } else { pageSql.AppendFormat("{0} limit @PageLimit", sql); } return(pageSql.ToString()); }
public override string GetPageListSql(string sql, int start = 1) { string[] sqls = DBProviderHelper.SplitSql(sql); var pageSql = new StringBuilder(); pageSql.Append("select ROWNUM RN, PageTab.* from "); pageSql.AppendFormat(" ( {0} ) PageTab ", sql); pageSql.Append(" where ROWNUM <= :PageEnd "); //如果查询不是第一页,则需要判断起始行号 if (start > 1) { pageSql.Insert(0, "select * from ( "); pageSql.Append(" ) Where RN>= :PageStart "); } return(pageSql.ToString()); }
public override string GetPageListSql(string sql, int start = 1) { string[] sqls = DBProviderHelper.SplitSql(sql); var pageSql = new StringBuilder(); pageSql.AppendFormat(" Select top (@PageEnd) ROW_NUMBER() over ({0}) RN , {1}", string.IsNullOrEmpty(sqls[3]) ? "ORDER BY (SELECT NULL)" : sqls[3], sqls[2]); //如果查询不是第一页,则需要判断起始行号 if (start > 1) { pageSql.Insert(0, "Select PageTab.* from ( "); pageSql.Append(" ) PageTab Where RN >= @PageStart"); } return(pageSql.ToString()); }