fix(测试计划): 更新测试计划不生效问题

This commit is contained in:
WangXu10 2024-06-14 13:45:49 +08:00 committed by 刘瑞斌
parent 38975938aa
commit 796294ca3e
4 changed files with 7 additions and 7 deletions

View File

@ -51,5 +51,5 @@ public class TestPlanUpdateRequest {
private Double passThreshold; private Double passThreshold;
@Schema(description = "测试计划组Id") @Schema(description = "测试计划组Id")
private String testPlanGroupId = TestPlanConstants.TEST_PLAN_DEFAULT_GROUP_ID; private String groupId = TestPlanConstants.TEST_PLAN_DEFAULT_GROUP_ID;
} }

View File

@ -321,7 +321,7 @@ public class TestPlanService extends TestPlanBaseUtilsService {
public TestPlan update(TestPlanUpdateRequest request, String userId, String requestUrl, String requestMethod) { public TestPlan update(TestPlanUpdateRequest request, String userId, String requestUrl, String requestMethod) {
this.checkTestPlanNotArchived(request.getId()); this.checkTestPlanNotArchived(request.getId());
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getId()); TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getId());
if (!ObjectUtils.allNull(request.getName(), request.getModuleId(), request.getTags(), request.getPlannedEndTime(), request.getPlannedStartTime(), request.getDescription(), request.getTestPlanGroupId())) { if (!ObjectUtils.allNull(request.getName(), request.getModuleId(), request.getTags(), request.getPlannedEndTime(), request.getPlannedStartTime(), request.getDescription(), request.getGroupId())) {
TestPlan updateTestPlan = new TestPlan(); TestPlan updateTestPlan = new TestPlan();
updateTestPlan.setId(request.getId()); updateTestPlan.setId(request.getId());
if (StringUtils.isNotBlank(request.getModuleId())) { if (StringUtils.isNotBlank(request.getModuleId())) {
@ -341,7 +341,7 @@ public class TestPlanService extends TestPlanBaseUtilsService {
updateTestPlan.setPlannedStartTime(request.getPlannedStartTime()); updateTestPlan.setPlannedStartTime(request.getPlannedStartTime());
updateTestPlan.setPlannedEndTime(request.getPlannedEndTime()); updateTestPlan.setPlannedEndTime(request.getPlannedEndTime());
updateTestPlan.setDescription(request.getDescription()); updateTestPlan.setDescription(request.getDescription());
updateTestPlan.setGroupId(request.getTestPlanGroupId()); updateTestPlan.setGroupId(request.getGroupId());
updateTestPlan.setType(testPlan.getType()); updateTestPlan.setType(testPlan.getType());
testPlanMapper.updateByPrimaryKeySelective(updateTestPlan); testPlanMapper.updateByPrimaryKeySelective(updateTestPlan);
} }

View File

@ -1164,11 +1164,11 @@ public class TestPlanTests extends BaseTest {
//修改a2节点下的数据91,92的所属测试计划组 //修改a2节点下的数据91,92的所属测试计划组
updateRequest = testPlanTestService.generateUpdateRequest(testPlanTestService.selectTestPlanByName("testPlan_91").getId()); updateRequest = testPlanTestService.generateUpdateRequest(testPlanTestService.selectTestPlanByName("testPlan_91").getId());
updateRequest.setTestPlanGroupId(groupTestPlanId7); updateRequest.setGroupId(groupTestPlanId7);
this.requestPostWithOk(URL_POST_TEST_PLAN_UPDATE, updateRequest); this.requestPostWithOk(URL_POST_TEST_PLAN_UPDATE, updateRequest);
a2NodeCount--; a2NodeCount--;
updateRequest = testPlanTestService.generateUpdateRequest(testPlanTestService.selectTestPlanByName("testPlan_92").getId()); updateRequest = testPlanTestService.generateUpdateRequest(testPlanTestService.selectTestPlanByName("testPlan_92").getId());
updateRequest.setTestPlanGroupId(groupTestPlanId7); updateRequest.setGroupId(groupTestPlanId7);
this.requestPostWithOk(URL_POST_TEST_PLAN_UPDATE, updateRequest); this.requestPostWithOk(URL_POST_TEST_PLAN_UPDATE, updateRequest);
a2NodeCount--; a2NodeCount--;

View File

@ -299,8 +299,8 @@ public class TestPlanTestService {
} }
} }
if (updateRequest.getTestPlanGroupId() != null) { if (updateRequest.getGroupId() != null) {
Assertions.assertEquals(newTestPlan.getGroupId(), updateRequest.getTestPlanGroupId()); Assertions.assertEquals(newTestPlan.getGroupId(), updateRequest.getGroupId());
} else { } else {
Assertions.assertEquals(newTestPlan.getGroupId(), testPlan.getGroupId()); Assertions.assertEquals(newTestPlan.getGroupId(), testPlan.getGroupId());
} }