diff --git a/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java b/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java index afe125d583..2bdc011c4c 100644 --- a/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java +++ b/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java @@ -77,25 +77,28 @@ public class ShareInfoService { apiDocumentInfoDTOS = this.findApiDocumentSimpleInfoByRequest(apiDocumentRequest, goPage, pageSize); } PageHelper.clearPage(); + List returnList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(apiDocumentInfoDTOS)) { + List apiModuleIdList = new ArrayList<>(); + LogUtil.info("查找模块相关信息"); + List userIdList = new ArrayList<>(); + apiDocumentInfoDTOS.forEach(item -> { + if (StringUtils.isNotBlank(item.getModuleId()) && !apiModuleIdList.contains(item.getModuleId())) { + apiModuleIdList.add(item.getModuleId()); + if (!userIdList.contains(item.getUserId())) { + userIdList.add(item.getUserId()); + } + if (!userIdList.contains(item.getCreateUser())) { + userIdList.add(item.getCreateUser()); + } + } + }); + Map seletedUserMap = userService.getUserIdMapByIds(userIdList); + Map moduleNameMap = apiModuleService.getApiModuleNameDicByIds(apiModuleIdList); + LogUtil.info("开始遍历组装数据"); + returnList = this.conversionModelListToDTO(apiDocumentInfoDTOS, seletedUserMap, moduleNameMap); + } - List apiModuleIdList = new ArrayList<>(); - LogUtil.info("查找模块相关信息"); - List userIdList = new ArrayList<>(); - apiDocumentInfoDTOS.forEach(item -> { - if (StringUtils.isNotBlank(item.getModuleId()) && !apiModuleIdList.contains(item.getModuleId())) { - apiModuleIdList.add(item.getModuleId()); - if (!userIdList.contains(item.getUserId())) { - userIdList.add(item.getUserId()); - } - if (!userIdList.contains(item.getCreateUser())) { - userIdList.add(item.getCreateUser()); - } - } - }); - Map seletedUserMap = userService.getUserIdMapByIds(userIdList); - Map moduleNameMap = apiModuleService.getApiModuleNameDicByIds(apiModuleIdList); - LogUtil.info("开始遍历组装数据"); - List returnList = this.conversionModelListToDTO(apiDocumentInfoDTOS, seletedUserMap, moduleNameMap); return PageUtils.setPageInfo(page, returnList); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiModuleMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiModuleMapper.xml index 4a672f8772..60bc49069a 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiModuleMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiModuleMapper.xml @@ -34,7 +34,7 @@