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 { public interface ExtTestPlanLoadCaseMapper {
List<String> selectIdsNotInPlan(@Param("projectId") String projectId, @Param("planId") String planId); 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>
<select id="selectTestPlanLoadCaseList" resultType="io.metersphere.track.dto.TestPlanLoadCaseDTO"> <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, select tplc.id,
lt.status, lt.name as caseName, tplc.load_report_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 from test_plan_load_case tplc
inner join load_test lt on tplc.load_case_id = lt.id inner join load_test lt on tplc.load_case_id = lt.id
inner join user u on lt.user_id = u.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> </select>
</mapper> </mapper>

View File

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

View File

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

View File

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

View File

@ -30,12 +30,11 @@
:label="$t('commons.name')" :label="$t('commons.name')"
show-overflow-tooltip> show-overflow-tooltip>
</el-table-column> </el-table-column>
<!-- <el-table-column--> <el-table-column
<!-- prop="projectName"--> prop="projectName"
<!-- :label="$t('load_test.project_name')"--> :label="$t('load_test.project_name')"
<!-- width="150"--> show-overflow-tooltip>
<!-- show-overflow-tooltip>--> </el-table-column>
<!-- </el-table-column>-->
<el-table-column <el-table-column
prop="userName" prop="userName"
:label="$t('load_test.user_name')" :label="$t('load_test.user_name')"
@ -148,7 +147,7 @@ export default {
} }
}, },
props: { props: {
selectNodeIds: Array, selectProjectId: String,
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default: false default: false
@ -159,7 +158,7 @@ export default {
this.initTable(); this.initTable();
}, },
watch: { watch: {
selectNodeIds() { selectProjectId() {
this.initTable(); this.initTable();
}, },
planId() { planId() {
@ -168,7 +167,12 @@ export default {
}, },
methods: { methods: {
initTable() { 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; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
this.tableData = data.listObject; this.tableData = data.listObject;