mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +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 hasModel;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
|
||||
@@ -106,15 +106,20 @@ public class DomainServiceImpl implements DomainService {
|
||||
domainWithAuthAll.addAll(getParentDomain(domainIds));
|
||||
}
|
||||
List<ModelResp> modelResps = modelService.getModelAuthList(user, null, AuthType.ADMIN);
|
||||
List<Long> domainIdsFromModel = modelResps.stream().map(ModelResp::getDomainId).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(modelResps)) {
|
||||
List<Long> domainIds = modelResps.stream().map(ModelResp::getDomainId).collect(Collectors.toList());
|
||||
domainWithAuthAll.addAll(getParentDomain(domainIds));
|
||||
domainWithAuthAll.addAll(getParentDomain(domainIdsFromModel));
|
||||
}
|
||||
List<DataSetResp> dataSetResps = dataSetService.getDataSets(user);
|
||||
if (!CollectionUtils.isEmpty(dataSetResps)) {
|
||||
List<Long> domainIds = dataSetResps.stream().map(DataSetResp::getDomainId).collect(Collectors.toList());
|
||||
domainWithAuthAll.addAll(getParentDomain(domainIds));
|
||||
}
|
||||
for (DomainResp domainResp : domainWithAuthAll) {
|
||||
if (domainIdsFromModel.contains(domainResp.getId())) {
|
||||
domainResp.setHasModel(true);
|
||||
}
|
||||
}
|
||||
return new ArrayList<>(domainWithAuthAll).stream()
|
||||
.sorted(Comparator.comparingLong(DomainResp::getId)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user