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

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

View File

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

View File

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

View File

@ -17,11 +17,14 @@ public interface ExtApiScenarioMapper {
int listModule(@Param("request") ApiScenarioRequest request); int listModule(@Param("request") ApiScenarioRequest request);
List<ApiScenarioDTO> listReview(@Param("request") ApiScenarioRequest request); List<ApiScenarioDTO> listReview(@Param("request") ApiScenarioRequest request);
List<ApiScenarioWithBLOBs> selectByTagId(@Param("id") String id); List<ApiScenarioWithBLOBs> selectByTagId(@Param("id") String id);
List<ApiScenarioWithBLOBs> selectIds(@Param("ids") List<String> ids); 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); List<ApiScenario> selectReference(@Param("request") ApiScenarioRequest request);

View File

@ -395,6 +395,12 @@
from api_scenario from api_scenario
WHERE use_url IS NULL WHERE use_url IS NULL
</select> </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"> <sql id="queryWhereConditionReview">
<where> <where>
<if test="request.combine != null"> <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.base.domain.TestPlanTestCaseWithBLOBs;
import io.metersphere.track.service.IssuesService; import io.metersphere.track.service.IssuesService;
import io.metersphere.track.service.TestPlanTestCaseService; import io.metersphere.track.service.TestPlanTestCaseService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -20,14 +21,14 @@ public class IssuesJob {
@Resource @Resource
private TestPlanTestCaseService testPlanTestCaseService; private TestPlanTestCaseService testPlanTestCaseService;
@QuartzScheduled(fixedDelay = 3600 * 1000) //@QuartzScheduled(fixedDelay = 3600 * 1000)
//@Scheduled(fixedDelay = 3600 * 1000) @Scheduled(fixedDelay = 120 * 1000)
public void IssuesCount() { public void IssuesCount() {
int pageSize = 20; /*int pageSize = 100;
int pages = 1; int pages = 0;
for (int i = 0; i < pages; i++) { Page<List<TestPlanTestCase>> page = PageHelper.startPage(pages, pageSize, true);
Page<List<TestPlanTestCase>> page = PageHelper.startPage(i, pageSize, true);
pages = page.getPages(); pages = page.getPages();
for (int i = 0; i < pages; i++) {*/
List<TestPlanTestCaseWithBLOBs> list = testPlanTestCaseService.listAll(); List<TestPlanTestCaseWithBLOBs> list = testPlanTestCaseService.listAll();
list.forEach(l -> { list.forEach(l -> {
List<IssuesDao> issues = issuesService.getIssues(l.getCaseId()); List<IssuesDao> issues = issuesService.getIssues(l.getCaseId());
@ -36,4 +37,4 @@ public class IssuesJob {
}); });
} }
} }
}

View File

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

View File

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

View File

@ -25,7 +25,7 @@
:show-operator="showOperator" :show-operator="showOperator"
:condition="condition" :condition="condition"
:commands="operators"/> :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> </template>
</ms-node-tree> </ms-node-tree>
@ -64,13 +64,14 @@
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default() { default() {
return false return false;
} }
}, },
showOperator: Boolean, showOperator: Boolean,
relevanceProjectId: String, relevanceProjectId: String,
planId: String, planId: String,
pageSource:String, pageSource: String,
total: Number,
}, },
computed: { computed: {
isPlanModel() { isPlanModel() {

View File

@ -1,6 +1,9 @@
<template> <template>
<div @click="exe" class="recycle" :class="{'is-active': condition.trashEnable}"> <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> </div>
</template> </template>
@ -11,12 +14,13 @@
condition: { condition: {
type: Object, type: Object,
default() { default() {
return {} return {};
} }
}, },
exe: { exe: {
type: Function type: Function
}, },
total: Number,
}, },
methods: { methods: {
// enableTrash() { // enableTrash() {