From 9eaa0b917919f57e1222d2d88d1886e7b63ec1b7 Mon Sep 17 00:00:00 2001 From: metersphere-bot <78466014+metersphere-bot@users.noreply.github.com> Date: Fri, 2 Jul 2021 09:49:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=9F=E4=BA=A7=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=AD=97=E6=AE=B5=E6=8A=A5=E7=A9=BA=E6=8C=87=E9=92=88?= =?UTF-8?q?=20(#4308)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: chenjianxing --- .../java/io/metersphere/api/service/ApiAutomationService.java | 2 +- .../java/io/metersphere/api/service/ApiDefinitionService.java | 2 +- .../metersphere/api/service/HistoricalDataUpgradeService.java | 2 +- .../metersphere/performance/service/PerformanceTestService.java | 2 +- .../main/java/io/metersphere/track/service/TestCaseService.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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 1b1a23754b..fe96f007a9 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -326,7 +326,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 3190285e6c..131ac823bc 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -359,7 +359,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);