fix: 修改导出用例请求方法
This commit is contained in:
parent
2c9fd0ddc1
commit
8bb657c28e
|
@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext;
|
|||
import io.metersphere.base.domain.TestCase;
|
||||
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
|
||||
import io.metersphere.track.dto.TestCaseDTO;
|
||||
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -15,7 +16,7 @@ public interface ExtTestCaseMapper {
|
|||
|
||||
List<TestCaseDTO> listByMethod(@Param("request") QueryTestCaseRequest request);
|
||||
|
||||
List<TestCaseDTO> listBytestCaseIds(@Param("request") QueryTestCaseRequest request);
|
||||
List<TestCaseDTO> listBytestCaseIds(@Param("request") TestCaseBatchRequest request);
|
||||
|
||||
TestCase getMaxNumByProjectId(@Param("projectId") String projectId);
|
||||
|
||||
|
|
|
@ -202,9 +202,9 @@
|
|||
select test_case.*,api_test.name as apiName,load_test.name AS performName from test_case left join api_test on
|
||||
test_case.test_id=api_test.id left join load_test on test_case.test_id=load_test.id
|
||||
<where>
|
||||
<if test="request.testCaseIds!=null and request.testCaseIds.size() > 0">
|
||||
<if test="request.ids!=null and request.ids.size() > 0">
|
||||
and test_case.id in
|
||||
<foreach collection="request.testCaseIds" open="(" close=")" separator="," item="id">
|
||||
<foreach collection="request.ids" open="(" close=")" separator="," item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
|
|
@ -110,9 +110,9 @@ public class TestCaseController {
|
|||
public void testCaseTemplateExport(HttpServletResponse response){
|
||||
testCaseService.testCaseTemplateExport(response);
|
||||
}
|
||||
@GetMapping("/export/testCase/{testCaseIds}")
|
||||
@PostMapping("/export/testcase")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public void testCaseExport(HttpServletResponse response,QueryTestCaseRequest request){
|
||||
public void testCaseExport( HttpServletResponse response,@RequestBody TestCaseBatchRequest request){
|
||||
testCaseService.testCaseExport(response,request);
|
||||
}
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ public class TestCaseService {
|
|||
return list;
|
||||
}
|
||||
|
||||
public void testCaseExport(HttpServletResponse response, QueryTestCaseRequest request) {
|
||||
public void testCaseExport(HttpServletResponse response, TestCaseBatchRequest request) {
|
||||
EasyExcelExporter easyExcelExporter = null;
|
||||
try {
|
||||
easyExcelExporter = new EasyExcelExporter(TestCaseExcelData.class);
|
||||
|
@ -323,7 +323,7 @@ public class TestCaseService {
|
|||
}
|
||||
}
|
||||
|
||||
private List<TestCaseExcelData> generateTestCaseExcel(QueryTestCaseRequest request) {
|
||||
private List<TestCaseExcelData> generateTestCaseExcel(TestCaseBatchRequest request) {
|
||||
List<TestCaseDTO> TestCaseList = extTestCaseMapper.listBytestCaseIds(request);
|
||||
List<TestCaseExcelData> list = new ArrayList<>();
|
||||
SessionUser user = SessionUtils.getUser();
|
||||
|
|
|
@ -292,9 +292,10 @@
|
|||
},
|
||||
exportTestCase() {
|
||||
let config = {
|
||||
url: '/test/case/export/testCase/' + [...this.selectIds],
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
url: '/test/case/export/testcase',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: {ids: [...this.selectIds]}
|
||||
};
|
||||
this.result = this.$request(config).then(response => {
|
||||
const filename = this.$t('test_track.case.test_case') + ".xlsx";
|
||||
|
|
Loading…
Reference in New Issue