diff --git a/backend/src/main/java/io/metersphere/track/controller/IssuesController.java b/backend/src/main/java/io/metersphere/track/controller/IssuesController.java index babfa22a38..ad1b24553b 100644 --- a/backend/src/main/java/io/metersphere/track/controller/IssuesController.java +++ b/backend/src/main/java/io/metersphere/track/controller/IssuesController.java @@ -118,4 +118,9 @@ public class IssuesController { public void getPlatformIssue(@PathVariable String projectId) { issuesService.syncThirdPartyIssues(projectId); } + + @PostMapping("/change/status") + public void changeStatus(@RequestBody IssuesRequest request) { + issuesService.changeStatus(request); + } } diff --git a/backend/src/main/java/io/metersphere/track/request/testcase/IssuesRequest.java b/backend/src/main/java/io/metersphere/track/request/testcase/IssuesRequest.java index 520f771b41..eb0b2be41d 100644 --- a/backend/src/main/java/io/metersphere/track/request/testcase/IssuesRequest.java +++ b/backend/src/main/java/io/metersphere/track/request/testcase/IssuesRequest.java @@ -35,4 +35,5 @@ public class IssuesRequest extends BaseQueryRequest { private List testCaseIds; private String requestType; + private String status; } diff --git a/backend/src/main/java/io/metersphere/track/service/IssuesService.java b/backend/src/main/java/io/metersphere/track/service/IssuesService.java index 5bd1abee2c..83107450f6 100644 --- a/backend/src/main/java/io/metersphere/track/service/IssuesService.java +++ b/backend/src/main/java/io/metersphere/track/service/IssuesService.java @@ -1,6 +1,7 @@ package io.metersphere.track.service; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.*; @@ -32,6 +33,7 @@ import io.metersphere.track.issue.domain.zentao.ZentaoBuild; import io.metersphere.track.request.testcase.AuthUserIssueRequest; import io.metersphere.track.request.testcase.IssuesRequest; import io.metersphere.track.request.testcase.IssuesUpdateRequest; +import io.metersphere.track.request.testcase.TestCaseBatchRequest; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; @@ -557,4 +559,29 @@ public class IssuesService { issueRequest.setResourceId(planId); return extIssuesMapper.getIssues(issueRequest); } + + public void changeStatus(IssuesRequest request) { + String issuesId = request.getId(); + String status = request.getStatus(); + if (StringUtils.isBlank(issuesId) || StringUtils.isBlank(status)) { + return; + } + + IssuesWithBLOBs issues = issuesMapper.selectByPrimaryKey(issuesId); + String customFields = issues.getCustomFields(); + if (StringUtils.isBlank(customFields)) { + return; + } + + List fields = JSONObject.parseArray(customFields, TestCaseBatchRequest.CustomFiledRequest.class); + for (TestCaseBatchRequest.CustomFiledRequest field : fields) { + if (StringUtils.equals("状态", field.getName())) { + field.setValue(status); + break; + } + } + + issues.setCustomFields(JSONObject.toJSONString(fields)); + issuesMapper.updateByPrimaryKeySelective(issues); + } } diff --git a/frontend/src/business/components/track/case/components/TestCaseIssueRelate.vue b/frontend/src/business/components/track/case/components/TestCaseIssueRelate.vue index cbf80e71d4..3c4bc78056 100644 --- a/frontend/src/business/components/track/case/components/TestCaseIssueRelate.vue +++ b/frontend/src/business/components/track/case/components/TestCaseIssueRelate.vue @@ -12,25 +12,32 @@ v-loading="page.result.loading" :show-select-all="false" :data="page.data" + :fields.sync="fields" + :operators="operators" :enable-selection="false" + ref="table" @refresh="getIssues"> + + + + + - - - - - - - + +