mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
(improvement)(Headless) When obtaining the domain list, information about whether there is a model under the domain is returned incidentally. (#970)
This commit is contained in:
@@ -27,6 +27,8 @@ public class DomainResp extends SchemaItem {
|
|||||||
|
|
||||||
private boolean hasEditPermission = false;
|
private boolean hasEditPermission = false;
|
||||||
|
|
||||||
|
private boolean hasModel;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (o == null || getClass() != o.getClass()) {
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
|||||||
@@ -106,15 +106,20 @@ public class DomainServiceImpl implements DomainService {
|
|||||||
domainWithAuthAll.addAll(getParentDomain(domainIds));
|
domainWithAuthAll.addAll(getParentDomain(domainIds));
|
||||||
}
|
}
|
||||||
List<ModelResp> modelResps = modelService.getModelAuthList(user, null, AuthType.ADMIN);
|
List<ModelResp> modelResps = modelService.getModelAuthList(user, null, AuthType.ADMIN);
|
||||||
|
List<Long> domainIdsFromModel = modelResps.stream().map(ModelResp::getDomainId).collect(Collectors.toList());
|
||||||
if (!CollectionUtils.isEmpty(modelResps)) {
|
if (!CollectionUtils.isEmpty(modelResps)) {
|
||||||
List<Long> domainIds = modelResps.stream().map(ModelResp::getDomainId).collect(Collectors.toList());
|
domainWithAuthAll.addAll(getParentDomain(domainIdsFromModel));
|
||||||
domainWithAuthAll.addAll(getParentDomain(domainIds));
|
|
||||||
}
|
}
|
||||||
List<DataSetResp> dataSetResps = dataSetService.getDataSets(user);
|
List<DataSetResp> dataSetResps = dataSetService.getDataSets(user);
|
||||||
if (!CollectionUtils.isEmpty(dataSetResps)) {
|
if (!CollectionUtils.isEmpty(dataSetResps)) {
|
||||||
List<Long> domainIds = dataSetResps.stream().map(DataSetResp::getDomainId).collect(Collectors.toList());
|
List<Long> domainIds = dataSetResps.stream().map(DataSetResp::getDomainId).collect(Collectors.toList());
|
||||||
domainWithAuthAll.addAll(getParentDomain(domainIds));
|
domainWithAuthAll.addAll(getParentDomain(domainIds));
|
||||||
}
|
}
|
||||||
|
for (DomainResp domainResp : domainWithAuthAll) {
|
||||||
|
if (domainIdsFromModel.contains(domainResp.getId())) {
|
||||||
|
domainResp.setHasModel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
return new ArrayList<>(domainWithAuthAll).stream()
|
return new ArrayList<>(domainWithAuthAll).stream()
|
||||||
.sorted(Comparator.comparingLong(DomainResp::getId)).collect(Collectors.toList());
|
.sorted(Comparator.comparingLong(DomainResp::getId)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user