+ pager: add offset of paging query.

This commit is contained in:
liugang
2023-08-10 16:25:21 +08:00
parent 67564c6e4b
commit 527fa6a715
+36
View File
@@ -20,6 +20,28 @@ helper::import(dirname(dirname(__FILE__)) . '/base/pager/pager.class.php');
*/
class pager extends basePager
{
/**
* 分页查询起始偏移量。
* offset
*
* @var float
* @access public
*/
public $offset = 0;
/**
* 设置分页查询起始偏移量。
* Set offset of paging query.
*
* @param int $offset
* @access public
* @return void
*/
public function setOffset($offset)
{
$this->offset = $offset;
}
/**
* 设置模块名。
* Set the $moduleName property.
@@ -85,6 +107,20 @@ class pager extends basePager
if($this->app->isFlow) unset($this->params['module']);
}
/**
* 创建limit语句。
* Create the limit string.
*
* @access public
* @return string
*/
public function limit()
{
$limit = '';
if($this->pageTotal > 1) $limit = ' lImiT ' . ($this->offset + ($this->pageID - 1) * $this->recPerPage) . ", $this->recPerPage";
return $limit;
}
/**
* Show pager.
*