feat(工作台): 增加批量取消关注功能
--user=郭雨琦 --bug=1015281 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015281
This commit is contained in:
parent
dca129de0f
commit
6aadd379f6
|
@ -26,4 +26,9 @@ public class ApiBatchRequest extends ApiDefinitionWithBLOBs {
|
|||
*/
|
||||
private boolean appendTag = false;
|
||||
private ApiDefinitionRequest condition;
|
||||
|
||||
/**
|
||||
* 关注
|
||||
*/
|
||||
private String follow;
|
||||
}
|
||||
|
|
|
@ -54,4 +54,8 @@ public class ApiTestBatchRequest extends ApiTestCaseWithBLOBs {
|
|||
*/
|
||||
private boolean appendTag = false;
|
||||
|
||||
/**
|
||||
* 关注
|
||||
*/
|
||||
private String follow;
|
||||
}
|
||||
|
|
|
@ -1789,6 +1789,9 @@ public class ApiDefinitionService {
|
|||
}
|
||||
|
||||
public void editApiByParam(ApiBatchRequest request) {
|
||||
if (request == null) {
|
||||
return;
|
||||
}
|
||||
if (StringUtils.equals("tags", request.getType())) {
|
||||
this.batchEditDefinitionTags(request);
|
||||
return;
|
||||
|
@ -1800,7 +1803,7 @@ public class ApiDefinitionService {
|
|||
definitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
||||
ServiceUtils.getSelectAllIds(request, request.getCondition(),
|
||||
(query) -> extApiDefinitionMapper.selectIds(query));
|
||||
if (request != null && (request.getIds() != null || !request.getIds().isEmpty())) {
|
||||
if (CollectionUtils.isNotEmpty(request.getIds())) {
|
||||
request.getIds().forEach(apiId -> {
|
||||
ApiDefinitionWithBLOBs api = apiDefinitionMapper.selectByPrimaryKey(apiId);
|
||||
if (api == null) {
|
||||
|
@ -1831,6 +1834,11 @@ public class ApiDefinitionService {
|
|||
apiDefinitionRequest.setVersionId(api.getVersionId());
|
||||
checkNameExist(apiDefinitionRequest, false);
|
||||
});
|
||||
if (StringUtils.isNotEmpty(request.getFollow())) {
|
||||
if (StringUtils.equals(request.getFollow(), "cancel")) {
|
||||
this.deleteFollows(request.getIds());
|
||||
}
|
||||
}
|
||||
}
|
||||
apiDefinitionMapper.updateByExampleSelective(definitionWithBLOBs, getBatchExample(request));
|
||||
}
|
||||
|
|
|
@ -793,6 +793,13 @@ public class ApiTestCaseService {
|
|||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getFollow())) {
|
||||
if (StringUtils.equals(request.getFollow(), "cancel")) {
|
||||
ApiTestCaseFollowExample apiTestCaseFollowExample = new ApiTestCaseFollowExample();
|
||||
apiTestCaseFollowExample.createCriteria().andCaseIdIn(ids);
|
||||
apiTestCaseFollowMapper.deleteByExample(apiTestCaseFollowExample);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void batchEditTags(ApiTestBatchRequest request, List<String> ids) {
|
||||
|
|
Loading…
Reference in New Issue