* [task#132856] adjust get list method.

This commit is contained in:
liyang
2024-11-21 16:02:18 +08:00
committed by 曹延义
parent beff9c5ef6
commit 18239bdcaa
3 changed files with 11 additions and 9 deletions
+1 -1
View File
@@ -542,7 +542,7 @@ class system extends control
$this->app->loadClass('pager', true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$systems = $this->system->getList($orderBy, $pager);
$systems = $this->system->getList($productID, $orderBy, $pager);
foreach($systems as &$system)
{
$system->latestRelease = $system->latestRelease ? $system->latestRelease : '';
+2 -1
View File
@@ -22,10 +22,11 @@ class systemModel extends model
* @access public
* @return array
*/
public function getList(string $orderBy = 'id_desc', object $pager = null): array
public function getList(int $product, string $orderBy = 'id_desc', object $pager = null): array
{
return $this->dao->select('*')->from(TABLE_SYSTEM)
->where('deleted')->eq('0')
->andWhere('product')->eq($product)
->orderBy($orderBy)
->page($pager)
->fetchAll();
+8 -7
View File
@@ -3,6 +3,7 @@
include dirname(__FILE__, 5) . '/test/lib/init.php';
su('admin');
zenData('system')->gen(10);
zenData('product')->gen(10);
/**
@@ -10,8 +11,8 @@ title=测试 systemModel::getList();
timeout=0
cid=1
- 查询默认排序应用第0条的name属性 @应用10
- 获取所有应用数量 @10
- 查询默认排序应用第0条的name属性 @应用1
- 获取所有应用数量 @1
- 查询默认排序应用下的状态第0条的status属性 @active
- 查询ID正序排序应用第0条的name属性 @应用1
- 查询状态倒序排序应用第0条的name属性 @应用1
@@ -22,8 +23,8 @@ $system = $tester->loadModel('system');
$orderList = array('id_desc', 'id_asc', 'status_desc', 'status_asc');
r($system->getList()) && p('0:name') && e('应用10'); // 查询默认排序应用
r(count($system->getList())) && p() && e('10'); // 获取所有应用数量
r($system->getList()) && p('0:status') && e('active'); // 查询默认排序应用下的状态
r($system->getList($orderList[1])) && p('0:name') && e('应用1'); // 查询ID正序排序应用
r($system->getList($orderList[2])) && p('0:name') && e('应用1'); // 查询状态倒序排序应用
r($system->getList(1)) && p('0:name') && e('应用1'); // 查询默认排序应用
r(count($system->getList(1))) && p() && e('1'); // 获取所有应用数量
r($system->getList(1)) && p('0:status') && e('active'); // 查询默认排序应用下的状态
r($system->getList(1, $orderList[1])) && p('0:name') && e('应用1'); // 查询ID正序排序应用
r($system->getList(1, $orderList[2])) && p('0:name') && e('应用1'); // 查询状态倒序排序应用