mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-01 03:28:59 +08:00
fix(测试计划): 测试计划组查询
This commit is contained in:
parent
8e9bf6fc0d
commit
22ba5f9f90
@ -54,6 +54,15 @@ public class TestPlanController {
|
||||
return testPlanManagementService.page(request);
|
||||
}
|
||||
|
||||
@GetMapping("/group-list/{projectId}")
|
||||
@Operation(summary = "测试计划-测试计划组查询")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ)
|
||||
@CheckOwner(resourceId = "#projectId", resourceType = "project")
|
||||
public List<TestPlan> groupList(@PathVariable String projectId) {
|
||||
testPlanManagementService.checkModuleIsOpen(projectId, TestPlanResourceConfig.CHECK_TYPE_PROJECT, Collections.singletonList(TestPlanResourceConfig.CONFIG_TEST_PLAN));
|
||||
return testPlanManagementService.groupList(projectId);
|
||||
}
|
||||
|
||||
@GetMapping("/list-in-group/{groupId}")
|
||||
@Operation(summary = "测试计划-表格分页查询")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ)
|
||||
|
@ -3,10 +3,13 @@ package io.metersphere.plan.service;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.plan.constants.TestPlanResourceConfig;
|
||||
import io.metersphere.plan.domain.TestPlan;
|
||||
import io.metersphere.plan.domain.TestPlanExample;
|
||||
import io.metersphere.plan.dto.request.TestPlanTableRequest;
|
||||
import io.metersphere.plan.dto.response.TestPlanResponse;
|
||||
import io.metersphere.plan.mapper.ExtTestPlanMapper;
|
||||
import io.metersphere.plan.mapper.ExtTestPlanModuleMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.project.dto.ModuleCountDTO;
|
||||
import io.metersphere.project.mapper.ProjectMapper;
|
||||
@ -41,6 +44,8 @@ public class TestPlanManagementService {
|
||||
private TestPlanModuleService testPlanModuleService;
|
||||
@Resource
|
||||
private TestPlanStatisticsService testPlanStatisticsService;
|
||||
@Resource
|
||||
private TestPlanMapper testPlanMapper;
|
||||
|
||||
public Map<String, Long> moduleCount(TestPlanTableRequest request) {
|
||||
//查出每个模块节点下的资源数量。 不需要按照模块进行筛选
|
||||
@ -61,15 +66,21 @@ public class TestPlanManagementService {
|
||||
public Pager<List<TestPlanResponse>> page(TestPlanTableRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
MapUtils.isEmpty(request.getSort()) ? "t.num desc" : request.getSortString());
|
||||
return PageUtils.setPageInfo(page, this.getTableList(request));
|
||||
return PageUtils.setPageInfo(page, this.list(request));
|
||||
}
|
||||
|
||||
private List<TestPlanResponse> getTableList(TestPlanTableRequest request) {
|
||||
public List<TestPlanResponse> list(TestPlanTableRequest request) {
|
||||
List<TestPlanResponse> testPlanResponses = extTestPlanMapper.selectByConditions(request);
|
||||
handChildren(testPlanResponses,request.getProjectId());
|
||||
return testPlanResponses;
|
||||
}
|
||||
|
||||
public List<TestPlan> groupList(String projectId) {
|
||||
TestPlanExample example = new TestPlanExample();
|
||||
example.createCriteria().andTypeEqualTo(TestPlanConstants.TEST_PLAN_TYPE_GROUP).andProjectIdEqualTo(projectId).andStatusNotEqualTo(TestPlanConstants.TEST_PLAN_STATUS_ARCHIVED);
|
||||
return testPlanMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划组子节点
|
||||
*/
|
||||
|
@ -114,6 +114,7 @@ public class TestPlanTests extends BaseTest {
|
||||
|
||||
private static final String URL_GET_TEST_PLAN_DELETE = "/test-plan/delete/%s";
|
||||
private static final String URL_POST_TEST_PLAN_PAGE = "/test-plan/page";
|
||||
private static final String URL_POST_TEST_PLAN_GROUP_LIST = "/test-plan/group-list/%s";
|
||||
private static final String URL_POST_TEST_PLAN_STATISTICS = "/test-plan/statistics";
|
||||
private static final String URL_POST_TEST_PLAN_MODULE_COUNT = "/test-plan/module/count";
|
||||
private static final String URL_GET_TEST_PLAN_LIST_IN_GROUP = "/test-plan/list-in-group/%s";
|
||||
@ -667,6 +668,15 @@ public class TestPlanTests extends BaseTest {
|
||||
Assertions.assertNotNull(JSON.parseObject(JSON.toJSONString(holder.getData()), TestPlan.class).getId());
|
||||
}
|
||||
|
||||
//校验Group数量
|
||||
List<TestPlan> groupList = JSON.parseArray(
|
||||
JSON.toJSONString(
|
||||
JSON.parseObject(
|
||||
this.requestGetWithOkAndReturn(String.format(URL_POST_TEST_PLAN_GROUP_LIST, project.getId()))
|
||||
.getResponse().getContentAsString(), ResultHolder.class).getData()),
|
||||
TestPlan.class);
|
||||
Assertions.assertEquals(groupList.size(), 2);
|
||||
|
||||
/*
|
||||
反例
|
||||
1.参数校验: name为空
|
||||
|
Loading…
Reference in New Issue
Block a user