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 d15a563381..145b0d00ba 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 @@ -490,10 +490,14 @@ WHERE ref_id = api_definition.ref_id LIMIT 1) OR - version_id = (SELECT tmp.version_id + version_id = (SELECT project_version.id FROM api_definition tmp + JOIN project_version ON tmp.project_id = project_version.project_id AND + tmp.version_id = project_version.id WHERE ref_id = api_definition.ref_id - ORDER BY tmp.update_time DESC + GROUP BY ref_id + HAVING MAX(latest) = 0 + ORDER BY MAX(tmp.update_time) DESC LIMIT 1) ) @@ -750,10 +754,14 @@ WHERE ref_id = api_definition.ref_id LIMIT 1) OR - version_id = (SELECT tmp.version_id + version_id = (SELECT project_version.id FROM api_definition tmp + JOIN project_version ON tmp.project_id = project_version.project_id AND + tmp.version_id = project_version.id WHERE ref_id = api_definition.ref_id - ORDER BY tmp.update_time DESC + GROUP BY ref_id + HAVING MAX(latest) = 0 + ORDER BY MAX(tmp.update_time) DESC LIMIT 1) ) 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 fab32aeb88..13f025215d 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 @@ -333,10 +333,14 @@ WHERE ref_id = api_scenario.ref_id LIMIT 1) OR - version_id = (SELECT tmp.version_id + version_id = (SELECT project_version.id FROM api_scenario tmp + JOIN project_version ON tmp.project_id = project_version.project_id AND + tmp.version_id = project_version.id WHERE ref_id = api_scenario.ref_id - ORDER BY tmp.update_time DESC + GROUP BY ref_id + HAVING MAX(latest) = 0 + ORDER BY MAX(tmp.update_time) DESC LIMIT 1) ) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml index 6024d115c3..5f9a163b00 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml @@ -181,10 +181,14 @@ WHERE ref_id = load_test.ref_id LIMIT 1) OR - version_id = (SELECT tmp.version_id + version_id = (SELECT project_version.id FROM load_test tmp + JOIN project_version ON tmp.project_id = project_version.project_id AND + tmp.version_id = project_version.id WHERE ref_id = load_test.ref_id - ORDER BY tmp.update_time DESC + GROUP BY ref_id + HAVING MAX(latest) = 0 + ORDER BY MAX(tmp.update_time) DESC LIMIT 1) ) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 1510dd46c2..68e8d81b0c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -142,10 +142,14 @@ WHERE ref_id = test_case.ref_id LIMIT 1) OR - version_id = (SELECT tmp.version_id + version_id = (SELECT project_version.id FROM test_case tmp + JOIN project_version ON tmp.project_id = project_version.project_id AND + tmp.version_id = project_version.id WHERE ref_id = test_case.ref_id - ORDER BY tmp.update_time DESC + GROUP BY ref_id + HAVING MAX(latest) = 0 + ORDER BY MAX(tmp.update_time) DESC LIMIT 1) ) @@ -631,10 +635,14 @@ WHERE ref_id = test_case.ref_id LIMIT 1) OR - version_id = (SELECT tmp.version_id + version_id = (SELECT project_version.id FROM test_case tmp + JOIN project_version ON tmp.project_id = project_version.project_id AND + tmp.version_id = project_version.id WHERE ref_id = test_case.ref_id - ORDER BY tmp.update_time DESC + GROUP BY ref_id + HAVING MAX(latest) = 0 + ORDER BY MAX(tmp.update_time) DESC LIMIT 1) ) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml index 5a08ebc97f..4951c54d6c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml @@ -186,10 +186,14 @@ WHERE ref_id = test_case.ref_id LIMIT 1) OR - version_id = (SELECT tmp.version_id + version_id = (SELECT project_version.id FROM test_case tmp + JOIN project_version ON tmp.project_id = project_version.project_id AND + tmp.version_id = project_version.id WHERE ref_id = test_case.ref_id - ORDER BY tmp.update_time DESC + GROUP BY ref_id + HAVING MAX(latest) = 0 + ORDER BY MAX(tmp.update_time) DESC LIMIT 1) ) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml index 87012c28f9..3fe01dea79 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml @@ -182,10 +182,14 @@ WHERE ref_id = test_case.ref_id LIMIT 1) OR - version_id = (SELECT tmp.version_id + version_id = (SELECT project_version.id FROM test_case tmp + JOIN project_version ON tmp.project_id = project_version.project_id AND + tmp.version_id = project_version.id WHERE ref_id = test_case.ref_id - ORDER BY tmp.update_time DESC + GROUP BY ref_id + HAVING MAX(latest) = 0 + ORDER BY MAX(tmp.update_time) DESC LIMIT 1) )