feat(测试跟踪): 功能用例删除增加删除当前版本和全部版本
This commit is contained in:
parent
bf141bfbce
commit
baf498e452
|
@ -227,7 +227,7 @@
|
||||||
test_case.other_test_name, test_case.review_status, test_case.tags,
|
test_case.other_test_name, test_case.review_status, test_case.tags,
|
||||||
test_case.demand_id, test_case.demand_name, test_case.`status`,
|
test_case.demand_id, test_case.demand_name, test_case.`status`,
|
||||||
test_case.custom_num, test_case.step_model, test_case.create_user,u.name as createName,
|
test_case.custom_num, test_case.step_model, test_case.create_user,u.name as createName,
|
||||||
test_case.custom_fields, project.name as projectName
|
test_case.custom_fields, project.name as projectName , test_case.ref_id
|
||||||
</if>
|
</if>
|
||||||
from test_case left join user u on test_case.create_user=u.id
|
from test_case left join user u on test_case.create_user=u.id
|
||||||
left join user deleteUser on test_case.delete_user_id=deleteUser.id
|
left join user deleteUser on test_case.delete_user_id=deleteUser.id
|
||||||
|
@ -870,7 +870,14 @@
|
||||||
<update id="deletePublic">
|
<update id="deletePublic">
|
||||||
update test_case
|
update test_case
|
||||||
set case_public = false
|
set case_public = false
|
||||||
where ref_id = #{request.refId}
|
<where>
|
||||||
|
<if test="request.refId != null">
|
||||||
|
ref_id =#{request.refId}
|
||||||
|
</if>
|
||||||
|
<if test="request.versionId != null">
|
||||||
|
and version_id =#{request.versionId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="reduction">
|
<update id="reduction">
|
||||||
|
|
|
@ -256,12 +256,12 @@ public class TestCaseController {
|
||||||
return testCaseService.deleteTestCaseToGc(testCaseId);
|
return testCaseService.deleteTestCaseToGc(testCaseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/deletePublic/{refId}")
|
@GetMapping("/deletePublic/{versionId}/{refId}")
|
||||||
@MsAuditLog(module = "track_test_case", type = OperLogConstants.GC, beforeEvent = "#msClass.getLogDetails(#testCaseId)", msClass = TestCaseService.class)
|
@MsAuditLog(module = "track_test_case", type = OperLogConstants.GC, beforeEvent = "#msClass.getLogDetails(#testCaseId)", msClass = TestCaseService.class)
|
||||||
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, event = NoticeConstants.Event.DELETE, target = "#targetClass.getTestCase(#testCaseId)", targetClass = TestCaseService.class,
|
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, event = NoticeConstants.Event.DELETE, target = "#targetClass.getTestCase(#testCaseId)", targetClass = TestCaseService.class,
|
||||||
mailTemplate = "track/TestCaseDelete", subject = "测试用例通知")
|
mailTemplate = "track/TestCaseDelete", subject = "测试用例通知")
|
||||||
public int deletePublic(@PathVariable String refId) {
|
public void deletePublic(@PathVariable String versionId, @PathVariable String refId) {
|
||||||
return testCaseService.deleteTestCasePublic(refId);
|
testCaseService.deleteTestCasePublic(versionId ,refId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -356,8 +356,8 @@ public class TestCaseController {
|
||||||
@MsAuditLog(module = "track_test_case", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestCaseService.class)
|
@MsAuditLog(module = "track_test_case", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestCaseService.class)
|
||||||
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.findByBatchRequest(#request)", targetClass = TestCaseService.class,
|
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.findByBatchRequest(#request)", targetClass = TestCaseService.class,
|
||||||
event = NoticeConstants.Event.DELETE, mailTemplate = "track/TestCaseDelete", subject = "测试用例通知")
|
event = NoticeConstants.Event.DELETE, mailTemplate = "track/TestCaseDelete", subject = "测试用例通知")
|
||||||
public void deleteToGcBatchPublic(@RequestBody TestCaseBatchRequest request) {
|
public void deleteToGcBatchPublic(@RequestBody List<String> ids) {
|
||||||
testCaseService.deleteToGcBatchPublic(request.getIds());
|
testCaseService.deleteToGcBatchPublic(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/reduction")
|
@PostMapping("/reduction")
|
||||||
|
|
|
@ -2144,9 +2144,9 @@ public class TestCaseService {
|
||||||
if (CollectionUtils.isNotEmpty(ids)) {
|
if (CollectionUtils.isNotEmpty(ids)) {
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
TestCase testCase = testCaseMapper.selectByPrimaryKey(id);
|
TestCase testCase = testCaseMapper.selectByPrimaryKey(id);
|
||||||
if ((StringUtils.isNotEmpty(testCase.getMaintainer()) && testCase.getMaintainer() == SessionUtils.getUserId()) ||
|
if ((StringUtils.isNotEmpty(testCase.getMaintainer()) && testCase.getMaintainer().equals(SessionUtils.getUserId())) ||
|
||||||
(StringUtils.isNotEmpty(testCase.getCreateUser()) && testCase.getCreateUser() == SessionUtils.getUserId())) {
|
(StringUtils.isNotEmpty(testCase.getCreateUser()) && testCase.getCreateUser().equals(SessionUtils.getUserId()))) {
|
||||||
this.deleteTestCasePublic(testCase.getRefId());
|
this.deleteTestCasePublic(null , testCase.getRefId());
|
||||||
} else {
|
} else {
|
||||||
MSException.throwException(Translator.get("check_owner_case"));
|
MSException.throwException(Translator.get("check_owner_case"));
|
||||||
}
|
}
|
||||||
|
@ -2438,10 +2438,11 @@ public class TestCaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deleteTestCasePublic(String refId) {
|
public void deleteTestCasePublic(String versionId , String refId) {
|
||||||
TestCase testCase = new TestCase();
|
TestCase testCase = new TestCase();
|
||||||
testCase.setRefId(refId);
|
testCase.setRefId(refId);
|
||||||
return extTestCaseMapper.deletePublic(testCase);
|
testCase.setVersionId(versionId);
|
||||||
|
extTestCaseMapper.deletePublic(testCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean hasOtherInfo(String caseId) {
|
public Boolean hasOtherInfo(String caseId) {
|
||||||
|
|
|
@ -226,6 +226,8 @@
|
||||||
|
|
||||||
<!--高级搜索-->
|
<!--高级搜索-->
|
||||||
<ms-table-adv-search-bar :condition.sync="condition" :showLink="false" ref="searchBar" @search="search"/>
|
<ms-table-adv-search-bar :condition.sync="condition" :showLink="false" ref="searchBar" @search="search"/>
|
||||||
|
<!-- 删除接口提示 -->
|
||||||
|
<api-delete-confirm ref="apiDeleteConfirm" @handleDelete="_handleDeleteVersion"/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
@ -276,7 +278,7 @@ import {editTestCaseOrder} from "@/network/testCase";
|
||||||
import {getGraphByCondition} from "@/network/graph";
|
import {getGraphByCondition} from "@/network/graph";
|
||||||
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
|
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
|
||||||
import {getUUID} from "@/common/js/utils";
|
import {getUUID} from "@/common/js/utils";
|
||||||
|
import ApiDeleteConfirm from "@/business/components/api/definition/components/list/ApiDeleteConfirm";
|
||||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComponent("./graph/RelationshipGraphDrawer.vue") : {};
|
const relationshipGraphDrawer = requireComponent.keys().length > 0 ? requireComponent("./graph/RelationshipGraphDrawer.vue") : {};
|
||||||
|
|
||||||
|
@ -308,6 +310,7 @@ export default {
|
||||||
ReviewStatus,
|
ReviewStatus,
|
||||||
MsTag, ApiStatus,
|
MsTag, ApiStatus,
|
||||||
"relationshipGraphDrawer": relationshipGraphDrawer.default,
|
"relationshipGraphDrawer": relationshipGraphDrawer.default,
|
||||||
|
ApiDeleteConfirm
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -891,18 +894,8 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleDeleteToGc(testCase) {
|
handleDeleteToGc(testCase) {
|
||||||
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "?", '', {
|
// 删除提供列表删除和全部版本删除
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
this.$refs.apiDeleteConfirm.open(testCase, this.$t('test_track.case.delete_confirm'));
|
||||||
callback: (action) => {
|
|
||||||
if (action === 'confirm') {
|
|
||||||
if (this.publicEnable) {
|
|
||||||
this._handleDeletePublic(testCase);
|
|
||||||
} else {
|
|
||||||
this._handleDeleteToGc(testCase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
batchReduction() {
|
batchReduction() {
|
||||||
let param = buildBatchParam(this, this.$refs.table.selectIds);
|
let param = buildBatchParam(this, this.$refs.table.selectIds);
|
||||||
|
@ -964,14 +957,6 @@ export default {
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$success(this.$t('commons.delete_success'));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_handleDeletePublic(testCase) {
|
|
||||||
let refId = testCase.refId;
|
|
||||||
this.$post('/test/case/deletePublic/' + refId, {}, () => {
|
|
||||||
this.$emit('refreshTable');
|
|
||||||
this.initTableData();
|
|
||||||
this.$success(this.$t('commons.delete_success'));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.$refs.table.clear();
|
this.$refs.table.clear();
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
|
@ -1097,8 +1082,8 @@ export default {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
callback: (action) => {
|
callback: (action) => {
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
let param = buildBatchParam(this, this.$refs.table.selectIds);
|
let ids = this.$refs.table.selectIds;
|
||||||
this.$post('/test/case/batch/movePublic/deleteToGc', param, () => {
|
this.$post('/test/case/batch/movePublic/deleteToGc', ids, () => {
|
||||||
this.$refs.table.clear();
|
this.$refs.table.clear();
|
||||||
this.$emit("refresh");
|
this.$emit("refresh");
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
@ -1115,6 +1100,42 @@ export default {
|
||||||
this.isMoveBatch = false;
|
this.isMoveBatch = false;
|
||||||
this.$refs.testBatchMove.open(this.treeNodes, this.$refs.table.selectIds, this.moduleOptions);
|
this.$refs.testBatchMove.open(this.treeNodes, this.$refs.table.selectIds, this.moduleOptions);
|
||||||
},
|
},
|
||||||
|
_handleDeleteVersion(testCase, deleteCurrentVersion) {
|
||||||
|
// 删除指定版本
|
||||||
|
if (deleteCurrentVersion) {
|
||||||
|
if (this.publicEnable) {
|
||||||
|
this.$get('/test/case/deletePublic/' + testCase.versionId + '/' + testCase.refId, () => {
|
||||||
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
this.$refs.apiDeleteConfirm.close();
|
||||||
|
this.$emit("refreshTable");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$get('/test/case/delete/' + testCase.versionId + '/' + testCase.refId, () => {
|
||||||
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
this.$refs.apiDeleteConfirm.close();
|
||||||
|
this.$emit("refreshTable");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 删除全部版本
|
||||||
|
else {
|
||||||
|
if (this.publicEnable) {
|
||||||
|
let ids = [testCase.id];
|
||||||
|
this.$post('/test/case/batch/movePublic/deleteToGc', ids, () => {
|
||||||
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
// this.initTable();
|
||||||
|
this.$refs.apiDeleteConfirm.close();
|
||||||
|
this.$emit("refreshTable");
|
||||||
|
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this._handleDeleteToGc(testCase);
|
||||||
|
this.$refs.apiDeleteConfirm.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
getMaintainerOptions() {
|
getMaintainerOptions() {
|
||||||
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
|
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
|
||||||
this.valueArr.maintainer = response.data;
|
this.valueArr.maintainer = response.data;
|
||||||
|
|
Loading…
Reference in New Issue