mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 14:36:47 +00:00
(improvement)(headless) opt queryTagMarketPage logic, support query without tagObjectId (#854)
This commit is contained in:
@@ -3,12 +3,9 @@ package com.tencent.supersonic.headless.api.pojo.request;
|
|||||||
import com.tencent.supersonic.headless.api.pojo.enums.TagDefineType;
|
import com.tencent.supersonic.headless.api.pojo.enums.TagDefineType;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TagFilterPageReq extends PageSchemaItemReq {
|
public class TagFilterPageReq extends PageSchemaItemReq {
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private Long tagObjectId;
|
private Long tagObjectId;
|
||||||
|
|
||||||
private TagDefineType tagDefineType;
|
private TagDefineType tagDefineType;
|
||||||
|
|||||||
@@ -144,6 +144,12 @@ public class TagMetaServiceImpl implements TagMetaService {
|
|||||||
if (CollectionUtils.isEmpty(modelRespList)) {
|
if (CollectionUtils.isEmpty(modelRespList)) {
|
||||||
return new PageInfo<>();
|
return new PageInfo<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Objects.nonNull(tagMarketPageReq.getTagObjectId())) {
|
||||||
|
modelRespList = modelRespList.stream()
|
||||||
|
.filter(modelResp -> tagMarketPageReq.getTagObjectId().equals(modelResp.getTagObjectId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
List<Long> modelIds = modelRespList.stream().map(model -> model.getId()).collect(Collectors.toList());
|
List<Long> modelIds = modelRespList.stream().map(model -> model.getId()).collect(Collectors.toList());
|
||||||
|
|
||||||
TagFilter tagFilter = new TagFilter();
|
TagFilter tagFilter = new TagFilter();
|
||||||
@@ -247,19 +253,18 @@ public class TagMetaServiceImpl implements TagMetaService {
|
|||||||
if (Objects.isNull(modelResp)) {
|
if (Objects.isNull(modelResp)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tagMarketPageReq.getTagObjectId().equals(modelResp.getTagObjectId())) {
|
if (CollectionUtils.isNotEmpty(tagMarketPageReq.getDomainIds())) {
|
||||||
if (CollectionUtils.isNotEmpty(tagMarketPageReq.getDomainIds())) {
|
if (!tagMarketPageReq.getDomainIds().contains(modelResp.getDomainId())) {
|
||||||
if (!tagMarketPageReq.getDomainIds().contains(modelResp.getDomainId())) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(tagMarketPageReq.getModelIds())) {
|
|
||||||
if (!tagMarketPageReq.getModelIds().contains(modelResp.getId())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
modelRespList.add(modelResp);
|
|
||||||
}
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(tagMarketPageReq.getModelIds())) {
|
||||||
|
if (!tagMarketPageReq.getModelIds().contains(modelResp.getId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
modelRespList.add(modelResp);
|
||||||
|
|
||||||
}
|
}
|
||||||
return modelRespList;
|
return modelRespList;
|
||||||
}
|
}
|
||||||
@@ -340,7 +345,7 @@ public class TagMetaServiceImpl implements TagMetaService {
|
|||||||
ModelResp model = modelService.getModel(dimension.getModelId());
|
ModelResp model = modelService.getModel(dimension.getModelId());
|
||||||
if (Objects.isNull(model.getTagObjectId())) {
|
if (Objects.isNull(model.getTagObjectId())) {
|
||||||
throw new RuntimeException(String.format("this dimension:%s is not supported to create tag,"
|
throw new RuntimeException(String.format("this dimension:%s is not supported to create tag,"
|
||||||
+ " no related tag object", tagReq.getItemId()));
|
+ " no related tag object", tagReq.getItemId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TagDefineType.METRIC.equals(tagReq.getTagDefineType())) {
|
if (TagDefineType.METRIC.equals(tagReq.getTagDefineType())) {
|
||||||
@@ -348,7 +353,7 @@ public class TagMetaServiceImpl implements TagMetaService {
|
|||||||
ModelResp model = modelService.getModel(metric.getModelId());
|
ModelResp model = modelService.getModel(metric.getModelId());
|
||||||
if (Objects.isNull(model.getTagObjectId())) {
|
if (Objects.isNull(model.getTagObjectId())) {
|
||||||
throw new RuntimeException(String.format("this metric:%s is not supported to create tag,"
|
throw new RuntimeException(String.format("this metric:%s is not supported to create tag,"
|
||||||
+ " no related tag object", tagReq.getItemId()));
|
+ " no related tag object", tagReq.getItemId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user