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 789c30ee7e..777bea6712 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -3043,4 +3043,8 @@ public class ApiAutomationService { List follows = apiScenarioFollowMapper.selectByExample(example); return follows.stream().map(ApiScenarioFollow::getFollowId).distinct().collect(Collectors.toList()); } + + public void setScenarioEnvGroupIdNull(String envGroupId) { + extApiScenarioMapper.setScenarioEnvGroupIdNull(envGroupId); + } } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java index 6bf78568d5..55dc0a846c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java @@ -85,4 +85,6 @@ public interface ExtApiScenarioMapper { List getTestCaseForGraph(@Param("ids") Set ids); + void setScenarioEnvGroupIdNull(@Param("environmentGroupId") String environmentGroupId); + } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index 9677f8bd45..4809a3b305 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -389,6 +389,9 @@ update api_scenario set custom_num = num where (custom_num is null or custom_num = '') and project_id = #{projectId} + + update api_scenario set environment_group_id = null where environment_group_id = #{environmentGroupId} +