This commit is contained in:
fit2-zhao 2021-02-20 14:33:25 +08:00
commit e831eb5f3d
6 changed files with 8 additions and 42 deletions

View File

@ -44,13 +44,6 @@ public class ApiAutomationController {
return PageUtils.setPageInfo(page, apiAutomationService.list(request));
}
@PostMapping("/list/all")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<ApiScenarioWithBLOBs> list(@RequestBody ApiScenarioRequest request) {
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
return apiAutomationService.get(request);
}
@PostMapping(value = "/create")
public ApiScenario create(@RequestPart("request") SaveApiScenarioRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
return apiAutomationService.create(request, bodyFiles);

View File

@ -720,16 +720,6 @@ public class ApiAutomationService {
}
}
public List<ApiScenarioWithBLOBs> get(ApiScenarioRequest request) {
ApiScenarioExample example = new ApiScenarioExample();
if (CollectionUtils.isNotEmpty(request.getIds())) {
example.createCriteria().andIdIn(request.getIds());
} else {
example.createCriteria().andProjectIdEqualTo(request.getProjectId());
}
return apiScenarioMapper.selectByExampleWithBLOBs(example);
}
public List<ApiScenarioWithBLOBs> getWithBLOBs(ApiScenarioWithBLOBs request) {
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()).andStatusNotEqualTo("Trash").andIdNotEqualTo(request.getId());

View File

@ -5,13 +5,13 @@
SELECT api.id,api.name FROM Api_definition api
<where>
<if test="request.projectId != null">
api.project_Id = #{request.projectId}
AND api.project_Id = #{request.projectId}
</if>
<if test="request.name != null">
api.project_Id like CONCAT('%', #{request.name},'%')
<if test="request.name != null and request.name != '' ">
AND api.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.type != null">
api.method = #{request.type}
<if test="request.type != null and request.type != '' and request.type != 'ALL' ">
AND api.method = #{request.type}
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">

View File

@ -131,25 +131,7 @@
},
methods: {
exportAPI() {
let obj = {projectName: localStorage.getItem(PROJECT_NAME)}
let condition = {projectId: getCurrentProjectID(), ids: this.$refs.apiScenarioList.selection};
let url = "/api/automation/list/all";
this.loading = true;
this.$post(url, condition, response => {
obj.data = response.data;
this.buildApiPath(obj.data);
this.loading = false;
downloadFile("Metersphere_Scenario_" + localStorage.getItem(PROJECT_NAME) + ".json", JSON.stringify(obj));
});
},
buildApiPath(apis) {
apis.forEach((api) => {
this.moduleOptions.forEach(item => {
if (api.moduleId === item.id) {
api.modulePath = item.path;
}
});
});
this.$refs.apiScenarioList.exportApi();
},
checkRedirectEditPage(redirectParam) {
if (redirectParam != null) {

View File

@ -187,7 +187,7 @@ import {PROJECT_NAME} from "../../../../../common/js/constants";
import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect";
import BatchMove from "../../../track/case/components/BatchMove";
import {_sort} from "@/common/js/tableUtils";
import {Api_Scenario_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import {Api_Scenario_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {
_filter,

View File

@ -384,6 +384,7 @@ export default {
}
let simpleInfoUrl = "/api/document/selectApiSimpleInfo";
this.apiSimpleInfoArray = [];
this.$post(simpleInfoUrl, simpleRequest, response => {
this.apiSimpleInfoArray = response.data;
this.apiStepIndex = 0;