fix:接口自动化-废弃的用例在原来模块下-查看 回收站 后又都跑到回收站里面了-刷新页面 又恢复到 原来模块中。

This commit is contained in:
wenyann 2021-06-25 17:46:41 +08:00 committed by 刘瑞斌
parent 9c63bdceab
commit 42925f16dd
9 changed files with 59 additions and 22 deletions

View File

@ -57,6 +57,11 @@ public class ApiAutomationController {
return apiAutomationService.listAll(request);
}
@PostMapping("/list/all/trash")
public int listAllTrash(@RequestBody ApiScenarioBatchRequest request) {
return apiAutomationService.listAllTrash(request);
}
@PostMapping("/listWithIds/all")
@RequiresPermissions("PROJECT_API_SCENARIO:READ")
public List<ApiScenarioWithBLOBs> listWithIds(@RequestBody ApiScenarioBatchRequest request) {

View File

@ -157,6 +157,10 @@ public class ApiAutomationService {
return list;
}
public int listAllTrash(ApiScenarioBatchRequest request) {
return extApiScenarioMapper.selectTrash(request.getProjectId());
}
public List<String> idAll(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));

View File

@ -17,11 +17,14 @@ public interface ExtApiScenarioMapper {
int listModule(@Param("request") ApiScenarioRequest request);
List<ApiScenarioDTO> listReview(@Param("request") ApiScenarioRequest request);
List<ApiScenarioWithBLOBs> selectByTagId(@Param("id") String id);
List<ApiScenarioWithBLOBs> selectIds(@Param("ids") List<String> ids);
List<ApiScenarioWithBLOBs> selectByIds(@Param("ids") String ids,@Param("oderId") String oderId);
int selectTrash(@Param("projectId") String projectId);
List<ApiScenarioWithBLOBs> selectByIds(@Param("ids") String ids, @Param("oderId") String oderId);
List<ApiScenario> selectReference(@Param("request") ApiScenarioRequest request);

View File

@ -395,6 +395,12 @@
from api_scenario
WHERE use_url IS NULL
</select>
<select id="selectTrash" resultType="java.lang.Integer">
select count(1)
from api_scenario
where project_id = #{projectId}
and status = 'Trash'
</select>
<sql id="queryWhereConditionReview">
<where>
<if test="request.combine != null">

View File

@ -8,6 +8,7 @@ import io.metersphere.base.domain.TestPlanTestCase;
import io.metersphere.base.domain.TestPlanTestCaseWithBLOBs;
import io.metersphere.track.service.IssuesService;
import io.metersphere.track.service.TestPlanTestCaseService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -20,20 +21,20 @@ public class IssuesJob {
@Resource
private TestPlanTestCaseService testPlanTestCaseService;
@QuartzScheduled(fixedDelay = 3600 * 1000)
//@Scheduled(fixedDelay = 3600 * 1000)
//@QuartzScheduled(fixedDelay = 3600 * 1000)
@Scheduled(fixedDelay = 120 * 1000)
public void IssuesCount() {
int pageSize = 20;
int pages = 1;
for (int i = 0; i < pages; i++) {
Page<List<TestPlanTestCase>> page = PageHelper.startPage(i, pageSize, true);
pages = page.getPages();
List<TestPlanTestCaseWithBLOBs> list = testPlanTestCaseService.listAll();
list.forEach(l -> {
List<IssuesDao> issues = issuesService.getIssues(l.getCaseId());
int issuesCount = issues.size();
testPlanTestCaseService.updateIssues(issuesCount, l.getPlanId(), l.getCaseId(), issues.toString());
});
}
/*int pageSize = 100;
int pages = 0;
Page<List<TestPlanTestCase>> page = PageHelper.startPage(pages, pageSize, true);
pages = page.getPages();
for (int i = 0; i < pages; i++) {*/
List<TestPlanTestCaseWithBLOBs> list = testPlanTestCaseService.listAll();
list.forEach(l -> {
List<IssuesDao> issues = issuesService.getIssues(l.getCaseId());
int issuesCount = issues.size();
testPlanTestCaseService.updateIssues(issuesCount, l.getPlanId(), l.getCaseId(), issues.toString());
});
}
}
}

View File

@ -14,6 +14,7 @@
@refreshAll="refreshAll"
page-source="scenario"
:type="'edit'"
:total='total'
ref="nodeTree"/>
</ms-aside-container>
@ -21,6 +22,7 @@
<el-tabs v-model="activeName" @tab-click="addTab" @tab-remove="removeTab">
<el-tab-pane name="default" :label="$t('api_test.automation.scenario_list')">
<ms-api-scenario-list
@getTrashCase="getTrashCase"
@refreshTree="refreshTree"
:module-tree="nodeTree"
:module-options="moduleOptions"
@ -112,6 +114,7 @@ export default {
},
data() {
return {
total: 0,
redirectID: '',
renderComponent: true,
isHide: true,
@ -132,6 +135,7 @@ export default {
},
mounted() {
this.getProject();
this.getTrashCase();
},
watch: {
redirectID() {
@ -361,6 +365,14 @@ export default {
this.activeName = "default";
this.initApiTableOpretion = "enableTrash";
this.trashEnable = data;
this.getTrashCase();
},
getTrashCase() {
let param = {};
param.projectId = this.projectId;
this.$post("/api/automation/list/all/trash", param, response => {
this.total = response.data;
});
},
getProject() {
this.$get("/project/get/" + this.projectId, result => {
@ -370,7 +382,7 @@ export default {
}
});
},
updateInitApiTableOpretion(param){
updateInitApiTableOpretion(param) {
this.initApiTableOpretion = param;
}
}

View File

@ -512,6 +512,7 @@ export default {
if (this.$refs.scenarioTable) {
this.$refs.scenarioTable.clear();
}
this.$emit('getTrashCase');
});
}
},

View File

@ -25,7 +25,7 @@
:show-operator="showOperator"
:condition="condition"
:commands="operators"/>
<module-trash-button v-if="!isReadOnly" :condition="condition" :exe="enableTrash"/>
<module-trash-button v-if="!isReadOnly" :condition="condition" :exe="enableTrash" :total='total'/>
</template>
</ms-node-tree>
@ -64,13 +64,14 @@
isReadOnly: {
type: Boolean,
default() {
return false
return false;
}
},
showOperator: Boolean,
relevanceProjectId: String,
planId: String,
pageSource:String,
pageSource: String,
total: Number,
},
computed: {
isPlanModel() {

View File

@ -1,6 +1,9 @@
<template>
<div @click="exe" class="recycle" :class="{'is-active': condition.trashEnable}">
<i class="el-icon-delete"> 回收站</i>
<el-row>
<el-col :span="21"><i class="el-icon-delete"> 回收站</i></el-col>
<el-col :span="3"><span style="color: #6C317C">{{ total }}</span></el-col>
</el-row>
</div>
</template>
@ -11,12 +14,13 @@
condition: {
type: Object,
default() {
return {}
return {};
}
},
exe: {
type: Function
},
total: Number,
},
methods: {
// enableTrash() {