From da3b869be72f4f56a5b0cd73827094646846b816 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 14 Oct 2024 11:20:24 +0800 Subject: [PATCH] + [task#130250,start,0.5h] add taskModel::getLinkedBugsByTaskID. --- module/bug/model.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/module/bug/model.php b/module/bug/model.php index 9b9c7b3fd1..d79bc8ab15 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2166,4 +2166,22 @@ class bugModel extends model ->andWhere('t3.id')->ne('') ->fetchGroup('revision', 'id'); } + + /** + * 通过任务ID获取相关的Bug + * @param int $taskID + * + * @access public + * @return array|false + */ + public function getLinkedBugsByTaskID(int $taskID): array|false + { + return $this->dao->select('t1.id,t1.title') + ->from(TABLE_BUG)->alias('t1') + ->leftJoin(TABLE_TASK)->alias('t2')->on('t1.task=t2.id') + ->where('t2.id')->eq($taskID) + ->andWhere('t1.deleted')->eq(0) + ->andWhere('t2.deleted')->eq(0) + ->fetchAll('id'); + } }