refactor: 修改查询方法
This commit is contained in:
parent
92f449cf5c
commit
fb2e4e70b3
|
@ -495,12 +495,19 @@
|
|||
OR
|
||||
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
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(tmp.update_time) DESC
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id AND NOT EXISTS(SELECT ref_id
|
||||
FROM api_definition tmp2
|
||||
JOIN project_version
|
||||
ON tmp2.project_id =
|
||||
project_version.project_id AND
|
||||
version_id =
|
||||
project_version.id AND
|
||||
latest = TRUE
|
||||
WHERE tmp.ref_id = tmp2.ref_id)
|
||||
WHERE tmp.ref_id = api_definition.ref_id
|
||||
ORDER BY tmp.update_time DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
|
@ -758,14 +765,21 @@
|
|||
LIMIT 1)
|
||||
OR
|
||||
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
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(tmp.update_time) DESC
|
||||
LIMIT 1)
|
||||
FROM api_definition tmp
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id AND NOT EXISTS(SELECT ref_id
|
||||
FROM api_definition tmp2
|
||||
JOIN project_version
|
||||
ON tmp2.project_id =
|
||||
project_version.project_id AND
|
||||
version_id =
|
||||
project_version.id AND
|
||||
latest = TRUE
|
||||
WHERE tmp.ref_id = tmp2.ref_id)
|
||||
WHERE tmp.ref_id = api_definition.ref_id
|
||||
ORDER BY tmp.update_time DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
|
|
|
@ -335,12 +335,19 @@
|
|||
OR
|
||||
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
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(tmp.update_time) DESC
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id AND NOT EXISTS(SELECT ref_id
|
||||
FROM api_scenario tmp2
|
||||
JOIN project_version
|
||||
ON tmp2.project_id =
|
||||
project_version.project_id AND
|
||||
version_id =
|
||||
project_version.id AND
|
||||
latest = TRUE
|
||||
WHERE tmp.ref_id = tmp2.ref_id)
|
||||
WHERE tmp.ref_id = api_scenario.ref_id
|
||||
ORDER BY tmp.update_time DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
|
|
|
@ -183,12 +183,19 @@
|
|||
OR
|
||||
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
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(tmp.update_time) DESC
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id AND NOT EXISTS(SELECT ref_id
|
||||
FROM load_test tmp2
|
||||
JOIN project_version
|
||||
ON tmp2.project_id =
|
||||
project_version.project_id AND
|
||||
version_id =
|
||||
project_version.id AND
|
||||
latest = TRUE
|
||||
WHERE tmp.ref_id = tmp2.ref_id)
|
||||
WHERE tmp.ref_id = load_test.ref_id
|
||||
ORDER BY tmp.update_time DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
|
|
|
@ -144,12 +144,19 @@
|
|||
OR
|
||||
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
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(tmp.update_time) DESC
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id AND NOT EXISTS(SELECT ref_id
|
||||
FROM test_case tmp2
|
||||
JOIN project_version
|
||||
ON tmp2.project_id =
|
||||
project_version.project_id AND
|
||||
version_id =
|
||||
project_version.id AND
|
||||
latest = TRUE
|
||||
WHERE tmp.ref_id = tmp2.ref_id)
|
||||
WHERE tmp.ref_id = test_case.ref_id
|
||||
ORDER BY tmp.update_time DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
|
@ -637,12 +644,19 @@
|
|||
OR
|
||||
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
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(tmp.update_time) DESC
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id AND NOT EXISTS(SELECT ref_id
|
||||
FROM test_case tmp2
|
||||
JOIN project_version
|
||||
ON tmp2.project_id =
|
||||
project_version.project_id AND
|
||||
version_id =
|
||||
project_version.id AND
|
||||
latest = TRUE
|
||||
WHERE tmp.ref_id = tmp2.ref_id)
|
||||
WHERE tmp.ref_id = test_case.ref_id
|
||||
ORDER BY tmp.update_time DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
|
|
|
@ -188,12 +188,19 @@
|
|||
OR
|
||||
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
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(tmp.update_time) DESC
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id AND NOT EXISTS(SELECT ref_id
|
||||
FROM test_case tmp2
|
||||
JOIN project_version
|
||||
ON tmp2.project_id =
|
||||
project_version.project_id AND
|
||||
version_id =
|
||||
project_version.id AND
|
||||
latest = TRUE
|
||||
WHERE tmp.ref_id = tmp2.ref_id)
|
||||
WHERE tmp.ref_id = test_case.ref_id
|
||||
ORDER BY tmp.update_time DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
|
|
|
@ -184,12 +184,19 @@
|
|||
OR
|
||||
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
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(tmp.update_time) DESC
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id AND NOT EXISTS(SELECT ref_id
|
||||
FROM test_case tmp2
|
||||
JOIN project_version
|
||||
ON tmp2.project_id =
|
||||
project_version.project_id AND
|
||||
version_id =
|
||||
project_version.id AND
|
||||
latest = TRUE
|
||||
WHERE tmp.ref_id = tmp2.ref_id)
|
||||
WHERE tmp.ref_id = test_case.ref_id
|
||||
ORDER BY tmp.update_time DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
|
|
Loading…
Reference in New Issue