From 092a1ea0d645aab9edbe33e3281966cf3be0372a Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 2 Jul 2024 14:29:15 +0800 Subject: [PATCH] + [bug#51740,start,1h,1h] add search method for execution::testcase. --- module/testcase/tao.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/module/testcase/tao.php b/module/testcase/tao.php index 1e4e5f47c4..3cf88a4e35 100644 --- a/module/testcase/tao.php +++ b/module/testcase/tao.php @@ -744,8 +744,28 @@ class testcaseTao extends testcaseModel } } if($this->session->executionCaseQuery === false) $this->session->set('executionCaseQuery', ' 1 = 1'); + $caseQuery = '(' . $this->session->executionCaseQuery; + + /* 处理用例查询中的产品条件。*/ + if(strpos($this->session->executionCaseQuery, "`product` = 'all'") !== false) + { + $caseQuery = str_replace("`product` = 'all'", '1 = 1', $caseQuery); + $caseQuery .= ' AND t2.`product` ' . helper::dbIN($this->app->user->view->products); + } + elseif($productID) + { + $caseQuery .= " AND t2.`product` ='$productID'"; + } + + /* 处理用例查询中的产品分支条件。*/ + if(strpos($caseQuery, "`branch` = 'all'") !== false) $caseQuery = str_replace("`branch` = 'all'", '1 = 1', $caseQuery); + if($branchID !== 'all' && strpos($caseQuery, '`branch` =') === false) $caseQuery .= " AND t2.`branch` in ('$branchID')"; + + /* 处理用例查询中的版本条件。*/ + $caseQuery = str_replace('`version`', 't2.`version`', $caseQuery); $caseQuery .= ')'; + return $this->dao->select('distinct t1.*, t2.*')->from(TABLE_PROJECTCASE)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id') ->where('t1.project')->eq($executionID)