fix(工作台):修复工作台我的待办中功能用例统计有误问题

--bug=1024013 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001024013
This commit is contained in:
guoyuqi 2023-03-17 20:07:13 +08:00 committed by 刘瑞斌
parent 4bbcc9bf2e
commit 281d52b821
2 changed files with 41 additions and 34 deletions

View File

@ -422,7 +422,8 @@
from test_case from test_case
left join (select id,workspace_id,NAME from project where workspace_id =#{request.workspaceId}) left join (select id,workspace_id,NAME from project where workspace_id =#{request.workspaceId})
project on test_case.project_id = project.id project on test_case.project_id = project.id
where test_case.STATUS != 'Trash' and test_case.case_public = true GROUP BY ref_id) where test_case.case_public = true and (test_case.status != 'Trash' or test_case.status is null) GROUP BY
ref_id)
tmp on test_case.update_time = tmp.update_time and test_case.ref_id = tmp.ref_id tmp on test_case.update_time = tmp.update_time and test_case.ref_id = tmp.ref_id
<where> <where>
<if test="request.combine != null"> <if test="request.combine != null">
@ -555,8 +556,10 @@
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.filterInWrapper"/> <include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.filterInWrapper"/>
</when> </when>
<when test="key=='last_execute_result'"> <when test="key=='last_execute_result'">
and test_case.last_execute_result in and (test_case.last_execute_result in
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.filterInWrapper"/> <include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.filterInWrapper"/>
or test_case.last_execute_result is null)
</when> </when>
<when test="key=='status'"> <when test="key=='status'">
and test_case.status in and test_case.status in
@ -601,12 +604,12 @@
</choose> </choose>
</if> </if>
<if test="key=='status' and (values == null || values.size() == 0)"> <if test="key=='status' and (values == null || values.size() == 0)">
and test_case.status != 'Trash' and (test_case.status != 'Trash' or test_case.status is null)
</if> </if>
</foreach> </foreach>
</if> </if>
<if test="request.filters == null || request.filters.size() == 0 || !request.filters.containsKey('status')"> <if test="request.filters == null || request.filters.size() == 0 || !request.filters.containsKey('status')">
and test_case.status != 'Trash' and (test_case.status != 'Trash' or test_case.status is null)
</if> </if>
</sql> </sql>
@ -806,7 +809,7 @@
SELECT test_case.priority as groupField, count(id) AS countNumber SELECT test_case.priority as groupField, count(id) AS countNumber
FROM test_case FROM test_case
WHERE project_id = #{projectId} WHERE project_id = #{projectId}
AND test_case.status != 'Trash' and (test_case.status != 'Trash' or test_case.status is null)
and latest = true and latest = true
GROUP BY test_case.priority GROUP BY test_case.priority
</select> </select>
@ -815,15 +818,17 @@
SELECT count(DISTINCT ref_id) AS countNumber SELECT count(DISTINCT ref_id) AS countNumber
FROM test_case FROM test_case
WHERE test_case.project_id = #{projectId} WHERE test_case.project_id = #{projectId}
and test_case.status != 'Trash' and latest = 1 and (test_case.status != 'Trash' or test_case.status is null)
and latest = 1
AND create_time BETWEEN #{firstDayTimestamp} AND create_time BETWEEN #{firstDayTimestamp}
AND #{lastDayTimestamp} AND #{lastDayTimestamp}
</select> </select>
<select id="countStatus" resultType="io.metersphere.dto.TrackCountResult"> <select id="countStatus" resultType="io.metersphere.dto.TrackCountResult">
SELECT review_status AS groupField, count(id) AS countNumber SELECT review_status AS groupField, count(id) AS countNumber
FROM test_case FROM test_case
WHERE project_id = #{projectId} WHERE project_id = #{projectId}
and test_case.status != 'Trash' and latest = 1 and (test_case.status != 'Trash' or test_case.status is null)
and latest = 1
GROUP BY test_case.review_status GROUP BY test_case.review_status
</select> </select>
@ -853,39 +858,41 @@
and test_id IN (select id FROM ui_scenario WHERE `STATUS` != 'Trash') and test_id IN (select id FROM ui_scenario WHERE `STATUS` != 'Trash')
</if> </if>
) )
test_case_test test_case_test
ON test_case.id = test_case_test.test_case_id ON test_case.id = test_case_test.test_case_id
WHERE WHERE
test_case.project_id = #{projectId} test_case.project_id = #{projectId}
AND test_case.STATUS != 'Trash' and (test_case.status != 'Trash' or test_case.status is null)
AND latest = 1 AND latest = 1
GROUP BY GROUP BY
test_case_test.test_type test_case_test.test_type
</select> </select>
<select id="countRelevanceCreatedThisWeek" resultType="java.lang.Long"> <select id="countRelevanceCreatedThisWeek" resultType="java.lang.Long">
SELECT count(distinct test_case.ref_id) AS countNumber SELECT count(distinct test_case.ref_id) AS countNumber
FROM test_case FROM test_case
join test_case_test on test_case.id = test_case_test.test_case_id join test_case_test on test_case.id = test_case_test.test_case_id
WHERE test_case.project_id = #{projectId} WHERE test_case.project_id = #{projectId}
and test_case.status != 'Trash' and latest = 1 and (test_case.status != 'Trash' or test_case.status is null)
AND test_case_test.create_time BETWEEN #{firstDayTimestamp} and latest = 1
AND #{lastDayTimestamp} AND test_case_test.create_time BETWEEN #{firstDayTimestamp}
AND #{lastDayTimestamp}
</select> </select>
<select id="countCoverage" resultType="int"> <select id="countCoverage" resultType="int">
select count(test_case.id) select count(test_case.id)
from test_case from test_case
where test_case.project_id = #{projectId} where test_case.project_id = #{projectId}
and test_case.status != 'Trash' and latest = 1 and (test_case.status != 'Trash' or test_case.status is null) and latest = 1
and test_case.id in ( and test_case.id in (
SELECT test_case_id FROM test_case_test WHERE test_type = 'testCase' and test_id IN (select id FROM SELECT test_case_id FROM test_case_test WHERE test_type = 'testCase' and test_id IN (select id FROM
api_test_case WHERE `STATUS` is null or status != 'Trash') api_test_case WHERE `STATUS` is null or status != 'Trash')
UNION UNION
SELECT test_case_id FROM test_case_test WHERE test_type = 'performance' and test_id IN (select id from load_test) SELECT test_case_id FROM test_case_test WHERE test_type = 'performance' and test_id IN (select id from
UNION load_test)
SELECT test_case_id FROM test_case_test WHERE test_type = 'automation' and test_id IN (select id FROM UNION
api_scenario WHERE `STATUS` != 'Trash') SELECT test_case_id FROM test_case_test WHERE test_type = 'automation' and test_id IN (select id FROM
<if test="queryUi"> api_scenario WHERE `STATUS` != 'Trash')
<if test="queryUi">
UNION UNION
SELECT test_case_id FROM test_case_test WHERE test_type = 'uiAutomation' and test_id IN (select id FROM SELECT test_case_id FROM test_case_test WHERE test_type = 'uiAutomation' and test_id IN (select id FROM
ui_scenario WHERE `STATUS` != 'Trash') ui_scenario WHERE `STATUS` != 'Trash')
@ -1009,7 +1016,7 @@
<foreach collection="ids" item="id" separator="," open="(" close=")"> <foreach collection="ids" item="id" separator="," open="(" close=")">
#{id} #{id}
</foreach> </foreach>
and test_case.status != 'Trash' and (test_case.status != 'Trash' or test_case.status is null)
</where> </where>
</select> </select>
<select id="selectRelateIdsByQuery" resultType="java.lang.String"> <select id="selectRelateIdsByQuery" resultType="java.lang.String">
@ -1100,7 +1107,7 @@
<foreach collection="ids" item="id" separator="," open="(" close=")"> <foreach collection="ids" item="id" separator="," open="(" close=")">
#{id} #{id}
</foreach> </foreach>
and test_case.status != 'Trash'; and (test_case.status != 'Trash' or test_case.status is null);
</select> </select>
<select id="countByIds" resultType="java.lang.Integer"> <select id="countByIds" resultType="java.lang.Integer">
select count(id) select count(id)
@ -1109,7 +1116,7 @@
<foreach collection="ids" item="id" separator="," open="(" close=")"> <foreach collection="ids" item="id" separator="," open="(" close=")">
#{id} #{id}
</foreach> </foreach>
and test_case.status != 'Trash'; and (test_case.status != 'Trash' or test_case.status is null);
</select> </select>
<update id="deleteToGc"> <update id="deleteToGc">
@ -1185,7 +1192,7 @@
from project from project
where workspace_id = #{workSpaceId}) where workspace_id = #{workSpaceId})
and case_public = true and case_public = true
and test_case.status != 'Trash' and (test_case.status != 'Trash' or test_case.status is null)
</select> </select>
<select id="trashCount" resultType="java.lang.Long"> <select id="trashCount" resultType="java.lang.Long">

View File

@ -371,9 +371,9 @@ export default {
} }
} else { } else {
if (this.condition.filters) { if (this.condition.filters) {
this.condition.filters.reviewStatus = ["Prepare", "Pass", "UnPass"]; this.condition.filters.review_status = ["Prepare", "Pass", "UnPass"];
} else { } else {
this.condition.filters = {reviewStatus: ["Prepare", "Pass", "UnPass"]}; this.condition.filters = {review_status: ["Prepare", "Pass", "UnPass"]};
} }
} }
@ -390,9 +390,9 @@ export default {
activated() { activated() {
this.getTemplateField(); this.getTemplateField();
if (this.condition.filters) { if (this.condition.filters) {
this.condition.filters.reviewStatus = ["Prepare", "Pass", "UnPass"]; this.condition.filters.review_status = ["Prepare", "Pass", "UnPass"];
} else { } else {
this.condition.filters = {reviewStatus: ["Prepare", "Pass", "UnPass"]}; this.condition.filters = {review_status: ["Prepare", "Pass", "UnPass"]};
} }
let ids = this.$route.params.ids; let ids = this.$route.params.ids;
if (ids) { if (ids) {
@ -594,7 +594,7 @@ export default {
this.condition.selectThisWeedData = false; this.condition.selectThisWeedData = false;
this.condition.selectThisWeedRelevanceData = false; this.condition.selectThisWeedRelevanceData = false;
this.condition.caseCoverage = null; this.condition.caseCoverage = null;
this.condition.filters.reviewStatus = ["Prepare", "Pass", "UnPass"]; this.condition.filters.review_status = ["Prepare", "Pass", "UnPass"];
switch (this.selectDataRange) { switch (this.selectDataRange) {
case 'thisWeekCount': case 'thisWeekCount':
this.condition.selectThisWeedData = true; this.condition.selectThisWeedData = true;