From b7db2ea1cd3e94d030b2d9ddbbfeef2a4541fd67 Mon Sep 17 00:00:00 2001 From: wangxuepeng Date: Fri, 8 Dec 2023 09:25:31 +0800 Subject: [PATCH] * Refactor pivotModel::getProjectExecutions. --- module/pivot/model.php | 12 ++++-------- module/pivot/tao.php | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/module/pivot/model.php b/module/pivot/model.php index b8ccf31039..f820b15726 100644 --- a/module/pivot/model.php +++ b/module/pivot/model.php @@ -662,19 +662,15 @@ class pivotModel extends model } /** - * Get project and execution name. + * 获取执行的下拉菜单相关数据。 + * Get execution dropdown menu related data. * * @access public * @return array */ - public function getProjectExecutions() + public function getProjectExecutions(): array { - $executions = $this->dao->select('t1.id, t1.name, t2.name as projectname, t1.status, t1.multiple') - ->from(TABLE_EXECUTION)->alias('t1') - ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') - ->where('t1.deleted')->eq(0) - ->andWhere('t1.type')->in('stage,sprint') - ->fetchAll(); + $executions = $this->pivotTao->getProjectAndExecutionNameQuery(); $pairs = array(); foreach($executions as $execution) diff --git a/module/pivot/tao.php b/module/pivot/tao.php index da25a1ed19..d4cec4c335 100644 --- a/module/pivot/tao.php +++ b/module/pivot/tao.php @@ -269,4 +269,21 @@ class pivotTao extends pivotModel ->where('deleted')->eq('0') ->fetchPairs(); } + + /** + * 获取产品和执行名称。 + * Get product and execution name. + * + * @access public + * @return array + */ + protected function getProjectAndExecutionNameQuery(): array + { + return $this->dao->select('t1.id, t1.name, t2.name as projectname, t1.status, t1.multiple') + ->from(TABLE_EXECUTION)->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') + ->where('t1.deleted')->eq(0) + ->andWhere('t1.type')->in('stage,sprint') + ->fetchAll(); + } }