refactor: 修改查询方法

--bug=1009781 --user=刘瑞斌 【接口测试】接口定义和场景列表显示的版本不对 https://www.tapd.cn/55049933/s/1094702
This commit is contained in:
CaptainB 2022-01-19 22:32:05 +08:00 committed by zhangdahai112
parent f3fa4412a5
commit 33600ec03e
6 changed files with 16 additions and 48 deletions

View File

@ -490,14 +490,10 @@
WHERE ref_id = api_definition.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
version_id = (SELECT tmp.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
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
ORDER BY tmp.update_time DESC
LIMIT 1)
)
</if>
@ -754,14 +750,10 @@
WHERE ref_id = api_definition.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
version_id = (SELECT tmp.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
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
ORDER BY tmp.update_time DESC
LIMIT 1)
)
</if>

View File

@ -333,14 +333,10 @@
WHERE ref_id = api_scenario.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
version_id = (SELECT tmp.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
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
ORDER BY tmp.update_time DESC
LIMIT 1)
)
</if>

View File

@ -181,14 +181,10 @@
WHERE ref_id = load_test.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
version_id = (SELECT tmp.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
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
ORDER BY tmp.update_time DESC
LIMIT 1)
)
</if>

View File

@ -142,14 +142,10 @@
WHERE ref_id = test_case.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
version_id = (SELECT tmp.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
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
ORDER BY tmp.update_time DESC
LIMIT 1)
)
</if>
@ -635,14 +631,10 @@
WHERE ref_id = test_case.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
version_id = (SELECT tmp.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
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
ORDER BY tmp.update_time DESC
LIMIT 1)
)
</if>

View File

@ -186,14 +186,10 @@
WHERE ref_id = test_case.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
version_id = (SELECT tmp.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
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
ORDER BY tmp.update_time DESC
LIMIT 1)
)
</if>

View File

@ -182,14 +182,10 @@
WHERE ref_id = test_case.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
version_id = (SELECT tmp.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
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
ORDER BY tmp.update_time DESC
LIMIT 1)
)
</if>