diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java index f9c31b51c8..ca22e11ad8 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java @@ -322,7 +322,6 @@ public class ApiDefinitionController { @PostMapping("/relationship/relate/{goPage}/{pageSize}") public Pager< List> getRelationshipRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiDefinitionRequest request) { - Page page = PageHelper.startPage(goPage, pageSize, true); - return PageUtils.setPageInfo(page, apiDefinitionService.getRelationshipRelateList(request)); + return apiDefinitionService.getRelationshipRelateList(request, goPage, pageSize); } } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 419efa5a16..d9ab2a73d4 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -2,6 +2,8 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; import io.metersphere.api.dto.APIReportResult; import io.metersphere.api.dto.ApiTestImportRequest; import io.metersphere.api.dto.automation.ApiScenarioRequest; @@ -58,6 +60,7 @@ import org.apache.ibatis.session.SqlSessionFactory; import org.apache.jorphan.collections.HashTree; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.multipart.MultipartFile; import sun.security.util.Cache; @@ -1663,11 +1666,12 @@ public class ApiDefinitionService { } } - public List getRelationshipRelateList(ApiDefinitionRequest request) { + public Pager> getRelationshipRelateList(ApiDefinitionRequest request, int goPage, @PathVariable int pageSize) { request = this.initRequest(request, true, true); List relationshipIds = relationshipEdgeService.getRelationshipIds(request.getId()); request.setNotInIds(relationshipIds); request.setId(null); // 去掉id的查询条件 - return extApiDefinitionMapper.list(request); + Page page = PageHelper.startPage(goPage, pageSize, true); + return PageUtils.setPageInfo(page, extApiDefinitionMapper.list(request)); } } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index fdcd9e5b09..035792949b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -559,7 +559,7 @@