diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index bbc629d452..d44fde0a5a 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -858,8 +858,6 @@ public class ApiDefinitionService { for (int i = 0; i < caseList.size(); i++) { ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = caseList.get(i); apiTestCaseWithBLOBs.setApiDefinitionId(apiDefinition.getId()); - apiTestCaseWithBLOBs.setCreateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId()); - apiTestCaseWithBLOBs.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId()); apiTestCaseWithBLOBs.setVersionId(apiDefinition.getVersionId()); if (apiTestCaseWithBLOBs.getCreateTime() == null) { apiTestCaseWithBLOBs.setCreateTime(System.currentTimeMillis()); @@ -885,6 +883,8 @@ public class ApiDefinitionService { apiTestCaseMapper.updateByPrimaryKeyWithBLOBs(apiTestCaseWithBLOBs); } else { apiTestCaseWithBLOBs.setId(UUID.randomUUID().toString()); + apiTestCaseWithBLOBs.setCreateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId()); + apiTestCaseWithBLOBs.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId()); apiTestCaseMapper.insert(apiTestCaseWithBLOBs); } }