提交 dfd6aaee 编写于 作者: C chenjianxing

自动更新测试计划状态

上级 a7a50868
......@@ -21,4 +21,6 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> getRecentTestedTestCase(@Param("request") QueryTestPlanCaseRequest request);
List<TestPlanCaseDTO> getPendingTestCases(@Param("request") QueryTestPlanCaseRequest request);
List<String> getStatusByPlanId(String planId);
}
......@@ -93,4 +93,9 @@
</foreach>
order by test_plan_test_case.update_time asc
</select>
<select id="getStatusByPlanId" resultType="java.lang.String">
select status
from test_plan_test_case
where plan_id = #{planId}
</select>
</mapper>
\ No newline at end of file
......@@ -70,6 +70,12 @@ public class TestPlanController {
testPlanService.editTestPlan(testPlan);
}
@PostMapping("/edit/status/{planId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editTestPlanStatus(@PathVariable String planId){
testPlanService.editTestPlanStatus(planId);
}
@PostMapping("/delete/{testPlanId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public int deleteTestPlan(@PathVariable String testPlanId){
......
......@@ -144,7 +144,8 @@ public class TestPlanService {
sqlSession.flushStatements();
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
if (StringUtils.equals(testPlan.getStatus(), TestPlanStatus.Prepare.name())) {
if (StringUtils.equals(testPlan.getStatus(), TestPlanStatus.Prepare.name())
|| StringUtils.equals(testPlan.getStatus(), TestPlanStatus.Completed.name())) {
testPlan.setStatus(TestPlanStatus.Underway.name());
testPlanMapper.updateByPrimaryKey(testPlan);
}
......@@ -344,4 +345,21 @@ public class TestPlanService {
example.createCriteria().andIdIn(planIds);
return testPlanMapper.selectByExample(example);
}
public void editTestPlanStatus(String planId) {
List<String> statusList = extTestPlanTestCaseMapper.getStatusByPlanId(planId);
TestPlan testPlan = new TestPlan();
testPlan.setId(planId);
for (String status: statusList){
if (StringUtils.equals(status, TestPlanTestCaseStatus.Prepare.name())
|| StringUtils.equals(status, TestPlanTestCaseStatus.Underway.name())) {
testPlan.setStatus(TestPlanStatus.Underway.name());
testPlanMapper.updateByPrimaryKeySelective(testPlan);
return;
}
}
testPlan.setStatus(TestPlanStatus.Completed.name());
testPlanMapper.updateByPrimaryKeySelective(testPlan);
}
}
......@@ -43,7 +43,7 @@
<el-option
v-for="item in maintainerOptions"
:key="item.id"
:label="item.name"
:label="item.id + ' (' + item.name + ')'"
:value="item.id">
</el-option>
</el-select>
......
......@@ -34,6 +34,9 @@
props: {
selectIds: {
type: Set
},
planId: {
type: String
}
},
methods: {
......@@ -51,6 +54,7 @@
this.$post('/test/plan/case/batch/edit' , param, () => {
this.selectIds.clear();
this.status = '';
this.$post('/test/plan/edit/status/' + this.planId);
this.$success(this.$t('commons.save_success'));
this.statusEditVisible = false;
this.$emit('refresh');
......
......@@ -239,6 +239,7 @@
param.issues = JSON.stringify(this.testCase.issues);
this.$post('/test/plan/case/edit', param, () => {
this.$success(this.$t('commons.save_success'));
this.setPlanStatus(this.testCase.planId);
});
},
handleNext() {
......@@ -309,6 +310,9 @@
},
addPLabel(str) {
return "<p>" + str + "</p>";
},
setPlanStatus(planId) {
this.$post('/test/plan/edit/status/' + planId);
}
}
}
......
......@@ -20,7 +20,7 @@
</template>
<executor-edit ref="executorEdit" :select-ids="selectIds" @refresh="initTableData"/>
<status-edit ref="statusEdit" :select-ids="selectIds" @refresh="initTableData"/>
<status-edit ref="statusEdit" :plan-id="planId" :select-ids="selectIds" @refresh="initTableData"/>
<el-table
@select-all="handleSelectAll"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册