* Refactor getIdList method and case.

This commit is contained in:
tianshujie
2023-09-08 10:25:31 +08:00
parent c25433b45f
commit a5dcde12ba
3 changed files with 14 additions and 19 deletions
+6 -5
View File
@@ -1576,7 +1576,7 @@ class executionModel extends model
* @access public
* @return array
*/
public function getByIdList($executionIdList = array(), $mode = '')
public function getByIdList($executionIdList = array(), $mode = ''): array
{
return $this->dao->select('*')->from(TABLE_EXECUTION)
->where('id')->in($executionIdList)
@@ -1704,21 +1704,22 @@ class executionModel extends model
}
/**
* 获取给定项目下所有执行的Id列表。
* Get execution id list by project.
*
* @param int $projectID
* @param int $status all|undone|wait|doing|suspended|closed
* @param int $projectID
* @param string $status all|undone|wait|doing|suspended|closed
* @access public
* @return array
*/
public function getIdList($projectID, $status = 'all')
public function getIdList(int $projectID, string $status = 'all')
{
return $this->dao->select('id')->from(TABLE_EXECUTION)
->where('type')->in('sprint,stage,kanban')
->andWhere('deleted')->eq('0')
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
->beginIF($status == 'undone')->andWhere('status')->notIN('done,closed')->fi()
->beginIF($status != 'all' and $status != 'undone')->andWhere('status')->in($status)->fi()
->beginIF(!in_array($status, array('all', 'undone')))->andWhere('status')->in($status)->fi()
->fetchPairs('id', 'id');
}