fix(项目报告): 修复项目报告查询数据不正确的问题

--bug=1018507 --user=宋天阳 【报表统计】统计图表与实际不符
https://www.tapd.cn/55049933/s/1269708
This commit is contained in:
song-tianyang 2022-10-20 15:55:02 +08:00 committed by 建国
parent f0f1b5790a
commit 53aa0fe219
4 changed files with 59 additions and 1 deletions

View File

@ -867,6 +867,7 @@
<where>
project_id = #{projectId}
AND `status` != 'Trash'
AND latest = 1
<if test="startTime > 0">
AND (create_time &gt;= #{startTime})
</if>

View File

@ -1164,4 +1164,60 @@
</if>
</where>
</select>
<select id="countByRequest" resultType="io.metersphere.api.dto.ApiCountChartResult">
select
<if test="testCaseGroupColumn != null and testCaseGroupColumn != ''">
${apiCaseGroupColumn} AS groupName,
</if>
count(id) AS countNum
FROM api_test_case
<where>
project_id = #{projectId}
AND( `status` != 'Trash' OR `status` IS NULL)
AND api_definition_id IN (SELECT id FROM api_definition WHERE `status` != 'Trash' AND latest = 1)
<if test="startTime > 0">
AND (create_time &gt;= #{startTime})
</if>
<if test="endTime > 0">
AND ( create_time &lt;= #{endTime})
</if>
<if test="apiFilterSearchList != null and apiFilterSearchList.size() > 0">
AND
<trim prefix="(" prefixOverrides="AND|OR" suffix=")">
<foreach collection="apiFilterSearchList.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key=='caselevel'">
${filterType} priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='creator'">
${filterType} create_user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='casestatus'">
${filterType}
(UPPER(status) in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
<if test="values.contains('RUNNING')">
OR status IS NULL
</if>
)
</when>
</choose>
</if>
</foreach>
</trim>
</if>
</where>
<if test="testCaseGroupColumn != null and testCaseGroupColumn != ''">
GROUP BY ${apiCaseGroupColumn}
</if>
</select>
</mapper>

View File

@ -495,7 +495,7 @@
count(id) AS countNum
FROM load_test
<where>
project_id = #{projectId}
project_id = #{projectId} AND latest = 1
<if test="startTime > 0">
AND (create_time &gt;= #{startTime})
</if>

View File

@ -12,6 +12,7 @@
<where>
project_id = #{projectId}
AND `status` != 'Trash'
AND latest = 1
<if test="startTime > 0">
AND create_time &gt;= #{startTime}
</if>