* move getListByConds of xuanbot to extension.

This commit is contained in:
Wenrui LI
2022-12-02 10:36:28 +08:00
parent b6126f996e
commit 71f0eaad7f
2 changed files with 30 additions and 25 deletions
-25
View File
@@ -4339,29 +4339,4 @@ class taskModel extends model
$order ++;
}
}
/**
* Get task list by conditions.
*
* @param object $conds
* @param string $orderBy
* @param int $limit
* @param object $pager
* @access public
* @return array
*/
public function getListByConds($conds, $orderBy = 'id_desc', $limit = 0, $pager = null)
{
return $this->dao->select('*')->from(TABLE_TASK)
->where('deleted')->eq(0)
->beginIF($conds->priList)->andWhere('pri')->in($conds->priList)->fi()
->beginIF($conds->assignedToList)->andWhere('assignedTo')->in($conds->assignedToList)->fi()
->beginIF($conds->statusList)->andWhere('status')->in($conds->statusList)->fi()
->beginIF($conds->idList)->andWhere('id')->in($conds->idList)->fi()
->beginIF($conds->taskName)->andWhere('name')->like("%{$conds->taskName}%")
->orderBy($orderBy)
->beginIF($limit > 0)->limit($limit)->fi()
->page($pager)
->fetchAll('id');
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Get task list by conditions.
*
* @param object $conds
* @param string $orderBy
* @param int $limit
* @param object $pager
* @access public
* @return array
*/
public function getListByConds($conds, $orderBy = 'id_desc', $limit = 0, $pager = null)
{
foreach(array('priList' => array(), 'assignedToList' => array(), 'statusList' => array(), 'idList' => array(), 'taskName' => '') as $condKey => $defaultValue)
{
if(!isset($conds->$condKey)) $conds->$condKey = $defaultValue;
}
return $this->dao->select('*')->from(TABLE_TASK)
->where('deleted')->eq(0)
->beginIF(!empty($conds->priList))->andWhere('pri')->in($conds->priList)->fi()
->beginIF(!empty($conds->assignedToList))->andWhere('assignedTo')->in($conds->assignedToList)->fi()
->beginIF(!empty($conds->statusList))->andWhere('status')->in($conds->statusList)->fi()
->beginIF(!empty($conds->idList))->andWhere('id')->in($conds->idList)->fi()
->beginIF(!empty($conds->taskName))->andWhere('name')->like("%{$conds->taskName}%")
->orderBy($orderBy)
->beginIF($limit > 0)->limit($limit)->fi()
->page($pager)
->fetchAll('id');
}