diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.java index a98299faa0..6e54df5e65 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.java @@ -35,4 +35,8 @@ public interface ExtTestPlanLoadCaseMapper { Long getPreOrder(@Param("planId")String planId, @Param("baseOrder") Long baseOrder); Long getLastOrder(@Param("planId")String planId, @Param("baseOrder") Long baseOrder); + + List selectIdByLoadCaseReportIdAndStatusIsRun(String reportId); + + void updateStatusNullById(String id); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.xml index 35e5669615..8f9de05c12 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.xml @@ -312,4 +312,13 @@ order by `order` desc limit 1; + + + update test_plan_load_case tplc + set status = null + where id = #{0} + diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceReportService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceReportService.java index 42831631bf..7c43e7e5ca 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceReportService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceReportService.java @@ -9,6 +9,7 @@ import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper; import io.metersphere.commons.constants.PerformanceTestStatus; import io.metersphere.commons.constants.ReportKeys; import io.metersphere.commons.exception.MSException; +import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.controller.request.OrderRequest; @@ -28,6 +29,7 @@ import io.metersphere.performance.engine.Engine; import io.metersphere.performance.engine.EngineFactory; import io.metersphere.service.FileService; import io.metersphere.service.TestResourceService; +import io.metersphere.track.service.TestPlanLoadCaseService; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.session.SqlSession; @@ -145,6 +147,9 @@ public class PerformanceReportService { // delete jtl file fileService.deleteFileById(loadTestReport.getFileId()); + //check test_plan_load_case 的 status + TestPlanLoadCaseService testPlanLoadCaseService = CommonBeanFactory.getBean(TestPlanLoadCaseService.class); + testPlanLoadCaseService.checkStatusByDeleteLoadCaseReportId(reportId); loadTestReportMapper.deleteByPrimaryKey(reportId); } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java index 82cb9b9e80..b7dc853b11 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java @@ -418,4 +418,12 @@ public class TestPlanLoadCaseService { testPlanLoadCaseMapper::updateByPrimaryKeySelective); } + public void checkStatusByDeleteLoadCaseReportId(String reportId) { + List updatedId = extTestPlanLoadCaseMapper.selectIdByLoadCaseReportIdAndStatusIsRun(reportId); + if(CollectionUtils.isNotEmpty(updatedId)){ + for (String id : updatedId) { + extTestPlanLoadCaseMapper.updateStatusNullById(id); + } + } + } } diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue index 5821c88772..36d6a2247f 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue @@ -172,7 +172,9 @@ export default { this.basisData.backScript = JSON.stringify(this.request.backScript); } }else{ - this.$refs.tcpFormatParameter.validateXmlDataStruct(); + if(this.$refs.tcpFormatParameter){ + this.$refs.tcpFormatParameter.validateXmlDataStruct(); + } } this.$emit('saveApi', this.basisData); } @@ -200,7 +202,9 @@ export default { this.basisData.backScript = JSON.stringify(this.request.backScript); } }else{ - this.$refs.tcpFormatParameter.validateXmlDataStruct(); + if(this.$refs.tcpFormatParameter){ + this.$refs.tcpFormatParameter.validateXmlDataStruct(); + } } this.$emit('runTest', this.basisData); } diff --git a/frontend/src/business/components/api/definition/components/request/tcp/TcpFormatParameters.vue b/frontend/src/business/components/api/definition/components/request/tcp/TcpFormatParameters.vue index d21351acc9..26113a4294 100644 --- a/frontend/src/business/components/api/definition/components/request/tcp/TcpFormatParameters.vue +++ b/frontend/src/business/components/api/definition/components/request/tcp/TcpFormatParameters.vue @@ -405,19 +405,21 @@ }, checkXmlTableDataStructData(dataStruct){ let allCheckResult = true; - if(dataStruct && dataStruct.length > 0){ - for(let i = 0;i 0){ - allCheckResult = this.checkXmlTableDataStructData(row.children); - if(!allCheckResult){ - return false; + if(this.$refs.treeTable){ + if(dataStruct && dataStruct.length > 0){ + for(let i = 0;i 0){ + allCheckResult = this.checkXmlTableDataStructData(row.children); + if(!allCheckResult){ + return false; + } } + }else{ + return false; } - }else{ - return false; } } } diff --git a/frontend/src/business/components/api/definition/components/request/tcp/TcpParams.vue b/frontend/src/business/components/api/definition/components/request/tcp/TcpParams.vue index c62a65736f..d91c5fa296 100644 --- a/frontend/src/business/components/api/definition/components/request/tcp/TcpParams.vue +++ b/frontend/src/business/components/api/definition/components/request/tcp/TcpParams.vue @@ -169,19 +169,21 @@ export default { }, checkXmlTableDataStructData(dataStruct){ let allCheckResult = true; - if(dataStruct && dataStruct.length > 0){ - for(let i = 0;i 0){ - allCheckResult = this.checkXmlTableDataStructData(row.children); - if(!allCheckResult){ - return false; + if(this.$refs.treeTable){ + if(dataStruct && dataStruct.length > 0){ + for(let i = 0;i 0){ + allCheckResult = this.checkXmlTableDataStructData(row.children); + if(!allCheckResult){ + return false; + } } + }else{ + return false; } - }else{ - return false; } } }