refactor: 修改查询方法

This commit is contained in:
CaptainB 2022-01-20 11:17:56 +08:00 committed by xiaomeinvG
parent 2105d16cba
commit 4118ad2bfb
6 changed files with 48 additions and 16 deletions

View File

@ -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)
)
</if>
@ -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)
)
</if>

View File

@ -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)
)
</if>

View File

@ -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)
)
</if>

View File

@ -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)
)
</if>
@ -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)
)
</if>

View File

@ -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)
)
</if>

View File

@ -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)
)
</if>