feat(测试计划): 性能测试用例按照名称或ID查询

This commit is contained in:
shiziyuan9527 2021-01-19 16:30:47 +08:00
parent f666b140bb
commit 086a1e50bb
5 changed files with 33 additions and 27 deletions

View File

@ -1,6 +1,7 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.track.dto.TestPlanLoadCaseDTO;
import io.metersphere.track.request.testplan.LoadCaseRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -8,6 +9,6 @@ import java.util.List;
public interface ExtTestPlanLoadCaseMapper {
List<String> selectIdsNotInPlan(@Param("projectId") String projectId, @Param("planId") String planId);
List<TestPlanLoadCaseDTO> selectTestPlanLoadCaseList(@Param("planId") String planId, @Param("projectId") String projectId);
List<TestPlanLoadCaseDTO> selectTestPlanLoadCaseList(@Param("request") LoadCaseRequest request);
void updateCaseStatus(@Param("reportId") String reportId, @Param("status") String status);
}

View File

@ -2,7 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtTestPlanLoadCaseMapper">
<update id="updateCaseStatus">
update test_plan_load_case tplc set status = #{status} where tplc.load_report_id = #{reportId}
update test_plan_load_case tplc
set status = #{status}
where tplc.load_report_id = #{reportId}
</update>
<select id="selectIdsNotInPlan" resultType="java.lang.String">
@ -15,26 +17,29 @@
</select>
<select id="selectTestPlanLoadCaseList" resultType="io.metersphere.track.dto.TestPlanLoadCaseDTO">
select tplc.id,
u.name as userName,
tplc.create_time,
tplc.update_time,
tplc.test_plan_id,
tplc.load_case_id,
lt.status,
lt.num,
tplc.status as caseStatus,
lt.name as caseName,
tplc.load_report_id,
p.name as projectName
u.name as userName,
tplc.create_time,
tplc.update_time,
tplc.test_plan_id,
tplc.load_case_id,
lt.status,
lt.num,
tplc.status as caseStatus,
lt.name as caseName,
tplc.load_report_id,
p.name as projectName
from test_plan_load_case tplc
inner join load_test lt on tplc.load_case_id = lt.id
inner join user u on lt.user_id = u.id
inner join project p on lt.project_id = p.id
<where>
tplc.test_plan_id = #{planId}
<if test="projectId != null and projectId != ''">
and lt.project_id = #{projectId}
</if>
</where>
inner join load_test lt on tplc.load_case_id = lt.id
inner join user u on lt.user_id = u.id
inner join project p on lt.project_id = p.id
<where>
tplc.test_plan_id = #{request.testPlanId}
<if test="request.projectId != null and request.projectId != ''">
and lt.project_id = #{request.projectId}
</if>
<if test="request.name != null">
and (lt.name like CONCAT('%', #{request.name},'%') or lt.num like CONCAT('%', #{request.name},'%'))
</if>
</where>
</select>
</mapper>

View File

@ -11,4 +11,5 @@ import java.util.List;
public class LoadCaseRequest extends TestPlanLoadCase {
private String projectId;
private List<String> caseIds;
private String name;
}

View File

@ -50,7 +50,7 @@ public class TestPlanLoadCaseService {
}
public List<TestPlanLoadCaseDTO> list(LoadCaseRequest request) {
return extTestPlanLoadCaseMapper.selectTestPlanLoadCaseList(request.getTestPlanId(), request.getProjectId());
return extTestPlanLoadCaseMapper.selectTestPlanLoadCaseList(request);
}
public void relevanceCase(LoadCaseRequest request) {

View File

@ -186,12 +186,11 @@ export default {
initTable() {
console.log('init')
this.selectRows = new Set();
let param = {};
param.testPlanId = this.planId;
this.condition.testPlanId = this.planId;
if (this.selectProjectId && this.selectProjectId !== 'root') {
param.projectId = this.selectProjectId;
this.condition.projectId = this.selectProjectId;
}
this.$post("/test/plan/load/case/list/" + this.currentPage + "/" + this.pageSize, param, response => {
this.$post("/test/plan/load/case/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
let data = response.data;
let {itemCount, listObject} = data;
this.total = itemCount;