From a35745f341d24fd66b47743c3e799b73b3d716cc Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 31 Jul 2025 10:35:07 +0800 Subject: [PATCH 1/4] * [bug#64434,doing,0.1h] add storyType for export data. --- module/story/model.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/story/model.php b/module/story/model.php index b31f770989..56abf9e991 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -517,15 +517,17 @@ class storyModel extends model * Fetch stories by project id list. * * @param array $projectIdList + * @param string $storyType story|requirement|epic * @access public * @return array */ - public function fetchStoriesByProjectIdList(array $projectIdList = array()): array + public function fetchStoriesByProjectIdList(array $projectIdList = array(), string $storyType = ''): array { return $this->dao->select("t2.*,t1.project")->from(TABLE_PROJECTSTORY)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->where('t1.project')->in($projectIdList) ->andWhere('t2.deleted')->eq(0) + ->beginIF($storyType)->andWhere('t2.type')->in($storyType)->fi() ->fetchGroup('project', 'id'); } From f2486ab7dbc4924655cbbc47960445f90dbecd86 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 31 Jul 2025 10:37:32 +0800 Subject: [PATCH 2/4] * [bug#64434,done,0.1h] optimize code. --- module/story/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/story/model.php b/module/story/model.php index 56abf9e991..17223fc7a7 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -527,7 +527,7 @@ class storyModel extends model ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->where('t1.project')->in($projectIdList) ->andWhere('t2.deleted')->eq(0) - ->beginIF($storyType)->andWhere('t2.type')->in($storyType)->fi() + ->beginIF(strpos(',story,requirement,epic,', ",{$storyType},") !== false)->andWhere('t2.type')->in($storyType)->fi() ->fetchGroup('project', 'id'); } From 84510c7353a973fded70b8749b36f144475a925b Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 31 Jul 2025 11:08:26 +0800 Subject: [PATCH 3/4] * [bug#64368,done,0.5h] add sort link for struct list. --- module/api/ui/struct.html.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/api/ui/struct.html.php b/module/api/ui/struct.html.php index 96cac66d64..36bebeb998 100644 --- a/module/api/ui/struct.html.php +++ b/module/api/ui/struct.html.php @@ -24,6 +24,7 @@ div set::userMap($users), set::footPager(usePager()), set::loadPartial(), - set::loadOptions(array('zui-command' => 'updateLazyContent', 'data-lazy-target' => '#table-api-struct')) + set::loadOptions(array('zui-command' => 'updateLazyContent', 'data-lazy-target' => '#table-api-struct')), + set::sortLink(createLink('api', 'struct', "libID={$libID}&releaseID={$releaseID}&orderBy={name}_{sortType}")) ), ); From 9885a199611be853a6ac5ba6d8aecc837b602ab5 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 31 Jul 2025 15:00:22 +0800 Subject: [PATCH 4/4] * [unittest] add steps for fetchstoriesbyprojectidlist method. --- module/story/test/model/fetchstoriesbyprojectidlist.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/module/story/test/model/fetchstoriesbyprojectidlist.php b/module/story/test/model/fetchstoriesbyprojectidlist.php index d3c8dd6d21..24c26dc6c3 100755 --- a/module/story/test/model/fetchstoriesbyprojectidlist.php +++ b/module/story/test/model/fetchstoriesbyprojectidlist.php @@ -9,6 +9,10 @@ cid=0 - 不传入数据。 @1 - 传入不存在的项目ID。 @1 - 检查有关联需求项目的需求数。 @50 +- 检查有关联需求项目的需求 + - 第50条的id属性 @50 + - 第50条的product属性 @1 + - 第50条的title属性 @软件需求50 - 检查没有关联需求项目,是否在数据中存在。 @1 */ @@ -32,5 +36,6 @@ r(empty($storyModel->fetchStoriesByProjectIdList(array()))) && p() && e('1'); r(empty($storyModel->fetchStoriesByProjectIdList(array(100)))) && p() && e('1'); //传入不存在的项目ID。 $storyGroup = $storyModel->fetchStoriesByProjectIdList(array(11, 12)); -r(count($storyGroup[11])) && p() && e('50'); //检查有关联需求项目的需求数。 -r(empty($storyGroup[12])) && p() && e('1'); //检查没有关联需求项目,是否在数据中存在。 +r(count($storyGroup[11])) && p() && e('50'); // 检查有关联需求项目的需求数。 +r($storyGroup[11]) && p('50:id,product,title') && e('50,1,软件需求50'); // 检查有关联需求项目的需求 +r(empty($storyGroup[12])) && p() && e('1'); // 检查没有关联需求项目,是否在数据中存在。