fix(测试计划): 报告列表筛选问题

--bug=1040954 --user=宋昌昌 【测试计划】报告-表头字段筛选/搜索框搜索后-全选所有页-批量删除-把所有报告都给删除了 https://www.tapd.cn/55049933/s/1518926
This commit is contained in:
song-cc-rock 2024-05-23 10:48:59 +08:00 committed by Craftsman
parent 9fc4e18c30
commit 12fb7ecd59
2 changed files with 46 additions and 3 deletions

View File

@ -1,6 +1,6 @@
package io.metersphere.plan.dto.request;
import io.metersphere.system.dto.request.TableBatchRequest;
import io.metersphere.system.dto.table.TableBatchProcessDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class TestPlanReportBatchRequest extends TableBatchRequest {
public class TestPlanReportBatchRequest extends TableBatchProcessDTO {
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan.project_id.not_blank}")

View File

@ -13,7 +13,14 @@
<select id="getReportBatchIdsByParam" resultType="java.lang.String">
select tpr.id from test_plan_report tpr
join test_plan tp on tpr.test_plan_id = tp.id
<include refid="queryWhereCondition"/>
where tpr.deleted = 0
<if test="request.projectId != null and request.projectId != ''">
and tpr.project_id = #{request.projectId}
</if>
<if test="request.condition.keyword != null and request.condition.keyword != ''">
and tpr.name like concat('%', #{request.keyword},'%')
</if>
<include refid="filterByCondition"/>
</select>
<select id="selectReportByIds" resultType="io.metersphere.plan.domain.TestPlanReport">
@ -107,6 +114,42 @@
</if>
</sql>
<sql id="filterByCondition">
<if test="request.condition.filter != null and request.condition.filter.size() > 0">
<foreach collection="request.condition.filter.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key=='integrated'">
and tpr.integrated in
<foreach collection="values" item="value" separator="," open="(" close=")">
<choose>
<when test="value == 'true'">1</when>
<when test="value == 'false'">0</when>
<otherwise>0</otherwise>
</choose>
</foreach>
</when>
<!-- 触发方式 -->
<when test="key == 'triggerMode'">
and tpr.trigger_mode in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<!-- 执行状态 -->
<when test="key == 'execStatus'">
and tpr.exec_status in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<!-- 执行结果 -->
<when test="key == 'resultStatus'">
and tpr.result_status in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
</choose>
</if>
</foreach>
</if>
</sql>
<sql id="combine">
<if test="request.combine != null">
and (