feat(性能测试): 资源按照项目查询

This commit is contained in:
shiziyuan9527 2020-12-10 18:29:23 +08:00
parent 518898658b
commit 38cf12fbcb
7 changed files with 17 additions and 25 deletions

View File

@ -71,9 +71,7 @@
from load_test_report ltr
join load_test lt on ltr.test_id = lt.id
join user on ltr.user_id = user.id
<if test="reportRequest.workspaceId != null">
JOIN project on project.id = lt.project_id
</if>
join project on project.id = lt.project_id
<where>
<if test="reportRequest.combine != null">
<include refid="combine">
@ -90,6 +88,9 @@
<if test="reportRequest.workspaceId != null">
AND workspace_id = #{reportRequest.workspaceId,jdbcType=VARCHAR}
</if>
<if test="reportRequest.projectId != null">
AND project.id = #{reportRequest.projectId,jdbcType=VARCHAR}
</if>
<if test="reportRequest.filters != null and reportRequest.filters.size() > 0">
<foreach collection="reportRequest.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">

View File

@ -16,4 +16,5 @@ public class ReportRequest {
private List<OrderRequest> orders;
private Map<String, List<String>> filters;
private Map<String, Object> combine;
private String projectId;
}

View File

@ -79,6 +79,7 @@ public class PerformanceTestService {
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
request.setProjectId(SessionUtils.getCurrentProjectId());
return extLoadTestMapper.list(request);
}
@ -320,6 +321,7 @@ public class PerformanceTestService {
orderRequest.setType("desc");
orders.add(orderRequest);
request.setOrders(orders);
request.setProjectId(SessionUtils.getCurrentProjectId());
return extLoadTestMapper.list(request);
}
@ -462,7 +464,11 @@ public class PerformanceTestService {
.collect(Collectors.toList());
if (!resourceIds.isEmpty()) {
LoadTestExample example = new LoadTestExample();
example.createCriteria().andIdIn(resourceIds);
LoadTestExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
}
criteria.andIdIn(resourceIds);
List<LoadTest> loadTests = loadTestMapper.selectByExample(example);
Map<String, String> loadTestMap = loadTests.stream().collect(Collectors.toMap(LoadTest::getId, LoadTest::getName));
scheduleService.build(loadTestMap, schedules);

View File

@ -10,6 +10,7 @@ import io.metersphere.commons.constants.ReportKeys;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.dto.LogDetailDTO;
import io.metersphere.dto.ReportDTO;
@ -59,11 +60,13 @@ public class ReportService {
orderRequest.setType("desc");
orders.add(orderRequest);
request.setOrders(orders);
request.setProjectId(SessionUtils.getCurrentProjectId());
return extLoadTestReportMapper.getReportList(request);
}
public List<ReportDTO> getReportList(ReportRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
request.setProjectId(SessionUtils.getCurrentProjectId());
return extLoadTestReportMapper.getReportList(request);
}

@ -1 +1 @@
Subproject commit bb494fc68a2367359c9048fa7250c7618de4afb6
Subproject commit 905ca8af61ce966d26109e9c5c8c0aee3ca1324e

View File

@ -32,12 +32,8 @@ export default {
options: Object
},
mounted() {
console.log('mounted')
this.init();
},
beforeDestroy() {
console.log('beforeDestroy')
},
data() {
return {
result: {},
@ -55,21 +51,6 @@ export default {
}
}
},
computed: {
// getIndex: function () {
// return function (item) {
// return this.options.index(item);
// }
// },
// getRouter: function () {
// return function (item) {
// if (this.options.router) {
// return this.options.router(item);
// }
// }
// }
},
methods: {
init: function () {
if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) {

@ -1 +1 @@
Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a
Subproject commit 29a8fc09602fde5708af06582ac972d98eb69836