refactor(接口定义): 修复删除模块时接口不会进入回收站的缺陷,修复接口案例删除时没有删除人删除时间的缺陷
--bug=1005171 --user=宋天阳 【接口测试-接口自动化】回收站删除时间和删除人没有数据,--bug=1005174 --user=宋天阳 【接口定义】删除模块,模块下的接口定义没有进回收站 https://www.tapd.cn/55049933/s/1025694
This commit is contained in:
parent
e9df57709a
commit
5f2317da52
|
@ -1247,4 +1247,13 @@ public class ApiDefinitionService {
|
|||
public ApiDefinition selectUrlAndMethodById(String id) {
|
||||
return extApiDefinitionMapper.selectUrlAndMethodById(id);
|
||||
}
|
||||
|
||||
public void removeToGcByExample(ApiDefinitionExampleWithOperation apiDefinitionExample) {
|
||||
List<ApiDefinition> apiList = apiDefinitionMapper.selectByExample(apiDefinitionExample);
|
||||
List<String> apiIdList = new ArrayList<>();
|
||||
apiList.forEach(item -> {
|
||||
apiIdList.add(item.getId());
|
||||
});
|
||||
this.removeToGc(apiIdList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,7 +339,8 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
|||
apiDefinitionExample.createCriteria().andModuleIdIn(nodeIds);
|
||||
apiDefinitionExample.setOperator(SessionUtils.getUserId());
|
||||
apiDefinitionExample.setOperationTime(System.currentTimeMillis());
|
||||
extApiDefinitionMapper.removeToGcByExample(apiDefinitionExample); // 删除模块,则模块下的接口放入回收站
|
||||
apiDefinitionService.removeToGcByExample(apiDefinitionExample);
|
||||
// extApiDefinitionMapper.removeToGcByExample(apiDefinitionExample); // 删除模块,则模块下的接口放入回收站
|
||||
|
||||
ApiModuleExample apiDefinitionNodeExample = new ApiModuleExample();
|
||||
apiDefinitionNodeExample.createCriteria().andIdIn(nodeIds);
|
||||
|
|
|
@ -814,6 +814,7 @@ public class ApiTestCaseService {
|
|||
cannotReductionApiCaseList.stream().map(ApiTestCaseDTO::getId).collect(Collectors.toList());
|
||||
List<String> deleteIds = ids.stream().filter(id -> !cannotReductionCaseId.contains(id)).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(deleteIds)){
|
||||
extApiTestCaseMapper.checkOriginalStatusByIds(deleteIds);
|
||||
extApiTestCaseMapper.reduction(deleteIds);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public interface ExtApiTestCaseMapper {
|
|||
int deleteToGc(ApiTestCaseRequest request);
|
||||
|
||||
int reduction(@Param("ids") List<String> ids);
|
||||
void checkOriginalStatusByIds(@Param("ids") List<String> ids);
|
||||
|
||||
List<ApiTestCaseDTO> getCannotReductionApiCaseList(@Param("ids") List<String> ids);
|
||||
|
||||
|
|
|
@ -541,4 +541,13 @@
|
|||
#{v}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="checkOriginalStatusByIds">
|
||||
update api_test_case
|
||||
set
|
||||
original_status = 'Underway'
|
||||
where (original_status IS NULL OR original_status = 'Trash') AND id in
|
||||
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
@ -105,5 +105,5 @@ public interface ExtTestCaseMapper {
|
|||
int deleteToGc(@Param("request") TestCase testCase);
|
||||
int reduction(@Param("ids") List<String> ids);
|
||||
|
||||
void refreshOriginalStatusByIds(@Param("ids") List<String> ids);
|
||||
void checkOriginalStatusByIds(@Param("ids") List<String> ids);
|
||||
}
|
||||
|
|
|
@ -529,7 +529,7 @@
|
|||
#{v}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="refreshOriginalStatusByIds">
|
||||
<update id="checkOriginalStatusByIds">
|
||||
update test_case
|
||||
set
|
||||
original_status = 'Underway'
|
||||
|
|
|
@ -1512,7 +1512,7 @@ public class TestCaseService {
|
|||
public void reduction(TestCaseBatchRequest request) {
|
||||
TestCaseExample example = this.getBatchExample(request);
|
||||
if(CollectionUtils.isNotEmpty(request.getIds())){
|
||||
extTestCaseMapper.refreshOriginalStatusByIds(request.getIds());
|
||||
extTestCaseMapper.checkOriginalStatusByIds(request.getIds());
|
||||
extTestCaseMapper.reduction(request.getIds());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
:is-read-only="isReadOnly"
|
||||
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
||||
@handleCase="handleCase"
|
||||
@refreshTable="refresh"
|
||||
@showExecResult="showExecResult"
|
||||
ref="trashCaseList"/>
|
||||
</ms-tab-button>
|
||||
|
@ -369,6 +370,13 @@ export default {
|
|||
addTab(tab) {
|
||||
if (tab.name === 'add') {
|
||||
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug");
|
||||
}else if(tab.name === 'trash'){
|
||||
if(this.$refs.trashApiList){
|
||||
this.$refs.trashApiList.initTable();
|
||||
}
|
||||
if(this.$refs.trashCaseList){
|
||||
this.$refs.trashCaseList.initTable();
|
||||
}
|
||||
}
|
||||
if (this.$refs.apiConfig) {
|
||||
this.$refs.apiConfig.forEach(item => {
|
||||
|
@ -522,7 +530,7 @@ export default {
|
|||
this.$refs.nodeTree.list();
|
||||
},
|
||||
refresh(data) {
|
||||
if(this.$refs.caseList){
|
||||
if(this.$refs.caseList && this.$refs.caseList[0]){
|
||||
this.$refs.caseList[0].initTable();
|
||||
}
|
||||
if(this.$refs.trashApiList){
|
||||
|
@ -531,7 +539,7 @@ export default {
|
|||
if(this.$refs.trashCaseList){
|
||||
this.$refs.trashCaseList.initTable();
|
||||
}
|
||||
if(this.$refs.apiDefList){
|
||||
if(this.$refs.apiDefList && this.$refs.apiDefList[0]){
|
||||
this.$refs.apiDefList[0].initTable();
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,9 @@
|
|||
this.$refs.environmentSelect.refreshEnvironment();
|
||||
},
|
||||
setEnvironment(data) {
|
||||
this.$emit('setEnvironment', data.id);
|
||||
if(data){
|
||||
this.$emit('setEnvironment', data.id);
|
||||
}
|
||||
},
|
||||
search() {
|
||||
if (this.priorities && this.condition.order) {
|
||||
|
|
|
@ -560,9 +560,9 @@ export default {
|
|||
obj.ids = Array.from(this.selectRows).map(row => row.id);
|
||||
obj = Object.assign(obj, this.condition);
|
||||
this.$post('/api/testcase/deleteToGcByParam/', obj, () => {
|
||||
// this.$emit('refreshTable');
|
||||
this.$refs.caseTable.clearSelectRows();
|
||||
// this.initTable();
|
||||
this.$emit('refreshTable');
|
||||
this.initTable();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
});
|
||||
}
|
||||
|
@ -617,14 +617,14 @@ export default {
|
|||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.$get('/api/testcase/deleteToGc/' + apiCase.id, () => {
|
||||
// this.$emit('refreshTable');
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
// this.initTable();
|
||||
this.$emit('refreshTable');
|
||||
this.initTable();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
},
|
||||
reduction(row) {
|
||||
let tmp = JSON.parse(JSON.stringify(row));
|
||||
|
|
|
@ -436,12 +436,14 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
selectNodeIds() {
|
||||
initCondition(this.condition, false);
|
||||
this.currentPage = 1;
|
||||
this.condition.moduleIds = [];
|
||||
this.condition.moduleIds.push(this.selectNodeIds);
|
||||
this.closeCaseModel();
|
||||
this.initTable();
|
||||
if(!this.trashEnable){
|
||||
initCondition(this.condition, false);
|
||||
this.currentPage = 1;
|
||||
this.condition.moduleIds = [];
|
||||
this.condition.moduleIds.push(this.selectNodeIds);
|
||||
this.closeCaseModel();
|
||||
this.initTable();
|
||||
}
|
||||
},
|
||||
currentProtocol() {
|
||||
this.currentPage = 1;
|
||||
|
@ -488,7 +490,9 @@ export default {
|
|||
|
||||
initCondition(this.condition, this.condition.selectAll);
|
||||
this.selectDataCounts = 0;
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
if(!this.trashEnable){
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
}
|
||||
this.condition.projectId = this.projectId;
|
||||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
|
|
Loading…
Reference in New Issue