fix(功能用例): tree 不分页

This commit is contained in:
guoyuqi 2024-06-21 14:31:15 +08:00 committed by Craftsman
parent 24d6a0069f
commit a1cc2092f1
4 changed files with 20 additions and 8 deletions

View File

@ -4,10 +4,7 @@ import com.alibaba.excel.util.StringUtils;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import io.metersphere.functional.dto.FunctionalMinderTreeDTO; import io.metersphere.functional.dto.FunctionalMinderTreeDTO;
import io.metersphere.functional.request.FunctionalCaseMindRequest; import io.metersphere.functional.request.*;
import io.metersphere.functional.request.FunctionalCaseMinderEditRequest;
import io.metersphere.functional.request.FunctionalCasePlanMindRequest;
import io.metersphere.functional.request.FunctionalCaseReviewMindRequest;
import io.metersphere.functional.service.FunctionalCaseMinderService; import io.metersphere.functional.service.FunctionalCaseMinderService;
import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.system.dto.sdk.BaseTreeNode; import io.metersphere.system.dto.sdk.BaseTreeNode;
@ -42,7 +39,7 @@ public class FunctionalCaseMinderController {
@Operation(summary = "用例管理-功能用例-脑图-获取空白节点和模块的组合树") @Operation(summary = "用例管理-功能用例-脑图-获取空白节点和模块的组合树")
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ) @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ)
@CheckOwner(resourceId = "#projectId", resourceType = "project") @CheckOwner(resourceId = "#projectId", resourceType = "project")
public List<BaseTreeNode> getTree(@Validated @RequestBody FunctionalCaseMindRequest request) { public List<BaseTreeNode> getTree(@Validated @RequestBody FunctionalCaseMindTreeRequest request) {
return functionalCaseMinderService.getTree(request); return functionalCaseMinderService.getTree(request);
} }

View File

@ -0,0 +1,16 @@
package io.metersphere.functional.request;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
@Data
public class FunctionalCaseMindTreeRequest {
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case.project_id.not_blank}")
private String projectId;
@Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String moduleId;
}

View File

@ -1162,7 +1162,7 @@ public class FunctionalCaseMinderService {
} }
public List<BaseTreeNode> getTree(FunctionalCaseMindRequest request) { public List<BaseTreeNode> getTree(FunctionalCaseMindTreeRequest request) {
List<BaseTreeNode> functionalModuleList = extFunctionalCaseModuleMapper.selectBaseByProjectId(request.getProjectId()); List<BaseTreeNode> functionalModuleList = extFunctionalCaseModuleMapper.selectBaseByProjectId(request.getProjectId());
List<BaseTreeNode> baseTreeNodes = extFunctionalCaseMapper.selectBaseMindNodeByProjectId(request.getProjectId()); List<BaseTreeNode> baseTreeNodes = extFunctionalCaseMapper.selectBaseMindNodeByProjectId(request.getProjectId());
functionalModuleList.addAll(baseTreeNodes); functionalModuleList.addAll(baseTreeNodes);

View File

@ -334,9 +334,8 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
@Test @Test
@Order(3) @Order(3)
public void testGetCaseModuleNodeList() throws Exception { public void testGetCaseModuleNodeList() throws Exception {
FunctionalCaseMindRequest request = new FunctionalCaseMindRequest(); FunctionalCaseMindTreeRequest request = new FunctionalCaseMindTreeRequest();
request.setProjectId("project-case-minder-test"); request.setProjectId("project-case-minder-test");
request.setCurrent(1);
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_NODE_MODULE_URL, request); MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_NODE_MODULE_URL, request);
String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8); String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);