@Override
    public int createSelector(final DataPermissionDTO dataPermissionDTO) {
        
        List<DataPermissionDO> allDOList = new LinkedList<>();
        dataPermissionDTO.setDataType(AdminDataPermissionTypeEnum.SELECTOR.ordinal());
        allDOList.add(DataPermissionDO.buildPermissionDO(dataPermissionDTO));
        
        List<DataPermissionDO> allRuleList = ruleMapper.findBySelectorId(dataPermissionDTO.getDataId())
                .stream()
                .filter(Objects::nonNull)
                .map(ruleDO -> DataPermissionDO.buildCreatePermissionDO(ruleDO.getId(),
                        dataPermissionDTO.getUserId(), AdminDataPermissionTypeEnum.RULE.ordinal()))
                .collect(Collectors.toList());
        
        if (CollectionUtils.isNotEmpty(allRuleList)) {
            allDOList.addAll(allRuleList);
        }
        
        return dataPermissionMapper.insertBatch(allDOList);
    }
Create data permissions.

@param dataPermissionDTO {@linkplain DataPermissionDTO}
@return int
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/DataPermissionServiceImpl.java