Skip to content

Commit

Permalink
[Fix] fix data-permission namespace problem (#5654)
Browse files Browse the repository at this point in the history
* [Fix] fix data-permission namespace problem

* [style] fix code style for ci follow checkstyle
  • Loading branch information
VampireAchao authored Sep 9, 2024
1 parent d6d0223 commit cc2df49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

package org.apache.shenyu.admin.model.dto;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;

/**
Expand All @@ -36,14 +37,14 @@ public class NamespaceDTO implements Serializable {
/**
* namespace name.
*/
@Max(value = 255, message = "The maximum length is 255")
@Length(max = 255, message = "The maximum length is 255")
@NotNull(message = "namespace name not null")
private String name;

/**
* namespace description.
*/
@Max(value = 255, message = "The maximum length is 255")
@Length(max = 255, message = "The maximum length is 255")
@NotNull(message = "namespace description not null")
private String description;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,13 @@ public CommonPager<DataPermissionPageVO> listSelectorsByPage(final SelectorQuery
if (totalCount > 0) {
Supplier<Stream<SelectorDO>> selectorDOStreamSupplier = () -> selectorMapper.selectByQuery(selectorQuery).stream();
List<String> selectorIds = selectorDOStreamSupplier.get().map(SelectorDO::getId).collect(Collectors.toList());

Set<String> hasDataPermissionSelectorIds = new HashSet<>(dataPermissionMapper.selectDataIds(selectorIds,
userId, AdminDataPermissionTypeEnum.SELECTOR.ordinal()));


Set<String> hasDataPermissionSelectorIds = new HashSet<>();
if (!selectorIds.isEmpty()) {
hasDataPermissionSelectorIds.addAll(dataPermissionMapper.selectDataIds(selectorIds,
userId, AdminDataPermissionTypeEnum.SELECTOR.ordinal()));
}

selectorList = selectorDOStreamSupplier.get().map(selectorDO -> {
boolean isChecked = hasDataPermissionSelectorIds.contains(selectorDO.getId());
return DataPermissionPageVO.buildPageVOBySelector(selectorDO, isChecked);
Expand Down

0 comments on commit cc2df49

Please sign in to comment.