fix: 编辑用例点击关联缺陷缺少数据

This commit is contained in:
chenjianxing 2021-07-07 13:52:24 +08:00 committed by jianxing
parent 0089fd34dd
commit f4537b5bbc
5 changed files with 15 additions and 6 deletions

View File

@ -25,13 +25,13 @@
</select>
<select id="getRelateIssues" resultType="io.metersphere.base.domain.IssuesDao">
select issues.id, issues.num, issues.title, issues.project_id, issues.create_time, issues.update_time,
issues.description, issues.status, issues.platform, issues.custom_fields,
issues.description, issues.status, issues.platform, issues.custom_fields,test_case_issues.test_case_id,
issues.lastmodify
from issues
left join
test_case_issues on issues.id = test_case_issues.issues_id
<include refid="queryWhereCondition"/>
and test_case_issues.issues_id is null
and (test_case_issues.test_case_id is null or test_case_issues.test_case_id != #{request.caseId})
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
<select id="getIssueForSync" resultType="io.metersphere.base.domain.IssuesDao">

View File

@ -76,6 +76,11 @@ public class IssuesController {
issuesService.deleteIssue(request);
}
@PostMapping("/delete/relate")
public void deleteRelate(@RequestBody IssuesRequest request) {
issuesService.deleteIssueRelate(request);
}
@GetMapping("/delete/{id}")
@MsAuditLog(module = "track_bug", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = IssuesService.class)
public void delete(@PathVariable String id) {

View File

@ -287,10 +287,13 @@ public class IssuesService {
}
public void deleteIssue(IssuesRequest request) {
issuesMapper.deleteByPrimaryKey(request.getId());
deleteIssueRelate(request);
}
public void deleteIssueRelate(IssuesRequest request) {
String caseId = request.getCaseId();
String id = request.getId();
issuesMapper.deleteByPrimaryKey(id);
TestCaseIssuesExample example = new TestCaseIssuesExample();
example.createCriteria().andTestCaseIdEqualTo(caseId).andIssuesIdEqualTo(id);
testCaseIssuesMapper.deleteByExample(example);

View File

@ -87,6 +87,7 @@ export default {
},
getIssues() {
this.page.condition.projectId = this.projectId;
this.page.condition.caseId = this.caseId;
this.page.result = getRelateIssues(this.page);
},
save() {

View File

@ -53,7 +53,7 @@
@click="closeIssue(scope.row)"
/>
</el-tooltip>
<el-tooltip :content="$t('test_track.issue.delete')"
<el-tooltip :content="$t('test_track.case.unlink')"
placement="top" :enterable="false">
<el-button type="danger" icon="el-icon-delete" size="mini"
circle :disabled="scope.row.platform !== 'Local'"
@ -127,7 +127,7 @@ export default {
}
},
deleteIssue(row) {
this.page.result = this.$post("/issues/delete", {id: row.id, caseId: this.caseId}, () => {
this.page.result = this.$post("/issues/delete/relate", {id: row.id, caseId: this.caseId}, () => {
this.getIssues();
this.$success(this.$t('commons.delete_success'));
})