@Override
    public CommonPager<DataPermissionPageVO> listRulesByPage(final RuleQuery ruleQuery, final String userId) {
        int totalCount = ruleMapper.countByQuery(ruleQuery);
        
        List<DataPermissionPageVO> selectorList = Collections.emptyList();
        if (totalCount > 0) {
            Supplier<Stream<RuleDO>> ruleDOStreamSupplier = () -> ruleMapper.selectByQuery(ruleQuery).stream();
            List<String> ruleIds = ruleDOStreamSupplier.get().map(RuleDO::getId).collect(Collectors.toList());
            
            Set<String> hasDataPermissionRuleIds = new HashSet<>(dataPermissionMapper.selectDataIds(ruleIds, userId,
                    AdminDataPermissionTypeEnum.RULE.ordinal()));
            
            selectorList = ruleDOStreamSupplier.get().map(ruleDO -> {
                boolean isChecked = hasDataPermissionRuleIds.contains(ruleDO.getId());
                return DataPermissionPageVO.buildPageVOByRule(ruleDO, isChecked);
            }).collect(Collectors.toList());
        }
        
        List<DataPermissionPageVO> finalSelectorList = selectorList;
        return PageResultUtils.result(ruleQuery.getPageParameter(), () -> totalCount, () -> finalSelectorList);
    }
list of rules.

@param ruleQuery {@linkplain RuleQuery}
@param userId    user id
@return {@linkplain CommonPager}
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/DataPermissionServiceImpl.java