refactor(测试计划): 性能测试用例按照项目查询

This commit is contained in:
shiziyuan9527 2021-01-07 18:57:12 +08:00
parent 73f09844bb
commit a2856898d6
6 changed files with 38 additions and 17 deletions

View File

@ -8,5 +8,5 @@ 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);
List<TestPlanLoadCaseDTO> selectTestPlanLoadCaseList(@Param("planId") String planId, @Param("projectId") String projectId);
}

View File

@ -11,11 +11,25 @@
)
</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.name as caseName, tplc.load_report_id
select tplc.id,
u.name as userName,
tplc.create_time,
tplc.update_time,
tplc.test_plan_id,
tplc.load_case_id,
lt.status,
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
where tplc.test_plan_id = #{planId}
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>
</select>
</mapper>

View File

@ -9,4 +9,5 @@ import lombok.Setter;
public class TestPlanLoadCaseDTO extends TestPlanLoadCase {
private String userName;
private String caseName;
private String projectName;
}

View File

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

View File

@ -12,7 +12,7 @@
class="table-list"
@refresh="refresh"
:plan-id="planId"
:select-node-ids="selectNodeIds"
:select-project-id="selectProjectId"
:select-parent-nodes="selectParentNodes"
@relevanceCase="openTestCaseRelevanceDialog"
ref="testPlanLoadCaseList"/>
@ -46,6 +46,7 @@ export default {
result: {},
selectNodeIds: [],
selectParentNodes: [],
selectProjectId: "",
treeNodes: [],
}
},
@ -74,8 +75,7 @@ export default {
this.$refs.testCaseLoadRelevance.open();
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes;
this.selectProjectId = node.key;
// node
this.$refs.testPlanLoadCaseList.currentPage = 1;
this.$refs.testPlanLoadCaseList.pageSize = 10;
@ -84,6 +84,8 @@ export default {
if (this.planId) {
this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
this.treeNodes = response.data;
//
this.treeNodes.map(node => node.children = null);
});
}
},

View File

@ -30,12 +30,11 @@
:label="$t('commons.name')"
show-overflow-tooltip>
</el-table-column>
<!-- <el-table-column-->
<!-- prop="projectName"-->
<!-- :label="$t('load_test.project_name')"-->
<!-- width="150"-->
<!-- show-overflow-tooltip>-->
<!-- </el-table-column>-->
<el-table-column
prop="projectName"
:label="$t('load_test.project_name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="userName"
:label="$t('load_test.user_name')"
@ -148,7 +147,7 @@ export default {
}
},
props: {
selectNodeIds: Array,
selectProjectId: String,
isReadOnly: {
type: Boolean,
default: false
@ -159,7 +158,7 @@ export default {
this.initTable();
},
watch: {
selectNodeIds() {
selectProjectId() {
this.initTable();
},
planId() {
@ -168,7 +167,12 @@ export default {
},
methods: {
initTable() {
this.$post("/test/plan/load/case/list/" + this.currentPage + "/" + this.pageSize, {testPlanId: this.planId}, response => {
let param = {};
param.testPlanId = this.planId;
if (this.selectProjectId && this.selectProjectId !== 'root') {
param.projectId = this.selectProjectId;
}
this.$post("/test/plan/load/case/list/" + this.currentPage + "/" + this.pageSize, param, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;