diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanApiCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanApiCaseController.java index 75d2976845..421f585062 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanApiCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanApiCaseController.java @@ -5,23 +5,17 @@ import com.github.pagehelper.PageHelper; import io.metersphere.api.dto.definition.ApiTestCaseDTO; import io.metersphere.api.dto.definition.ApiTestCaseRequest; import io.metersphere.api.dto.definition.TestPlanApiCaseDTO; -import io.metersphere.base.domain.TestPlanTestCaseWithBLOBs; import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.SessionUtils; -import io.metersphere.track.dto.TestPlanCaseDTO; import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest; -import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest; -import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.track.service.TestPlanApiCaseService; -import io.metersphere.track.service.TestPlanTestCaseService; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.util.Arrays; import java.util.List; @RequestMapping("/test/plan/api/case") @@ -31,12 +25,6 @@ public class TestPlanApiCaseController { @Resource TestPlanApiCaseService testPlanApiCaseService; -// @PostMapping("/list/{goPage}/{pageSize}") -// public Pager> getTestPlanCases(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanCaseRequest request) { -// Page page = PageHelper.startPage(goPage, pageSize, true); -// return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request)); -// } - @PostMapping("/list/{goPage}/{pageSize}") public Pager> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); @@ -62,62 +50,4 @@ public class TestPlanApiCaseController { testPlanApiCaseService.deleteApiCaseBath(request); } - -// @GetMapping("/list/node/all/{planId}/{nodePaths}") -// public List getTestPlanCasesByNodePaths(@PathVariable String planId, @PathVariable String nodePaths) { -// String nodePath = nodePaths.replace("f", ""); -// String[] array = nodePath.split(","); -// List list = Arrays.asList(array); -// QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest(); -// request.setPlanId(planId); -// request.setNodePaths(list); -// request.setMethod("auto"); -// return testPlanTestCaseService.listByNodes(request); -// } -// -// @GetMapping("/get/{caseId}") -// public TestPlanCaseDTO getTestPlanCases(@PathVariable String caseId) { -// return testPlanTestCaseService.get(caseId); -// } -// -// @PostMapping("recent/{count}") -// public List getRecentTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request) { -// return testPlanTestCaseService.getRecentTestCases(request, count); -// } -// -// @PostMapping("pending/{count}") -// public List getPrepareTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request) { -// return testPlanTestCaseService.getPendingTestCases(request, count); -// } -// -// @PostMapping("/list/all") -// public List getTestPlanCases(@RequestBody QueryTestPlanCaseRequest request) { -// return testPlanTestCaseService.list(request); -// } -// -// @PostMapping("/list/ids") -// public List getTestPlanCaseIds(@RequestBody QueryTestPlanCaseRequest request) { -// return testPlanTestCaseService.list(request); -// } -// -// @PostMapping("/edit") -// @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) -// public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) { -// testPlanTestCaseService.editTestCase(testPlanTestCase); -// } -// -// @PostMapping("/batch/edit") -// @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) -// public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) { -// testPlanTestCaseService.editTestCaseBath(request); -// } -// -// @PostMapping("/batch/delete") -// @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) -// public void deleteTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) { -// testPlanTestCaseService.deleteTestCaseBath(request); -// } -// - - } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java index 0311b44280..aca590bd67 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java @@ -1,28 +1,15 @@ package io.metersphere.track.service; -import com.github.pagehelper.PageHelper; import io.metersphere.api.dto.definition.ApiTestCaseDTO; import io.metersphere.api.dto.definition.ApiTestCaseRequest; import io.metersphere.api.dto.definition.TestPlanApiCaseDTO; import io.metersphere.api.service.ApiDefinitionExecResultService; import io.metersphere.api.service.ApiTestCaseService; -import io.metersphere.base.domain.*; +import io.metersphere.base.domain.TestPlanApiCaseExample; import io.metersphere.base.mapper.TestPlanApiCaseMapper; -import io.metersphere.base.mapper.TestPlanTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper; -import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper; -import io.metersphere.commons.constants.TestPlanTestCaseStatus; -import io.metersphere.commons.user.SessionUser; -import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.ServiceUtils; -import io.metersphere.commons.utils.SessionUtils; -import io.metersphere.controller.request.member.QueryMemberRequest; -import io.metersphere.service.UserService; -import io.metersphere.track.dto.TestPlanCaseDTO; import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest; -import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest; -import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -30,8 +17,6 @@ import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; @Service @Transactional(rollbackFor = Exception.class) @@ -45,24 +30,9 @@ public class TestPlanApiCaseService { ExtTestPlanApiCaseMapper extTestPlanApiCaseMapper; @Resource ApiDefinitionExecResultService apiDefinitionExecResultService; - @Resource - UserService userService; - @Resource - TestPlanService testPlanService; public List list(ApiTestCaseRequest request) { request.setProjectId(null); -// TestPlanApiCaseExample example = new TestPlanApiCaseExample(); -// example.createCriteria().andTestPlanIdEqualTo(request.getPlanId()); -// List testPlanApiCases = testPlanApiCaseMapper.selectByExample(example); -// if (CollectionUtils.isEmpty(testPlanApiCases)) { -// return new ArrayList<>(); -// } -// List caseIds = testPlanApiCases.stream().collect(Collectors.toMap((TestPlanApiCase::getApiCaseId + TestPlanApiCase::getTestPlanId)->{ -// -// })); -// request.setIds(caseIds); -// return apiTestCaseService.listSimple(request); request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); List apiTestCases = extTestPlanApiCaseMapper.list(request); if (CollectionUtils.isEmpty(apiTestCases)) { @@ -99,95 +69,4 @@ public class TestPlanApiCaseService { .andTestPlanIdEqualTo(request.getPlanId()); testPlanApiCaseMapper.deleteByExample(example); } -// -// public List listByNode(QueryTestPlanCaseRequest request) { -// List list = extTestPlanTestCaseMapper.listByNode(request); -// return list; -// } -// -// public List listByNodes(QueryTestPlanCaseRequest request) { -// List list = extTestPlanTestCaseMapper.listByNodes(request); -// return list; -// } -// -// public void editTestCase(TestPlanTestCaseWithBLOBs testPlanTestCase) { -// if (StringUtils.equals(TestPlanTestCaseStatus.Prepare.name(), testPlanTestCase.getStatus())) { -// testPlanTestCase.setStatus(TestPlanTestCaseStatus.Underway.name()); -// } -// testPlanTestCase.setExecutor(SessionUtils.getUser().getId()); -// testPlanTestCase.setUpdateTime(System.currentTimeMillis()); -// testPlanTestCaseMapper.updateByPrimaryKeySelective(testPlanTestCase); -// } -// -// public int deleteTestCase(String id) { -// return testPlanTestCaseMapper.deleteByPrimaryKey(id); -// } -// -// public void editTestCaseBath(TestPlanCaseBatchRequest request) { -// TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample(); -// testPlanTestCaseExample.createCriteria().andIdIn(request.getIds()); -// -// TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs(); -// BeanUtils.copyBean(testPlanTestCase, request); -// testPlanTestCase.setUpdateTime(System.currentTimeMillis()); -// testPlanTestCaseMapper.updateByExampleSelective( -// testPlanTestCase, -// testPlanTestCaseExample); -// } -// -// public List getRecentTestCases(QueryTestPlanCaseRequest request, int count) { -// buildQueryRequest(request, count); -// if (request.getPlanIds().isEmpty()) { -// return new ArrayList<>(); -// } -// -// List recentTestedTestCase = extTestPlanTestCaseMapper.getRecentTestedTestCase(request); -// List planIds = recentTestedTestCase.stream().map(TestPlanCaseDTO::getPlanId).collect(Collectors.toList()); -// -// if (planIds.isEmpty()) { -// return new ArrayList<>(); -// } -// -// Map testPlanMap = testPlanService.getTestPlanByIds(planIds).stream() -// .collect(Collectors.toMap(TestPlan::getId, TestPlan::getName)); -// -// recentTestedTestCase.forEach(testCase -> { -// testCase.setPlanName(testPlanMap.get(testCase.getPlanId())); -// }); -// return recentTestedTestCase; -// } -// -// public List getPendingTestCases(QueryTestPlanCaseRequest request, int count) { -// buildQueryRequest(request, count); -// if (request.getPlanIds().isEmpty()) { -// return new ArrayList<>(); -// } -// return extTestPlanTestCaseMapper.getPendingTestCases(request); -// } -// -// public void buildQueryRequest(QueryTestPlanCaseRequest request, int count) { -// SessionUser user = SessionUtils.getUser(); -// List relateTestPlanIds = extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId(), SessionUtils.getCurrentProjectId()); -// PageHelper.startPage(1, count, true); -// request.setPlanIds(relateTestPlanIds); -// request.setExecutor(user.getId()); -// } -// -// public TestPlanCaseDTO get(String testplanTestCaseId) { -// return extTestPlanTestCaseMapper.get(testplanTestCaseId); -// } -// -// public void deleteTestCaseBath(TestPlanCaseBatchRequest request) { -// TestPlanTestCaseExample example = new TestPlanTestCaseExample(); -// example.createCriteria().andIdIn(request.getIds()); -// testPlanTestCaseMapper.deleteByExample(example); -// } -// -// public List getTestPlanTestCaseIds(String testId) { -// return extTestPlanTestCaseMapper.getTestPlanTestCaseIds(testId); -// } -// -// public int updateTestCaseStates(List ids, String reportStatus) { -// return extTestPlanTestCaseMapper.updateTestCaseStates(ids, reportStatus); -// } } diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanCaseListHeader.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanCaseListHeader.vue index 19c695d11a..c16c85224c 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanCaseListHeader.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanCaseListHeader.vue @@ -1,28 +1,18 @@