Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2020-12-22 10:55:16 +08:00
commit bf400b5d3c
3 changed files with 9 additions and 210 deletions

View File

@ -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<List<TestPlanCaseDTO>> getTestPlanCases(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanCaseRequest request) {
// Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
// return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request));
// }
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<TestPlanApiCaseDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
@ -62,62 +50,4 @@ public class TestPlanApiCaseController {
testPlanApiCaseService.deleteApiCaseBath(request);
}
// @GetMapping("/list/node/all/{planId}/{nodePaths}")
// public List<TestPlanCaseDTO> getTestPlanCasesByNodePaths(@PathVariable String planId, @PathVariable String nodePaths) {
// String nodePath = nodePaths.replace("f", "");
// String[] array = nodePath.split(",");
// List<String> 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<TestPlanCaseDTO> getRecentTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request) {
// return testPlanTestCaseService.getRecentTestCases(request, count);
// }
//
// @PostMapping("pending/{count}")
// public List<TestPlanCaseDTO> getPrepareTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request) {
// return testPlanTestCaseService.getPendingTestCases(request, count);
// }
//
// @PostMapping("/list/all")
// public List<TestPlanCaseDTO> getTestPlanCases(@RequestBody QueryTestPlanCaseRequest request) {
// return testPlanTestCaseService.list(request);
// }
//
// @PostMapping("/list/ids")
// public List<TestPlanCaseDTO> 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);
// }
//
}

View File

@ -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<TestPlanApiCaseDTO> list(ApiTestCaseRequest request) {
request.setProjectId(null);
// TestPlanApiCaseExample example = new TestPlanApiCaseExample();
// example.createCriteria().andTestPlanIdEqualTo(request.getPlanId());
// List<TestPlanApiCase> testPlanApiCases = testPlanApiCaseMapper.selectByExample(example);
// if (CollectionUtils.isEmpty(testPlanApiCases)) {
// return new ArrayList<>();
// }
// List<String> caseIds = testPlanApiCases.stream().collect(Collectors.toMap((TestPlanApiCase::getApiCaseId + TestPlanApiCase::getTestPlanId)->{
//
// }));
// request.setIds(caseIds);
// return apiTestCaseService.listSimple(request);
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<TestPlanApiCaseDTO> apiTestCases = extTestPlanApiCaseMapper.list(request);
if (CollectionUtils.isEmpty(apiTestCases)) {
@ -99,95 +69,4 @@ public class TestPlanApiCaseService {
.andTestPlanIdEqualTo(request.getPlanId());
testPlanApiCaseMapper.deleteByExample(example);
}
//
// public List<TestPlanCaseDTO> listByNode(QueryTestPlanCaseRequest request) {
// List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.listByNode(request);
// return list;
// }
//
// public List<TestPlanCaseDTO> listByNodes(QueryTestPlanCaseRequest request) {
// List<TestPlanCaseDTO> 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<TestPlanCaseDTO> getRecentTestCases(QueryTestPlanCaseRequest request, int count) {
// buildQueryRequest(request, count);
// if (request.getPlanIds().isEmpty()) {
// return new ArrayList<>();
// }
//
// List<TestPlanCaseDTO> recentTestedTestCase = extTestPlanTestCaseMapper.getRecentTestedTestCase(request);
// List<String> planIds = recentTestedTestCase.stream().map(TestPlanCaseDTO::getPlanId).collect(Collectors.toList());
//
// if (planIds.isEmpty()) {
// return new ArrayList<>();
// }
//
// Map<String, String> 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<TestPlanCaseDTO> 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<String> 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<String> getTestPlanTestCaseIds(String testId) {
// return extTestPlanTestCaseMapper.getTestPlanTestCaseIds(testId);
// }
//
// public int updateTestCaseStates(List<String> ids, String reportStatus) {
// return extTestPlanTestCaseMapper.updateTestCaseStates(ids, reportStatus);
// }
}

View File

@ -1,28 +1,18 @@
<template>
<ms-table-header :is-tester-permission="true" :condition="condition" @search="$emit('refresh')"
:show-create="false" :tip="$t('commons.search_by_name_or_id')">
<!--<template v-slot:title>-->
<!--<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="breadcrumbRefresh"/>-->
<!--</template>-->
<ms-table-header :is-tester-permission="true"
:condition="condition"
@search="$emit('refresh')"
:show-create="false"
:tip="$t('commons.search_by_name_or_id')">
<template v-slot:title>
接口用例
</template>
<template v-slot:button>
<!--<ms-table-button :is-tester-permission="true" v-if="!showMyTestCase" icon="el-icon-s-custom"-->
<!--:content="$t('test_track.plan_view.my_case')" @click="initTable"/>-->
<!--<ms-table-button :is-tester-permission="true" v-if="showMyTestCase" icon="el-icon-files"-->
<!--:content="$t('test_track.plan_view.all_case')" @click="searchMyTestCase"/>-->
<ms-table-button :is-tester-permission="true" icon="el-icon-connection"
:content="$t('test_track.plan_view.relevance_test_case')"
@click="$emit('relevanceCase')"/>
<!--<ms-table-button :is-tester-permission="true" v-if="!testPlan.reportId" icon="el-icon-document"-->
<!--:content="$t('test_track.plan_view.create_report')" @click="openTestReport"/>-->
<!--<ms-table-button :is-tester-permission="true" v-if="testPlan.reportId" icon="el-icon-document"-->
<!--:content="$t('test_track.plan_view.view_report')" @click="openReport"/>-->
<!--<ms-table-button :is-tester-permission="true" icon="el-icon-document-remove"-->
<!--:content="$t('test_track.plan_view.cancel_all_relevance')" @click="handleDeleteBatch"/>-->
</template>
<!--<template v-slot:searchBarBefore>-->
<!--<ms-environment-select :project-id="projectId" :is-read-only="isReadOnly" @setEnvironment="setEnvironment"/>-->
<!--</template>-->
</ms-table-header>
</template>