feat(通用设置): 增加批量清空标签功能
This commit is contained in:
parent
994861ae7a
commit
e48c01a8aa
|
@ -27,6 +27,8 @@ public class ApiCaseBatchEditRequest extends ApiTestCaseBatchRequest implements
|
||||||
private String type;
|
private String type;
|
||||||
@Schema(description = "是否追加标签")
|
@Schema(description = "是否追加标签")
|
||||||
private boolean append = false;
|
private boolean append = false;
|
||||||
|
@Schema(description = "默认不清空所有标签")
|
||||||
|
private boolean clear = false;
|
||||||
@Schema(description = "环境id")
|
@Schema(description = "环境id")
|
||||||
@Size(max = 50, message = "{api_test_case.env_id.length_range}")
|
@Size(max = 50, message = "{api_test_case.env_id.length_range}")
|
||||||
private String environmentId;
|
private String environmentId;
|
||||||
|
|
|
@ -47,6 +47,9 @@ public class ApiDefinitionBatchUpdateRequest extends ApiDefinitionBatchRequest {
|
||||||
@Schema(description = "是否追加", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "是否追加", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private boolean append = false;
|
private boolean append = false;
|
||||||
|
|
||||||
|
@Schema(description = "是否清空")
|
||||||
|
private boolean clear = false;
|
||||||
|
|
||||||
public List<String> getTags() {
|
public List<String> getTags() {
|
||||||
if (tags == null) {
|
if (tags == null) {
|
||||||
return new ArrayList<>(0);
|
return new ArrayList<>(0);
|
||||||
|
|
|
@ -27,6 +27,8 @@ public class ApiMockBatchEditRequest extends ApiTestCaseBatchRequest implements
|
||||||
private String type;
|
private String type;
|
||||||
@Schema(description = "是否追加标签")
|
@Schema(description = "是否追加标签")
|
||||||
private boolean append = false;
|
private boolean append = false;
|
||||||
|
@Schema(description = "默认不清空所有标签")
|
||||||
|
private boolean clear = false;
|
||||||
@Schema(description = "状态 开启/关闭")
|
@Schema(description = "状态 开启/关闭")
|
||||||
private boolean enable;
|
private boolean enable;
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ public class ApiScenarioBatchEditRequest extends ApiScenarioBatchRequest impleme
|
||||||
private String type;
|
private String type;
|
||||||
@Schema(description = "默认覆盖原标签")
|
@Schema(description = "默认覆盖原标签")
|
||||||
private boolean append = false;
|
private boolean append = false;
|
||||||
|
@Schema(description = "默认不清空所有标签")
|
||||||
|
private boolean clear = false;
|
||||||
@Schema(description = "环境id")
|
@Schema(description = "环境id")
|
||||||
@Size(max = 50, message = "{api_test_case.environment_id.length_range}")
|
@Size(max = 50, message = "{api_test_case.environment_id.length_range}")
|
||||||
private String envId;
|
private String envId;
|
||||||
|
|
|
@ -449,7 +449,7 @@ public class ApiDefinitionMockService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateMock.setTags(ServiceUtils.parseTags(request.getTags()));
|
updateMock.setTags(request.isClear() ? new ArrayList<>() : ServiceUtils.parseTags(request.getTags()));
|
||||||
mapper.updateByExampleSelective(updateMock, example);
|
mapper.updateByExampleSelective(updateMock, example);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -651,7 +651,7 @@ public class ApiDefinitionService extends MoveNodeService {
|
||||||
} else {
|
} else {
|
||||||
//替换标签
|
//替换标签
|
||||||
ApiDefinition apiDefinition = new ApiDefinition();
|
ApiDefinition apiDefinition = new ApiDefinition();
|
||||||
apiDefinition.setTags(ServiceUtils.parseTags(request.getTags()));
|
apiDefinition.setTags(request.isClear() ? new ArrayList<>() : ServiceUtils.parseTags(request.getTags()));
|
||||||
apiDefinition.setProjectId(request.getProjectId());
|
apiDefinition.setProjectId(request.getProjectId());
|
||||||
apiDefinition.setUpdateTime(System.currentTimeMillis());
|
apiDefinition.setUpdateTime(System.currentTimeMillis());
|
||||||
apiDefinition.setUpdateUser(userId);
|
apiDefinition.setUpdateUser(userId);
|
||||||
|
|
|
@ -535,7 +535,7 @@ public class ApiTestCaseService extends MoveNodeService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateCase.setTags(ServiceUtils.parseTags(request.getTags()));
|
updateCase.setTags(request.isClear() ? new ArrayList<>() : ServiceUtils.parseTags(request.getTags()));
|
||||||
mapper.updateByExampleSelective(updateCase, example);
|
mapper.updateByExampleSelective(updateCase, example);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,7 +331,7 @@ public class ApiScenarioService extends MoveNodeService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateScenario.setTags(ServiceUtils.parseTags(request.getTags().stream().distinct().toList()));
|
updateScenario.setTags(request.isClear() ? new ArrayList<>() : ServiceUtils.parseTags(request.getTags().stream().distinct().toList()));
|
||||||
mapper.updateByExampleSelective(updateScenario, example);
|
mapper.updateByExampleSelective(updateScenario, example);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -583,6 +583,7 @@ public class ApiScenarioService extends MoveNodeService {
|
||||||
/**
|
/**
|
||||||
* 当文件管理更新了关联资源的 csv 文件版本时
|
* 当文件管理更新了关联资源的 csv 文件版本时
|
||||||
* 前端文件并未更新,这里使用时,进行对比,使用较新的文件版本
|
* 前端文件并未更新,这里使用时,进行对比,使用较新的文件版本
|
||||||
|
*
|
||||||
* @param csvVariables
|
* @param csvVariables
|
||||||
* @param dbCsv
|
* @param dbCsv
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -750,14 +750,24 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1001", "1002"));
|
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1001", "1002"));
|
||||||
apiDefinitionBatchUpdateRequest.setTags(new LinkedHashSet<>(List.of("tag-append", "tag-append1")));
|
apiDefinitionBatchUpdateRequest.setTags(new LinkedHashSet<>(List.of("tag-append", "tag-append1")));
|
||||||
apiDefinitionBatchUpdateRequest.setAppend(true);
|
apiDefinitionBatchUpdateRequest.setAppend(true);
|
||||||
|
apiDefinitionBatchUpdateRequest.setClear(false);
|
||||||
this.requestPostWithOk(BATCH_UPDATE, apiDefinitionBatchUpdateRequest);
|
this.requestPostWithOk(BATCH_UPDATE, apiDefinitionBatchUpdateRequest);
|
||||||
assertBatchUpdateApiDefinition(apiDefinitionBatchUpdateRequest, List.of("1001", "1002"));
|
assertBatchUpdateApiDefinition(apiDefinitionBatchUpdateRequest, List.of("1001", "1002"));
|
||||||
// 修改标签,覆盖
|
// 修改标签,覆盖
|
||||||
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1003", "1004"));
|
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1003", "1004"));
|
||||||
apiDefinitionBatchUpdateRequest.setTags(new LinkedHashSet<>(List.of("tag-append", "tag-append1")));
|
apiDefinitionBatchUpdateRequest.setTags(new LinkedHashSet<>(List.of("tag-append", "tag-append1")));
|
||||||
apiDefinitionBatchUpdateRequest.setAppend(false);
|
apiDefinitionBatchUpdateRequest.setAppend(false);
|
||||||
|
apiDefinitionBatchUpdateRequest.setClear(false);
|
||||||
this.requestPostWithOk(BATCH_UPDATE, apiDefinitionBatchUpdateRequest);
|
this.requestPostWithOk(BATCH_UPDATE, apiDefinitionBatchUpdateRequest);
|
||||||
assertBatchUpdateApiDefinition(apiDefinitionBatchUpdateRequest, List.of("1003", "1004"));
|
assertBatchUpdateApiDefinition(apiDefinitionBatchUpdateRequest, List.of("1003", "1004"));
|
||||||
|
apiDefinitionBatchUpdateRequest.setClear(true);
|
||||||
|
this.requestPostWithOk(BATCH_UPDATE, apiDefinitionBatchUpdateRequest);
|
||||||
|
ApiDefinitionExample apiDefinitionExample = new ApiDefinitionExample();
|
||||||
|
apiDefinitionExample.createCriteria().andIdIn(List.of("1003", "1004"));
|
||||||
|
List<ApiDefinition> apiDefinitions = apiDefinitionMapper.selectByExample(apiDefinitionExample);
|
||||||
|
for (ApiDefinition definition : apiDefinitions) {
|
||||||
|
Assertions.assertTrue(CollectionUtils.isEmpty(definition.getTags()));
|
||||||
|
}
|
||||||
// 自定义字段覆盖
|
// 自定义字段覆盖
|
||||||
apiDefinitionBatchUpdateRequest.setType("customs");
|
apiDefinitionBatchUpdateRequest.setType("customs");
|
||||||
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1002", "1003", "1004"));
|
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1002", "1003", "1004"));
|
||||||
|
@ -766,6 +776,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
field.setValue(JSON.toJSONString(List.of("test1-batch")));
|
field.setValue(JSON.toJSONString(List.of("test1-batch")));
|
||||||
apiDefinitionBatchUpdateRequest.setCustomField(field);
|
apiDefinitionBatchUpdateRequest.setCustomField(field);
|
||||||
apiDefinitionBatchUpdateRequest.setAppend(false);
|
apiDefinitionBatchUpdateRequest.setAppend(false);
|
||||||
|
apiDefinitionBatchUpdateRequest.setClear(false);
|
||||||
this.requestPostWithOk(BATCH_UPDATE, apiDefinitionBatchUpdateRequest);
|
this.requestPostWithOk(BATCH_UPDATE, apiDefinitionBatchUpdateRequest);
|
||||||
// 修改协议类型
|
// 修改协议类型
|
||||||
apiDefinitionBatchUpdateRequest.setType("method");
|
apiDefinitionBatchUpdateRequest.setType("method");
|
||||||
|
|
|
@ -607,6 +607,7 @@ public class ApiDefinitionMockControllerTests extends BaseTest {
|
||||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
request.setType("Tags");
|
request.setType("Tags");
|
||||||
request.setAppend(true);
|
request.setAppend(true);
|
||||||
|
request.setClear(false);
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
||||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||||
|
@ -623,10 +624,16 @@ public class ApiDefinitionMockControllerTests extends BaseTest {
|
||||||
//覆盖标签
|
//覆盖标签
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1")));
|
||||||
request.setAppend(false);
|
request.setAppend(false);
|
||||||
|
request.setClear(false);
|
||||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||||
apiDefinitionMockMapper.selectByExample(example).forEach(apiTestCase -> {
|
apiDefinitionMockMapper.selectByExample(example).forEach(apiTestCase -> {
|
||||||
Assertions.assertEquals(apiTestCase.getTags(), List.of("tag1"));
|
Assertions.assertEquals(apiTestCase.getTags(), List.of("tag1"));
|
||||||
});
|
});
|
||||||
|
request.setClear(true);
|
||||||
|
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||||
|
apiDefinitionMockMapper.selectByExample(example).forEach(apiTestCase -> {
|
||||||
|
Assertions.assertTrue(CollectionUtils.isEmpty(apiTestCase.getTags()));
|
||||||
|
});
|
||||||
//标签为空 报错
|
//标签为空 报错
|
||||||
request.setTags(new LinkedHashSet<>());
|
request.setTags(new LinkedHashSet<>());
|
||||||
this.requestPost(BATCH_EDIT, request, status().is4xxClientError());
|
this.requestPost(BATCH_EDIT, request, status().is4xxClientError());
|
||||||
|
|
|
@ -1621,6 +1621,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
||||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
request.setType("Tags");
|
request.setType("Tags");
|
||||||
request.setAppend(true);
|
request.setAppend(true);
|
||||||
|
request.setClear(false);
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
||||||
requestPostAndReturn(BATCH_EDIT, request);
|
requestPostAndReturn(BATCH_EDIT, request);
|
||||||
|
@ -1654,10 +1655,17 @@ public class ApiScenarioControllerTests extends BaseTest {
|
||||||
//覆盖标签
|
//覆盖标签
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1")));
|
||||||
request.setAppend(false);
|
request.setAppend(false);
|
||||||
|
request.setClear(false);
|
||||||
requestPostAndReturn(BATCH_EDIT, request);
|
requestPostAndReturn(BATCH_EDIT, request);
|
||||||
apiScenarioMapper.selectByExample(example).forEach(scenario -> {
|
apiScenarioMapper.selectByExample(example).forEach(scenario -> {
|
||||||
Assertions.assertEquals(scenario.getTags(), List.of("tag1"));
|
Assertions.assertEquals(scenario.getTags(), List.of("tag1"));
|
||||||
});
|
});
|
||||||
|
request.setAppend(false);
|
||||||
|
request.setClear(true);
|
||||||
|
requestPostAndReturn(BATCH_EDIT, request);
|
||||||
|
apiScenarioMapper.selectByExample(example).forEach(scenario -> {
|
||||||
|
Assertions.assertTrue(CollectionUtils.isEmpty(scenario.getTags()));
|
||||||
|
});
|
||||||
//标签为空 报错
|
//标签为空 报错
|
||||||
request.setTags(new LinkedHashSet<>());
|
request.setTags(new LinkedHashSet<>());
|
||||||
this.requestPost(BATCH_EDIT, request, ERROR_REQUEST_MATCHER);
|
this.requestPost(BATCH_EDIT, request, ERROR_REQUEST_MATCHER);
|
||||||
|
|
|
@ -1101,6 +1101,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
||||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
request.setType("Tags");
|
request.setType("Tags");
|
||||||
request.setAppend(true);
|
request.setAppend(true);
|
||||||
|
request.setClear(false);
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
||||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||||
|
@ -1117,10 +1118,16 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
||||||
//覆盖标签
|
//覆盖标签
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1")));
|
||||||
request.setAppend(false);
|
request.setAppend(false);
|
||||||
|
request.setClear(false);
|
||||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||||
apiTestCaseMapper.selectByExample(example).forEach(apiTestCase -> {
|
apiTestCaseMapper.selectByExample(example).forEach(apiTestCase -> {
|
||||||
Assertions.assertEquals(apiTestCase.getTags(), List.of("tag1"));
|
Assertions.assertEquals(apiTestCase.getTags(), List.of("tag1"));
|
||||||
});
|
});
|
||||||
|
request.setClear(true);
|
||||||
|
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||||
|
apiTestCaseMapper.selectByExample(example).forEach(apiTestCase -> {
|
||||||
|
Assertions.assertTrue(CollectionUtils.isEmpty(apiTestCase.getTags()));
|
||||||
|
});
|
||||||
//标签为空 报错
|
//标签为空 报错
|
||||||
request.setTags(new LinkedHashSet<>());
|
request.setTags(new LinkedHashSet<>());
|
||||||
this.requestPost(BATCH_EDIT, request, ERROR_REQUEST_MATCHER);
|
this.requestPost(BATCH_EDIT, request, ERROR_REQUEST_MATCHER);
|
||||||
|
|
|
@ -16,6 +16,9 @@ public class BugBatchUpdateRequest extends BugBatchRequest{
|
||||||
@Schema(description = "是否追加", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "是否追加", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private boolean append;
|
private boolean append;
|
||||||
|
|
||||||
|
@Schema(description = "是否清空")
|
||||||
|
private boolean clear;
|
||||||
|
|
||||||
@Schema(description = "更新人")
|
@Schema(description = "更新人")
|
||||||
private String updateUser;
|
private String updateUser;
|
||||||
|
|
||||||
|
|
|
@ -492,7 +492,7 @@ public class BugService {
|
||||||
List<String> batchIds = getBatchIdsByRequest(request);
|
List<String> batchIds = getBatchIdsByRequest(request);
|
||||||
// 批量日志{修改之前}
|
// 批量日志{修改之前}
|
||||||
List<LogDTO> logs = getBatchLogByRequest(batchIds, OperationLogType.UPDATE.name(), OperationLogModule.BUG_MANAGEMENT_INDEX, "/bug/batch-update",
|
List<LogDTO> logs = getBatchLogByRequest(batchIds, OperationLogType.UPDATE.name(), OperationLogModule.BUG_MANAGEMENT_INDEX, "/bug/batch-update",
|
||||||
request.getProjectId(), true, request.isAppend(), request.getTags(), currentUser);
|
request.getProjectId(), true, request.isAppend(), request.isClear() ? new ArrayList<>() : request.getTags(), currentUser);
|
||||||
operationLogService.batchAdd(logs);
|
operationLogService.batchAdd(logs);
|
||||||
// 目前只做标签的批量编辑
|
// 目前只做标签的批量编辑
|
||||||
if (request.isAppend()) {
|
if (request.isAppend()) {
|
||||||
|
@ -513,8 +513,8 @@ public class BugService {
|
||||||
sqlSession.flushStatements();
|
sqlSession.flushStatements();
|
||||||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||||
} else {
|
} else {
|
||||||
request.setTags(ServiceUtils.parseTags(request.getTags()));
|
// 标签(清空/覆盖)
|
||||||
// 标签(覆盖)
|
request.setTags(request.isClear() ? new ArrayList<>() : ServiceUtils.parseTags(request.getTags()));
|
||||||
request.setUpdateUser(currentUser);
|
request.setUpdateUser(currentUser);
|
||||||
request.setUpdateTime(System.currentTimeMillis());
|
request.setUpdateTime(System.currentTimeMillis());
|
||||||
extBugMapper.batchUpdate(request, batchIds);
|
extBugMapper.batchUpdate(request, batchIds);
|
||||||
|
@ -721,6 +721,7 @@ public class BugService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理平台全量缺陷
|
* 处理平台全量缺陷
|
||||||
|
*
|
||||||
* @param project 项目
|
* @param project 项目
|
||||||
* @param request 同步请求参数
|
* @param request 同步请求参数
|
||||||
* @param currentUser 当前用户
|
* @param currentUser 当前用户
|
||||||
|
@ -1455,6 +1456,7 @@ public class BugService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否插件默认模板
|
* 是否插件默认模板
|
||||||
|
*
|
||||||
* @param templateId 模板ID
|
* @param templateId 模板ID
|
||||||
* @param pluginTemplate 插件模板
|
* @param pluginTemplate 插件模板
|
||||||
* @return 是否插件默认模板
|
* @return 是否插件默认模板
|
||||||
|
@ -1969,7 +1971,6 @@ public class BugService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param atomicPos 位置
|
* @param atomicPos 位置
|
||||||
* @param batchBugMapper 批量操作缺陷
|
* @param batchBugMapper 批量操作缺陷
|
||||||
* @param batchBugContentMapper 批量操作缺陷内容
|
* @param batchBugContentMapper 批量操作缺陷内容
|
||||||
|
|
|
@ -51,6 +51,7 @@ import org.springframework.mock.web.MockMultipartFile;
|
||||||
import org.springframework.test.context.jdbc.Sql;
|
import org.springframework.test.context.jdbc.Sql;
|
||||||
import org.springframework.test.context.jdbc.SqlConfig;
|
import org.springframework.test.context.jdbc.SqlConfig;
|
||||||
import org.springframework.test.web.servlet.MvcResult;
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
||||||
|
@ -380,16 +381,29 @@ public class BugControllerTests extends BaseTest {
|
||||||
// TAG追加
|
// TAG追加
|
||||||
request.setTags(List.of("TAG", "TEST_TAG"));
|
request.setTags(List.of("TAG", "TEST_TAG"));
|
||||||
request.setAppend(true);
|
request.setAppend(true);
|
||||||
|
request.setClear(false);
|
||||||
this.requestPost(BUG_BATCH_UPDATE, request, status().isOk());
|
this.requestPost(BUG_BATCH_UPDATE, request, status().isOk());
|
||||||
// TAG覆盖
|
// TAG覆盖
|
||||||
request.setExcludeIds(List.of("default-bug-id-tapd1"));
|
request.setExcludeIds(List.of("default-bug-id-tapd1"));
|
||||||
request.setTags(List.of("A", "B"));
|
request.setTags(List.of("A", "B"));
|
||||||
request.setAppend(false);
|
request.setAppend(false);
|
||||||
|
request.setClear(false);
|
||||||
this.requestPost(BUG_BATCH_UPDATE, request, status().isOk());
|
this.requestPost(BUG_BATCH_UPDATE, request, status().isOk());
|
||||||
// 勾选部分
|
// 勾选部分
|
||||||
request.setSelectAll(false);
|
request.setSelectAll(false);
|
||||||
request.setSelectIds(List.of("default-bug-id"));
|
request.setSelectIds(List.of("default-bug-id"));
|
||||||
this.requestPost(BUG_BATCH_UPDATE, request, status().isOk());
|
this.requestPost(BUG_BATCH_UPDATE, request, status().isOk());
|
||||||
|
//TAG追加 清空
|
||||||
|
Bug bug = bugMapper.selectByPrimaryKey("default-bug-id");
|
||||||
|
Assertions.assertEquals(2, bug.getTags().size());
|
||||||
|
request.setAppend(false);
|
||||||
|
request.setClear(true);
|
||||||
|
this.requestPost(BUG_BATCH_UPDATE, request, status().isOk());
|
||||||
|
bug = bugMapper.selectByPrimaryKey("default-bug-id");
|
||||||
|
Assertions.assertTrue(CollectionUtils.isEmpty(bug.getTags()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -808,8 +808,6 @@
|
||||||
WHERE
|
WHERE
|
||||||
tpfc.test_plan_id = #{request.planId}
|
tpfc.test_plan_id = #{request.planId}
|
||||||
AND fc.deleted = #{deleted}
|
AND fc.deleted = #{deleted}
|
||||||
AND
|
|
||||||
fc.project_Id = #{request.projectId}
|
|
||||||
AND
|
AND
|
||||||
tpfc.test_plan_collection_id = #{request.collectionId}
|
tpfc.test_plan_collection_id = #{request.collectionId}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -1348,8 +1348,13 @@ public class FunctionalCaseMinderService {
|
||||||
public List<FunctionalMinderTreeDTO> getCollectionMindFunctionalCase(FunctionalCaseCollectionMindRequest request, boolean deleted) {
|
public List<FunctionalMinderTreeDTO> getCollectionMindFunctionalCase(FunctionalCaseCollectionMindRequest request, boolean deleted) {
|
||||||
List<FunctionalMinderTreeDTO> list = new ArrayList<>();
|
List<FunctionalMinderTreeDTO> list = new ArrayList<>();
|
||||||
List<FunctionalCaseMindDTO> functionalCaseMindDTOList = extFunctionalCaseMapper.getMinderCollectionList(request, deleted);
|
List<FunctionalCaseMindDTO> functionalCaseMindDTOList = extFunctionalCaseMapper.getMinderCollectionList(request, deleted);
|
||||||
List<String> fieldIds = getFieldIds(request.getProjectId());
|
List<String> projectIds = functionalCaseMindDTOList.stream().map(FunctionalCaseMindDTO::getProjectId).distinct().toList();
|
||||||
List<FunctionalCaseCustomField> caseCustomFieldList = extFunctionalCaseMapper.getCaseCustomFieldListByCollection(request, deleted, fieldIds);
|
List<FunctionalCaseCustomField> caseCustomFieldList = new ArrayList<>();
|
||||||
|
for (String projectId : projectIds) {
|
||||||
|
List<String> fieldIds = getFieldIds(projectId);
|
||||||
|
List<FunctionalCaseCustomField> caseCustomFieldListByProjectId = extFunctionalCaseMapper.getCaseCustomFieldListByCollection(request, deleted, fieldIds);
|
||||||
|
caseCustomFieldList.addAll(caseCustomFieldListByProjectId);
|
||||||
|
}
|
||||||
Map<String, String> priorityMap = caseCustomFieldList.stream().collect(Collectors.toMap(FunctionalCaseCustomField::getCaseId, FunctionalCaseCustomField::getValue));
|
Map<String, String> priorityMap = caseCustomFieldList.stream().collect(Collectors.toMap(FunctionalCaseCustomField::getCaseId, FunctionalCaseCustomField::getValue));
|
||||||
//构造父子级数据
|
//构造父子级数据
|
||||||
buildList(functionalCaseMindDTOList, list, priorityMap, "TEST_PLAN");
|
buildList(functionalCaseMindDTOList, list, priorityMap, "TEST_PLAN");
|
||||||
|
|
|
@ -138,8 +138,6 @@ public class FunctionalCaseService {
|
||||||
@Resource
|
@Resource
|
||||||
private FunctionalCaseDemandMapper functionalCaseDemandMapper;
|
private FunctionalCaseDemandMapper functionalCaseDemandMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private FunctionalCaseTestMapper functionalCaseTestMapper;
|
|
||||||
@Resource
|
|
||||||
private ExtFunctionalCaseTestMapper extFunctionalCaseTestMapper;
|
private ExtFunctionalCaseTestMapper extFunctionalCaseTestMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private BugRelationCaseMapper bugRelationCaseMapper;
|
private BugRelationCaseMapper bugRelationCaseMapper;
|
||||||
|
@ -1026,18 +1024,10 @@ public class FunctionalCaseService {
|
||||||
});
|
});
|
||||||
sqlSession.flushStatements();
|
sqlSession.flushStatements();
|
||||||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||||
} else if (request.isClear()) {
|
} else {
|
||||||
//清空标签
|
|
||||||
FunctionalCase functionalCase = new FunctionalCase();
|
|
||||||
functionalCase.setTags(new ArrayList<>());
|
|
||||||
functionalCase.setProjectId(request.getProjectId());
|
|
||||||
functionalCase.setUpdateTime(System.currentTimeMillis());
|
|
||||||
functionalCase.setUpdateUser(userId);
|
|
||||||
extFunctionalCaseMapper.batchUpdate(functionalCase, ids);
|
|
||||||
}else {
|
|
||||||
//替换标签
|
//替换标签
|
||||||
FunctionalCase functionalCase = new FunctionalCase();
|
FunctionalCase functionalCase = new FunctionalCase();
|
||||||
functionalCase.setTags(request.getTags());
|
functionalCase.setTags(request.isClear() ? new ArrayList<>() : ServiceUtils.parseTags(request.getTags()));
|
||||||
functionalCase.setProjectId(request.getProjectId());
|
functionalCase.setProjectId(request.getProjectId());
|
||||||
functionalCase.setUpdateTime(System.currentTimeMillis());
|
functionalCase.setUpdateTime(System.currentTimeMillis());
|
||||||
functionalCase.setUpdateUser(userId);
|
functionalCase.setUpdateUser(userId);
|
||||||
|
|
|
@ -14,6 +14,9 @@ public class TestPlanBatchEditRequest extends TestPlanBatchProcessRequest {
|
||||||
@Schema(description = "是否追加")
|
@Schema(description = "是否追加")
|
||||||
private boolean append = true;
|
private boolean append = true;
|
||||||
|
|
||||||
|
@Schema(description = "是否清空")
|
||||||
|
private boolean clear;
|
||||||
|
|
||||||
@Schema(description = "标签")
|
@Schema(description = "标签")
|
||||||
private List<String> tags;
|
private List<String> tags;
|
||||||
|
|
||||||
|
|
|
@ -794,7 +794,7 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
||||||
} else {
|
} else {
|
||||||
//替换标签
|
//替换标签
|
||||||
TestPlan testPlan = new TestPlan();
|
TestPlan testPlan = new TestPlan();
|
||||||
testPlan.setTags(ServiceUtils.parseTags(request.getTags()));
|
testPlan.setTags(request.isClear() ? new ArrayList<>() : ServiceUtils.parseTags(request.getTags()));
|
||||||
testPlan.setProjectId(request.getProjectId());
|
testPlan.setProjectId(request.getProjectId());
|
||||||
testPlan.setUpdateTime(System.currentTimeMillis());
|
testPlan.setUpdateTime(System.currentTimeMillis());
|
||||||
testPlan.setUpdateUser(userId);
|
testPlan.setUpdateUser(userId);
|
||||||
|
|
|
@ -2384,6 +2384,7 @@ public class TestPlanTests extends BaseTest {
|
||||||
request.setProjectId("songtianyang-fix-wx");
|
request.setProjectId("songtianyang-fix-wx");
|
||||||
request.setSelectIds(Arrays.asList("wx_test_plan_id_1"));
|
request.setSelectIds(Arrays.asList("wx_test_plan_id_1"));
|
||||||
request.setAppend(false);
|
request.setAppend(false);
|
||||||
|
request.setClear(false);
|
||||||
request.setTags(Arrays.asList("tag3", "tag4"));
|
request.setTags(Arrays.asList("tag3", "tag4"));
|
||||||
this.requestPostWithOk(URL_TEST_PLAN_BATCH_EDIT, request);
|
this.requestPostWithOk(URL_TEST_PLAN_BATCH_EDIT, request);
|
||||||
//检查标签是否覆盖
|
//检查标签是否覆盖
|
||||||
|
@ -2393,6 +2394,7 @@ public class TestPlanTests extends BaseTest {
|
||||||
Assertions.assertTrue(testPlan.getTags().contains("tag4"));
|
Assertions.assertTrue(testPlan.getTags().contains("tag4"));
|
||||||
|
|
||||||
request.setAppend(true);
|
request.setAppend(true);
|
||||||
|
request.setClear(false);
|
||||||
request.setTags(Arrays.asList("tag1", "tag2"));
|
request.setTags(Arrays.asList("tag1", "tag2"));
|
||||||
this.requestPostWithOk(URL_TEST_PLAN_BATCH_EDIT, request);
|
this.requestPostWithOk(URL_TEST_PLAN_BATCH_EDIT, request);
|
||||||
testPlan = testPlanMapper.selectByPrimaryKey("wx_test_plan_id_1");
|
testPlan = testPlanMapper.selectByPrimaryKey("wx_test_plan_id_1");
|
||||||
|
@ -2417,6 +2419,12 @@ public class TestPlanTests extends BaseTest {
|
||||||
Assertions.assertTrue(testPlan.getTags().contains("tag8"));
|
Assertions.assertTrue(testPlan.getTags().contains("tag8"));
|
||||||
Assertions.assertTrue(testPlan.getTags().contains("tag9"));
|
Assertions.assertTrue(testPlan.getTags().contains("tag9"));
|
||||||
Assertions.assertTrue(testPlan.getTags().contains("tag0"));
|
Assertions.assertTrue(testPlan.getTags().contains("tag0"));
|
||||||
|
request.setAppend(false);
|
||||||
|
request.setClear(true);
|
||||||
|
request.setSelectAll(true);
|
||||||
|
this.requestPostWithOkAndReturn(URL_TEST_PLAN_BATCH_EDIT, request);
|
||||||
|
testPlan = testPlanMapper.selectByPrimaryKey("wx_test_plan_id_1");
|
||||||
|
Assertions.assertTrue(CollectionUtils.isEmpty(testPlan.getTags()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue