feat(接口自动化): 修复部分缺陷

This commit is contained in:
fit2-zhao 2021-01-12 14:51:15 +08:00
parent 86b19b68fc
commit a1eac0996f
4 changed files with 77 additions and 72 deletions

View File

@ -24,7 +24,7 @@ import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.apache.commons.collections.CollectionUtils;
import javax.annotation.Resource;
import java.util.*;
@ -214,9 +214,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
request.setUpdateTime(System.currentTimeMillis());
checkApiModuleExist(request);
List<ApiDefinitionResult> apiDefinitionResults = queryByModuleIds(request.getNodeIds());
if (CollectionUtils.isNotEmpty(apiDefinitionResults)) {
apiDefinitionResults.forEach(apiDefinition -> {
if (StringUtils.isNotBlank(apiDefinition.getModulePath())) {
if (apiDefinition != null && StringUtils.isNotBlank(apiDefinition.getModulePath())) {
StringBuilder path = new StringBuilder(apiDefinition.getModulePath());
List<String> pathLists = Arrays.asList(path.toString().split("/"));
pathLists.set(request.getLevel(), request.getName());
@ -227,9 +227,8 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
apiDefinition.setModulePath(path.toString());
}
});
batchUpdateApiDefinition(apiDefinitionResults);
}
return apiModuleMapper.updateByPrimaryKeySelective(request);
}

View File

@ -62,7 +62,6 @@ export default {
this.validateApi();
if (this.validated) {
this.basisData.request = this.request;
console.log(this.basisData)
if (this.basisData.tags instanceof Array) {
this.basisData.tags = JSON.stringify(this.basisData.tags);
}
@ -73,6 +72,9 @@ export default {
this.validateApi();
if (this.validated) {
this.basisData.request = this.request;
if (this.basisData.tags instanceof Array) {
this.basisData.tags = JSON.stringify(this.basisData.tags);
}
this.$emit('runTest', this.basisData);
}
},

View File

@ -71,6 +71,10 @@ export default {
this.validateApi();
if (this.validated) {
this.basisData.request = this.request;
this.basisData.method = this.basisData.protocol;
if (this.basisData.tags instanceof Array) {
this.basisData.tags = JSON.stringify(this.basisData.tags);
}
this.$emit('runTest', this.basisData);
}
},

View File

@ -3,7 +3,7 @@
<el-row>
<el-col :span="21" style="padding-bottom: 20px">
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100% ;margin: 10px">
<el-form class="tcp" :model="request" :rules="rules" ref="request" label-width="auto" :disabled="isReadOnly" style="margin: 20px">
<el-form class="tcp" :model="request" :rules="rules" ref="request" :disabled="isReadOnly" style="margin: 20px">
<el-tabs v-model="activeName" class="request-tabs">