fix(接口自动化): 修复回收站恢复缺陷

This commit is contained in:
fit2-zhao 2020-12-18 10:28:28 +08:00
parent 855f96a25a
commit 3db39fb276
7 changed files with 34 additions and 19 deletions

View File

@ -59,8 +59,8 @@ public class ApiAutomationController {
}
@PostMapping("/reduction")
public void reduction(@RequestBody List<String> ids) {
apiAutomationService.reduction(ids);
public void reduction(@RequestBody List<SaveApiScenarioRequest> requests) {
apiAutomationService.reduction(requests);
}
@GetMapping("/getApiScenario/{id}")

View File

@ -63,8 +63,8 @@ public class ApiDefinitionController {
}
@PostMapping("/reduction")
public void reduction(@RequestBody List<String> ids) {
apiDefinitionService.reduction(ids);
public void reduction(@RequestBody List<SaveApiDefinitionRequest> requests) {
apiDefinitionService.reduction(requests);
}
@GetMapping("/get/{id}")

View File

@ -179,7 +179,12 @@ public class ApiAutomationService {
extApiScenarioMapper.removeToGc(apiIds);
}
public void reduction(List<String> apiIds) {
public void reduction(List<SaveApiScenarioRequest> requests) {
List<String> apiIds = new ArrayList<>();
requests.forEach(item->{
checkNameExist(item);
apiIds.add(item.getId());
});
extApiScenarioMapper.reduction(apiIds);
}

View File

@ -158,7 +158,12 @@ public class ApiDefinitionService {
extApiDefinitionMapper.removeToGc(apiIds);
}
public void reduction(List<String> apiIds) {
public void reduction(List<SaveApiDefinitionRequest> requests) {
List<String> apiIds = new ArrayList<>();
requests.forEach(item -> {
checkNameExist(item);
apiIds.add(item.getId());
});
extApiDefinitionMapper.reduction(apiIds);
}
@ -386,6 +391,7 @@ public class ApiDefinitionService {
/**
* 数据统计-接口类型
*
* @param projectId 项目ID
* @return
*/
@ -395,6 +401,7 @@ public class ApiDefinitionService {
/**
* 统计本周创建的数据总量
*
* @param projectId
* @return
*/
@ -404,10 +411,10 @@ public class ApiDefinitionService {
Date firstTime = startAndEndDateInWeek.get("firstTime");
Date lastTime = startAndEndDateInWeek.get("lastTime");
if(firstTime==null || lastTime == null){
return 0;
}else {
return extApiDefinitionMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
if (firstTime == null || lastTime == null) {
return 0;
} else {
return extApiDefinitionMapper.countByProjectIDAndCreateInThisWeek(projectId, firstTime.getTime(), lastTime.getTime());
}
}
}

@ -1 +1 @@
Subproject commit efb49c9b4be136ce48e9550dc9c8a2975d9f4d7f
Subproject commit 61397c16728a63493507679f7e0940d9099f337f

View File

@ -219,8 +219,9 @@
this.$emit('edit', row);
},
reductionApi(row) {
let obj = [row.id];
this.$post("/api/automation/reduction", obj, response => {
row.scenarioDefinition = null;
let rows = [row];
this.$post("/api/automation/reduction", rows, response => {
this.$success(this.$t('commons.save_success'));
this.search();
})

View File

@ -6,10 +6,10 @@
<el-input placeholder="搜索" @blur="search" class="search-input" size="small" v-model="condition.name"/>
<el-table v-loading="result.loading"
border
:data="tableData" row-key="id" class="test-content adjust-table"
@select-all="handleSelectAll"
@select="handleSelect" :height="screenHeight">
border
:data="tableData" row-key="id" class="test-content adjust-table"
@select-all="handleSelectAll"
@select="handleSelect" :height="screenHeight">
<el-table-column type="selection"/>
<el-table-column width="40" :resizable="false" align="center">
<template v-slot:default="scope">
@ -268,8 +268,10 @@
this.$emit('editApi', row);
},
reductionApi(row) {
let ids = [row.id];
this.$post('/api/definition/reduction/', ids, () => {
row.request = null;
row.response = null;
let rows = [row];
this.$post('/api/definition/reduction/', rows, () => {
this.$success(this.$t('commons.save_success'));
this.search();
});