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 706da4ecff..808d393fce 100644 --- a/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java +++ b/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java @@ -70,7 +70,6 @@ public class ShareInfoService { public Pager> selectApiInfoByParam(ApiDocumentRequest apiDocumentRequest, int goPage, int pageSize) { this.iniApiDocumentRequest(apiDocumentRequest); - Map userIdMap = userService.queryName(); Page page = PageHelper.startPage(goPage, pageSize, true); List apiDocumentInfoDTOS = new ArrayList<>(); @@ -81,14 +80,22 @@ public class ShareInfoService { 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, userIdMap, moduleNameMap); + List returnList = this.conversionModelListToDTO(apiDocumentInfoDTOS, seletedUserMap, moduleNameMap); return PageUtils.setPageInfo(page, returnList); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.java index f498354869..407a1d7bfc 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.java @@ -24,9 +24,6 @@ public interface ExtUserMapper { @MapKey("id") Map queryNameByIds(List userIds); - @MapKey("id") - Map queryName(); - List selectAllId(); List selectIdsByQuery(@Param("request") UserRequest request); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.xml index 445ab5f0a7..a833724e09 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.xml @@ -46,7 +46,7 @@ AND (u.name like CONCAT('%', #{userRequest.name},'%') - or u.id like CONCAT('%', #{userRequest.name},'%')) + or u.id like CONCAT('%', #{userRequest.name},'%')) AND u.email like CONCAT('%', #{userRequest.email},'%') @@ -73,19 +73,22 @@ - update user - set - password=#{password,jdbcType=VARCHAR}, - update_time = #{updateTime,jdbcType=BIGINT} - where id=#{id,jdbcType=VARCHAR} - + update user + set password=#{password,jdbcType=VARCHAR}, + update_time = #{updateTime,jdbcType=BIGINT} + where id = #{id,jdbcType=VARCHAR} + + select param_value + from system_parameter + where param_key = #{paramKey,jdbcType=VARCHAR} + - - - update user set last_project_id = #{projectId} where id = #{userId} - and (last_project_id is null or last_project_id = '') + update user + set last_project_id = #{projectId} + where id = #{userId} + and (last_project_id is null or last_project_id = '') - update user set last_workspace_id = #{workspaceId} where id = #{userId} - and (last_workspace_id is null or last_workspace_id = '') + update user + set last_workspace_id = #{workspaceId} + where id = #{userId} + and (last_workspace_id is null or last_workspace_id = '') \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/service/UserService.java b/backend/src/main/java/io/metersphere/service/UserService.java index c4030fcee9..039ec94474 100644 --- a/backend/src/main/java/io/metersphere/service/UserService.java +++ b/backend/src/main/java/io/metersphere/service/UserService.java @@ -101,10 +101,6 @@ public class UserService { return extUserMapper.queryNameByIds(userIds); } - public Map queryName() { - return extUserMapper.queryName(); - } - public UserDTO insert(UserRequest userRequest) { checkUserParam(userRequest); String id = userRequest.getId(); @@ -1502,4 +1498,12 @@ public class UserService { public List getProjectMemberOption(String projectId) { return extUserGroupMapper.getProjectMemberOption(projectId); } + + public Map getUserIdMapByIds(List userIdList) { + return extUserMapper.queryNameByIds(userIdList); + } + + public User selectById(String id) { + return userMapper.selectByPrimaryKey(id); + } }