update:增加test_plan表插入新增实际字段的逻辑

This commit is contained in:
xuxm 2020-09-18 14:24:40 +08:00 committed by wenyann
parent 96dc485e77
commit 399df44978
1 changed files with 16 additions and 3 deletions

View File

@ -95,6 +95,10 @@ public class TestPlanService {
testPlan.setId(testPlanId);
testPlan.setStatus(TestPlanStatus.Prepare.name());
testPlan.setPlannedStartTime(System.currentTimeMillis());
testPlan.setPlannedEndTime(System.currentTimeMillis());
testPlan.setActualStartTime(System.currentTimeMillis());
testPlan.setActualEndTime(System.currentTimeMillis());
testPlan.setCreateTime(System.currentTimeMillis());
testPlan.setUpdateTime(System.currentTimeMillis());
testPlanMapper.insert(testPlan);
@ -111,11 +115,20 @@ public class TestPlanService {
return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan());
}
public int editTestPlan(TestPlanDTO testPlan) {
editTestPlanProject(testPlan);
public int editTestPlan(TestPlan testPlan) {
testPlan.setUpdateTime(System.currentTimeMillis());
checkTestPlanExist(testPlan);
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
//进行中状态写入实际开始时间
if ("Underway".equals(testPlan.getStatus())) {
testPlan.setActualStartTime(System.currentTimeMillis());
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
} else if("Completed".equals(testPlan.getStatus())){
//已完成写入实际完成时间
testPlan.setActualEndTime(System.currentTimeMillis());
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
} else {
return 0;
}
}
private void editTestPlanProject(TestPlanDTO testPlan) {