diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseAttachmentService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseAttachmentService.java index 92cf8767f8..f4aa51931b 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseAttachmentService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseAttachmentService.java @@ -167,7 +167,7 @@ public class FunctionalCaseAttachmentService { })); attachmentDTOs.addAll(filesDTOs); attachmentDTOs.sort(Comparator.comparing(FunctionalCaseAttachmentDTO::getCreateTime).reversed()); - + List returnAttachmentDTO = new ArrayList<>(); if (CollectionUtils.isNotEmpty(attachmentDTOs)) { List userList = attachmentDTOs.stream().map(FunctionalCaseAttachmentDTO::getCreateUser).toList(); UserExample userExample = new UserExample(); @@ -175,11 +175,14 @@ public class FunctionalCaseAttachmentService { List users = userMapper.selectByExample(userExample); Map collect = users.stream().collect(Collectors.toMap(User::getId, User::getName)); attachmentDTOs.forEach(item -> { - String userName = collect.get(item.getCreateUser()); - item.setCreateUserName(userName); + if (!item.isDeleted()) { + String userName = collect.get(item.getCreateUser()); + item.setCreateUserName(userName); + returnAttachmentDTO.add(item); + } }); } - functionalCaseDetailDTO.setAttachments(attachmentDTOs); + functionalCaseDetailDTO.setAttachments(returnAttachmentDTO); }