From b9568c037454cf14ba07ca78c39ecaa083eb58d0 Mon Sep 17 00:00:00 2001 From: chaideqing Date: Fri, 10 Nov 2023 08:28:30 +0000 Subject: [PATCH] * Merge commit: fb95bfef17. --- module/testsuite/control.php | 1 + module/testsuite/model.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/module/testsuite/control.php b/module/testsuite/control.php index 03a30b6819..c878b69034 100644 --- a/module/testsuite/control.php +++ b/module/testsuite/control.php @@ -315,6 +315,7 @@ class testsuite extends control $this->loadModel('testcase'); $this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case', 0, 'all'); $this->config->testcase->search['params']['lib']['values'] = $this->loadModel('caselib')->getLibraries(); + $this->config->testcase->search['params']['story']['values'] = array('' => '') + $this->testsuite->getCaseLinkedStories($productID); $this->config->testcase->search['module'] = 'testsuite'; $this->config->testcase->search['actionURL'] = inlink('linkCase', "suiteID=$suiteID¶m=myQueryID"); diff --git a/module/testsuite/model.php b/module/testsuite/model.php index 45ba831306..ef06c55542 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -331,4 +331,22 @@ class testsuiteModel extends model { return $this->dao->delete()->from(TABLE_SUITECASE)->where('`case`')->in($cases)->andWhere('`suite`')->eq($suiteID)->exec(); } + + /** + * 获取产品下用例关联的需求 + * Get case stories by productID. + * + * @param int $productID + * @access public + * @return array + */ + public function getCaseLinkedStories(int $productID): array + { + return $this->dao->select('t1.story, t2.title')->from(TABLE_CASE)->alias('t1') + ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') + ->where('t1.product')->eq($productID) + ->andWhere('t1.deleted')->eq('0') + ->andWhere('t1.story')->ne(0) + ->fetchPairs(); + } }