diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 990dc6b203..a748f87c0e 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -330,7 +330,7 @@ public class ApiAutomationService { private int getNextNum(String projectId) { ApiScenario apiScenario = extApiScenarioMapper.getNextNum(projectId); - if (apiScenario == null) { + if (apiScenario == null || apiScenario.getNum() == null) { return 100001; } else { return Optional.of(apiScenario.getNum() + 1).orElse(100001); 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 ff3c62eb68..ac223b544a 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -361,7 +361,7 @@ public class ApiDefinitionService { private int getNextNum(String projectId) { ApiDefinition apiDefinition = extApiDefinitionMapper.getNextNum(projectId); - if (apiDefinition == null) { + if (apiDefinition == null || apiDefinition.getNum() == null) { return 100001; } else { return Optional.of(apiDefinition.getNum() + 1).orElse(100001); diff --git a/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java b/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java index 7f51cf6708..019e5c6eea 100644 --- a/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java +++ b/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java @@ -64,7 +64,7 @@ public class HistoricalDataUpgradeService { private int getNextNum(String projectId) { ApiScenario apiScenario = extApiScenarioMapper.getNextNum(projectId); - if (apiScenario == null) { + if (apiScenario == null || apiScenario.getNum() == null) { return 100001; } else { return Optional.of(apiScenario.getNum() + 1).orElse(100001); diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index d7700eab62..8166327466 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -589,7 +589,7 @@ public class PerformanceTestService { private int getNextNum(String projectId) { LoadTest loadTest = extLoadTestMapper.getNextNum(projectId); - if (loadTest == null) { + if (loadTest == null || loadTest.getNum() == null) { return 100001; } else { return Optional.of(loadTest.getNum() + 1).orElse(100001); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 733cad5ef3..edcdfcb1b0 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -984,7 +984,7 @@ public class TestCaseService { */ private int getNextNum(String projectId) { TestCase testCase = extTestCaseMapper.getMaxNumByProjectId(projectId); - if (testCase == null) { + if (testCase == null || testCase.getNum() == null) { return 100001; } else { return Optional.ofNullable(testCase.getNum() + 1).orElse(100001);