refactor(用例管理): 用例详情增加更新人和更新时间字段

This commit is contained in:
guoyuqi 2024-05-14 17:51:05 +08:00 committed by Craftsman
parent c2d3ee2a81
commit d10f45872f
2 changed files with 16 additions and 2 deletions

View File

@ -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;

View File

@ -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<User> users = userMapper.selectByExample(userExample);
Map<String, String> 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) {