diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseDetailDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseDetailDTO.java index f716996c36..d40f2d6df0 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseDetailDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseDetailDTO.java @@ -68,6 +68,15 @@ public class FunctionalCaseDetailDTO implements Serializable { @Schema(description = "创建时间") private Long createTime; + @Schema(description = "更新人") + private String updateUser; + + @Schema(description = "更新人姓名") + private String updateUserName; + + @Schema(description = "更新时间") + private Long updateTime; + @Schema(description = "用例步骤(JSON),step_model 为 Step 时启用") private String steps; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java index 5897ea2cda..2f0f23a654 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java @@ -36,6 +36,7 @@ import io.metersphere.sdk.util.Translator; import io.metersphere.system.domain.CustomFieldOption; import io.metersphere.system.domain.OperationHistoryExample; import io.metersphere.system.domain.User; +import io.metersphere.system.domain.UserExample; import io.metersphere.system.dto.OperationHistoryDTO; import io.metersphere.system.dto.request.OperationHistoryRequest; import io.metersphere.system.dto.sdk.*; @@ -377,8 +378,12 @@ public class FunctionalCaseService { String name = functionalCaseModuleService.getModuleName(functionalCaseDetailDTO.getModuleId()); functionalCaseDetailDTO.setModuleName(name); - User user = userMapper.selectByPrimaryKey(functionalCaseDetailDTO.getCreateUser()); - functionalCaseDetailDTO.setCreateUserName(user.getName()); + UserExample userExample = new UserExample(); + userExample.createCriteria().andIdIn(List.of(functionalCaseDetailDTO.getCreateUser(), functionalCaseDetailDTO.getUpdateUser())); + List users = userMapper.selectByExample(userExample); + Map userMap = users.stream().collect(Collectors.toMap(User::getId, User::getName)); + functionalCaseDetailDTO.setCreateUserName(userMap.get(functionalCaseDetailDTO.getCreateUser())); + functionalCaseDetailDTO.setUpdateUserName(userMap.get(functionalCaseDetailDTO.getUpdateUser())); } private void handleCount(FunctionalCaseDetailDTO functionalCaseDetailDTO) {