diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionRequest.java b/backend/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionRequest.java index aa9a8c1504..69848fba1b 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionRequest.java @@ -36,4 +36,10 @@ public class ApiDefinitionRequest extends BaseQueryRequest { //当前时间减去进入待更新的时间 private Long toBeUpdateTime; + + //同步配置 + private ApiSyncCaseRequest syncConfig; + + //全选 + private boolean selectAll; } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/ApiSyncCaseRequest.java b/backend/src/main/java/io/metersphere/api/dto/definition/ApiSyncCaseRequest.java index a249db7e87..d489853220 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/ApiSyncCaseRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/ApiSyncCaseRequest.java @@ -34,4 +34,6 @@ public class ApiSyncCaseRequest { private Boolean unRun; private List ids; + + private Boolean selectAll; } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseRequest.java b/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseRequest.java index 90b29e22a9..be276cee08 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseRequest.java @@ -58,4 +58,10 @@ public class ApiTestCaseRequest extends BaseQueryRequest { //页面跳转时附带的过滤条件 private String redirectFilter; + + //同步配置 + private ApiSyncCaseRequest syncConfig; + + //全选 + private boolean selectAll; } 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 243d140331..08531db861 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -985,9 +985,26 @@ public class ApiDefinitionService { } if (apiDefinition.getToBeUpdated() != null) { - apiTestCaseWithBLOBs.setToBeUpdated(apiDefinition.getToBeUpdated()); - } + ApiSyncCaseRequest apiSyncCaseRequest = new ApiSyncCaseRequest(); + ApiDefinitionSyncService apiDefinitionSyncService = CommonBeanFactory.getBean(ApiDefinitionSyncService.class); + if (apiDefinitionSyncService != null) { + apiSyncCaseRequest = apiDefinitionSyncService.getApiSyncCaseRequest(apiDefinition.getProjectId()); + } + if (apiSyncCaseRequest.getUnRun() != null && apiSyncCaseRequest.getUnRun() && apiTestCaseWithBLOBs.getStatus() != null && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("Trash") + && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("success") && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("error") + && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("Running") && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("errorReportResult") + && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("STOP")) { + apiTestCaseWithBLOBs.setToBeUpdated(true); + + } else if (apiSyncCaseRequest.getRunError() != null && apiSyncCaseRequest.getRunError() && apiTestCaseWithBLOBs.getStatus() != null + && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("Trash") + && apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("error")) { + apiTestCaseWithBLOBs.setToBeUpdated(true); + } else { + apiTestCaseWithBLOBs.setToBeUpdated(false); + } + } if (apiDefinition.getToBeUpdateTime() != null) { apiTestCaseWithBLOBs.setToBeUpdateTime(apiDefinition.getToBeUpdateTime()); } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index 21fac6b63c..91cd7f01fa 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -865,9 +865,13 @@ public class ApiTestCaseService { apiTestCase.setToBeUpdated(true); - } else - apiTestCase.setToBeUpdated(apiSyncCaseRequest.getRunError() != null && apiSyncCaseRequest.getRunError() && apiTestCase.getStatus() != null && !apiTestCase.getStatus().equalsIgnoreCase("Trash") - && !apiTestCase.getStatus().equalsIgnoreCase("error")); + } else if (apiSyncCaseRequest.getRunError() != null && apiSyncCaseRequest.getRunError() && apiTestCase.getStatus() != null && !apiTestCase.getStatus().equalsIgnoreCase("Trash") + && apiTestCase.getStatus().equalsIgnoreCase("error")) { + apiTestCase.setToBeUpdated(true); + } else { + apiTestCase.setToBeUpdated(false); + } + if (toBeUpdated) { apiTestCase.setToBeUpdateTime(System.currentTimeMillis()); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java index dbd9f82077..da006bcd52 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java @@ -23,6 +23,8 @@ public interface ExtApiDefinitionMapper { List list(@Param("request") ApiDefinitionRequest request); + List apiList(@Param("request") ApiDefinitionRequest request); + List weekList(@Param("request") ApiDefinitionRequest request, @Param("startTimestamp") long startTimestamp); List scenarioList(@Param("apiDefinitionId") String apiDefinitionId); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml index e2c300409a..5c49edb1cf 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml @@ -1116,6 +1116,24 @@ and project_id = #{projectId} and status != 'Trash' + diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java index ce97dc6c6f..1b8180f27c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java @@ -5,6 +5,7 @@ import io.metersphere.api.dto.datacount.response.ExecuteResultCountDTO; import io.metersphere.api.dto.definition.*; import io.metersphere.base.domain.ApiDefinition; import io.metersphere.base.domain.ApiTestCase; +import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -13,6 +14,8 @@ public interface ExtApiTestCaseMapper { List list(@Param("request") ApiTestCaseRequest request); + List caseList(@Param("request") ApiTestCaseRequest request); + List listSimple(@Param("request") ApiTestCaseRequest request); List selectIdsNotExistsInPlan(@Param("projectId") String projectId, @Param("planId") String planId); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml index 031846d2ba..9f7911b58f 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml @@ -946,4 +946,19 @@ AND latest = 1) GROUP BY `status` + diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index 0917b60856..5e2b5fe340 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -521,7 +521,7 @@ export default { this.httpForm.versionId = this.$refs.versionHistory.currentVersion.id; } } - if (hasLicense() && this.httpForm.caseTotal > 0) { + if (hasLicense() && this.httpForm.caseTotal > 0 && !this.httpForm.isCopy) { if (this.apiSyncCaseRequest && this.apiSyncCaseRequest.method) { if (this.httpForm.method !== this.beforeHttpForm.method) {