feat(功能用例): 脑图分页
This commit is contained in:
parent
b7b38276e7
commit
9b0c48a5bf
|
@ -1,6 +1,8 @@
|
|||
package io.metersphere.functional.controller;
|
||||
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.functional.dto.FunctionalMinderTreeDTO;
|
||||
import io.metersphere.functional.request.FunctionalCaseMindRequest;
|
||||
import io.metersphere.functional.request.FunctionalCaseMinderEditRequest;
|
||||
|
@ -10,6 +12,8 @@ import io.metersphere.functional.service.FunctionalCaseMinderService;
|
|||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.system.dto.sdk.BaseTreeNode;
|
||||
import io.metersphere.system.security.CheckOwner;
|
||||
import io.metersphere.system.utils.PageUtils;
|
||||
import io.metersphere.system.utils.Pager;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -46,8 +50,10 @@ public class FunctionalCaseMinderController {
|
|||
@Operation(summary = "用例管理-功能用例-脑图用例跟根据模块ID查询列表")
|
||||
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ)
|
||||
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||
public List<FunctionalMinderTreeDTO> getFunctionalCaseMinderTree(@Validated @RequestBody FunctionalCaseMindRequest request) {
|
||||
return functionalCaseMinderService.getMindFunctionalCase(request, false);
|
||||
public Pager<List<FunctionalMinderTreeDTO>> getFunctionalCaseMinderTree(@Validated @RequestBody FunctionalCaseMindRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), 100 );
|
||||
return PageUtils.setPageInfo(page, functionalCaseMinderService.getMindFunctionalCase(request, false));
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/edit")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.functional.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -12,4 +13,8 @@ public class FunctionalCaseMindRequest {
|
|||
|
||||
@Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String moduleId;
|
||||
|
||||
@Min(value = 1, message = "当前页码必须大于0")
|
||||
@Schema(description = "当前页码")
|
||||
private int current;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import io.metersphere.system.log.constants.OperationLogType;
|
|||
import io.metersphere.system.log.dto.LogDTO;
|
||||
import io.metersphere.system.log.service.OperationLogService;
|
||||
import io.metersphere.system.mapper.CustomFieldMapper;
|
||||
import io.metersphere.system.mapper.ExtCheckOwnerMapper;
|
||||
import io.metersphere.system.mapper.UserMapper;
|
||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||
import io.metersphere.system.service.CommonNoticeSendService;
|
||||
|
@ -84,9 +83,6 @@ public class FunctionalCaseMinderService {
|
|||
@Resource
|
||||
private FunctionalCaseCustomFieldMapper functionalCaseCustomFieldMapper;
|
||||
|
||||
@Resource
|
||||
private ExtCheckOwnerMapper extCheckOwnerMapper;
|
||||
|
||||
@Resource
|
||||
private FunctionalCaseService functionalCaseService;
|
||||
|
||||
|
@ -127,10 +123,6 @@ public class FunctionalCaseMinderService {
|
|||
private ProjectTemplateService projectTemplateService;
|
||||
|
||||
|
||||
private static final String FUNCTIONAL_CASE = "functional_case";
|
||||
private static final String FUNCTIONAL_CASE_MODULE = "functional_case_module";
|
||||
private static final String CHECK_OWNER_CASE = "check_owner_case";
|
||||
|
||||
/**
|
||||
* 功能用例-脑图用例列表查询
|
||||
*
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package io.metersphere.functional.controller;
|
||||
|
||||
import io.metersphere.functional.domain.*;
|
||||
import io.metersphere.functional.dto.CaseCustomFieldDTO;
|
||||
import io.metersphere.functional.dto.FunctionalCaseStepDTO;
|
||||
import io.metersphere.functional.dto.FunctionalMinderTreeDTO;
|
||||
import io.metersphere.functional.dto.MinderOptionDTO;
|
||||
import io.metersphere.functional.dto.*;
|
||||
import io.metersphere.functional.mapper.*;
|
||||
import io.metersphere.functional.request.*;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
|
@ -12,6 +9,7 @@ import io.metersphere.sdk.util.Translator;
|
|||
import io.metersphere.system.base.BaseTest;
|
||||
import io.metersphere.system.controller.handler.ResultHolder;
|
||||
import io.metersphere.system.dto.sdk.BaseTreeNode;
|
||||
import io.metersphere.system.utils.Pager;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -64,17 +62,21 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
public void testGetPageList() throws Exception {
|
||||
FunctionalCaseMindRequest request = new FunctionalCaseMindRequest();
|
||||
request.setProjectId("project-case-minder-test");
|
||||
request.setCurrent(1);
|
||||
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_LIST_URL, request);
|
||||
String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
Pager<List<FunctionalMinderTreeDTO>> tableData = JSON.parseObject(JSON.toJSONString(
|
||||
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||
Pager.class);
|
||||
Assertions.assertNotNull(tableData);
|
||||
request = new FunctionalCaseMindRequest();
|
||||
request.setProjectId("project-case-minder-test");
|
||||
request.setModuleId("TEST_MINDER_MODULE_ID_GYQ");
|
||||
request.setCurrent(1);
|
||||
mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_LIST_URL, request);
|
||||
contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
tableData = JSON.parseObject(JSON.toJSONString(
|
||||
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||
Pager.class);
|
||||
Assertions.assertNotNull(tableData);
|
||||
FunctionalCaseBlob functionalCaseBlob = new FunctionalCaseBlob();
|
||||
functionalCaseBlob.setId("TEST_FUNCTIONAL_MINDER_CASE_ID_2");
|
||||
functionalCaseBlob.setSteps(JSON.toJSONString(new ArrayList<>()).getBytes(StandardCharsets.UTF_8));
|
||||
|
@ -92,9 +94,10 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
functionalCaseBlob6.setDescription(StringUtils.EMPTY.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlobMapper.updateByPrimaryKeyWithBLOBs(functionalCaseBlob6);
|
||||
mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_LIST_URL, request);
|
||||
contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
tableData = JSON.parseObject(JSON.toJSONString(
|
||||
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||
Pager.class);
|
||||
Assertions.assertNotNull(tableData);
|
||||
List<FunctionalCaseStepDTO> list = new ArrayList<>();
|
||||
FunctionalCaseStepDTO functionalCaseStepDTO = new FunctionalCaseStepDTO();
|
||||
functionalCaseStepDTO.setId("12455");
|
||||
|
@ -130,9 +133,11 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
functionalCaseBlob6.setDescription(description.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlobMapper.updateByPrimaryKeyWithBLOBs(functionalCaseBlob6);
|
||||
mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_LIST_URL, request);
|
||||
contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
|
||||
tableData = JSON.parseObject(JSON.toJSONString(
|
||||
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||
Pager.class);
|
||||
Assertions.assertNotNull(tableData);
|
||||
expectedResult = "文本描述的结果";
|
||||
functionalCaseBlob = new FunctionalCaseBlob();
|
||||
functionalCaseBlob.setId("TEST_FUNCTIONAL_MINDER_CASE_ID_2");
|
||||
|
@ -145,11 +150,12 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
|
||||
|
||||
mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_LIST_URL, request);
|
||||
contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
List<FunctionalMinderTreeDTO> baseTreeNodes = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), FunctionalMinderTreeDTO.class);
|
||||
Assertions.assertNotNull(baseTreeNodes);
|
||||
Assertions.assertEquals(2, baseTreeNodes.size());
|
||||
tableData = JSON.parseObject(JSON.toJSONString(
|
||||
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||
Pager.class);
|
||||
Assertions.assertNotNull(tableData);
|
||||
Assertions.assertNotNull(tableData.getList());
|
||||
Assertions.assertEquals(2, tableData.getList().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -330,6 +336,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
public void testGetCaseModuleNodeList() throws Exception {
|
||||
FunctionalCaseMindRequest request = new FunctionalCaseMindRequest();
|
||||
request.setProjectId("project-case-minder-test");
|
||||
request.setCurrent(1);
|
||||
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_NODE_MODULE_URL, request);
|
||||
String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
|
@ -350,6 +357,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
request.setProjectId("project-case-minder-test");
|
||||
request.setModuleId("TEST_MINDER_MODULE_ID_GYQ4");
|
||||
request.setReviewId("TEST_MINDER_REVIEW_ID_GYQ");
|
||||
request.setCurrent(1);
|
||||
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_REVIEW_LIST_URL, request);
|
||||
String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
|
@ -362,6 +370,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
request.setReviewId("TEST_MINDER_REVIEW_ID_GYQ2");
|
||||
request.setViewFlag(true);
|
||||
request.setViewStatusFlag(true);
|
||||
request.setCurrent(1);
|
||||
mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_REVIEW_LIST_URL, request);
|
||||
contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
|
@ -377,6 +386,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
request.setProjectId("project-case-minder-test");
|
||||
request.setModuleId("TEST_MINDER_MODULE_ID_GYQ4");
|
||||
request.setPlanId("TEST_MINDER_PLAN_ID_1");
|
||||
request.setCurrent(1);
|
||||
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_PLAN_LIST_URL, request);
|
||||
String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
|
|
Loading…
Reference in New Issue