/// <summary>
/// 返回分页SQL语句
/// </summary>
/// <param name="selectSql">查询SQL语句</param>
/// <param name="PageIndex">当前页码</param>
/// <param name="PageSize">一页多少条记录</param>
/// <returns></returns>
public static string getPageSplitSQL(string selectSql, int PageIndex, int PageSize)
{
string StartSelectSql = @" select * from (select aa.*, rownum r from (";
int CurrentReadRows = PageIndex * PageSize;
int startRow = (CurrentReadRows - PageSize) < 0 ? 0 : (CurrentReadRows - PageSize);
int endRow = CurrentReadRows == 0 ? PageSize : CurrentReadRows;
string EndSelectSql = string.Format(") aa where rownum <= {1}) bb where r >{0} ", startRow, endRow);
return StartSelectSql + selectSql + EndSelectSql;
}