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}")) ), ); diff --git a/module/story/model.php b/module/story/model.php index b31f770989..17223fc7a7 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(strpos(',story,requirement,epic,', ",{$storyType},") !== false)->andWhere('t2.type')->in($storyType)->fi() ->fetchGroup('project', 'id'); } 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'); // 检查没有关联需求项目,是否在数据中存在。