diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml index 8c8e2bc256..e175c7d16e 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml @@ -109,7 +109,8 @@ b.num as num, b.title as name, b.handle_user as handleUser, - createUser.name AS createUser, + createUser.id AS createUser, + createUser.name AS createUserName, bc.description AS content, b.`status` as status, b.tags as tags, diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugRelateCaseMapper.xml b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugRelateCaseMapper.xml index 2a2ccc62cf..4f40a08c96 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugRelateCaseMapper.xml +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugRelateCaseMapper.xml @@ -132,6 +132,7 @@ b.title as name, b.handle_user handleUser, b.create_user createUser, + createUser.name AS createUserName, b.`status`, bc.description as content, brc.test_plan_id testPlanId, @@ -140,6 +141,7 @@ bug_relation_case brc INNER JOIN bug b ON brc.bug_id = b.id INNER JOIN bug_content bc ON brc.bug_id = bc.bug_id + LEFT JOIN user createUser ON b.create_user = createUser.id left join test_plan tp on brc.test_plan_id = tp.id @@ -287,6 +289,7 @@ b.title as name, b.handle_user handleUser, b.create_user createUser, + createUser.name AS createUserName, b.`status`, bc.description as content, brc.test_plan_id testPlanId, @@ -296,6 +299,7 @@ INNER JOIN bug b ON brc.bug_id = b.id INNER JOIN bug_content bc ON brc.bug_id = bc.bug_id left join test_plan tp on brc.test_plan_id = tp.id + LEFT JOIN user createUser ON b.create_user = createUser.id and brc.test_plan_case_id = #{request.testPlanCaseId} diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/provider/AssociateBugProvider.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/provider/AssociateBugProvider.java index bf704efbaf..fcb482ee6e 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/provider/AssociateBugProvider.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/provider/AssociateBugProvider.java @@ -19,13 +19,11 @@ import io.metersphere.system.service.UserLoginService; import io.metersphere.system.uid.IDGenerator; import jakarta.annotation.Resource; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; -import java.util.Map; @Service @@ -117,12 +115,9 @@ public class AssociateBugProvider implements BaseAssociateBugProvider { public List buildAssociateBugs(List associateBugs, String projectId) { List headerHandlerOption = bugCommonService.getHeaderHandlerOption(projectId); List statusOption = bugStatusService.getHeaderStatusOption(projectId); - List createUserList = associateBugs.stream().map(BugProviderDTO::getCreateUser).distinct().toList(); - Map userMap = userLoginService.getUserNameMap(createUserList.stream().filter(StringUtils::isNotBlank).distinct().toList()); associateBugs.forEach(item -> { headerHandlerOption.stream().filter(option -> StringUtils.equals(option.getValue(), item.getHandleUser())).findFirst().ifPresent(option -> item.setHandleUserName(option.getText())); statusOption.stream().filter(option -> StringUtils.equals(option.getValue(), item.getStatus())).findFirst().ifPresent(option -> item.setStatusName(option.getText())); - item.setCreateUserName(MapUtils.isNotEmpty(userMap) && userMap.containsKey(item.getCreateUser()) ? userMap.get(item.getCreateUser()) : StringUtils.EMPTY); }); return associateBugs; }