class DeviceCategoryService extends GenericReactiveTreeSupportCrudService<DeviceCategoryEntity, String> implements CommandLineRunner {

    @Override
    public IDGenerator<String> getIDGenerator() {
        return IDGenerator.MD5;
    }

    private static final String category_splitter = "-";
    @Override
    public void setChildren(DeviceCategoryEntity entity, List<DeviceCategoryEntity> children) {
        entity.setChildren(children);
    }

    @Override
    public void run(String... args) {
        this
            .createQuery()
            .fetchOne()
            .switchIfEmpty(initDefaultData().then(Mono.empty()))
            .as(EntityEventHelper::setDoNotFireEvent)
            .subscribe(ignore->{},
                       err -> log.error("init device category error", err));
    }


    static void rebuild(String parentId, List<DeviceCategoryEntity> children) {
        if (children == null) {
            return;
        }
        for (DeviceCategoryEntity child : children) {
            String id = child.getId();
            child.setId(parentId + category_splitter + id +category_splitter);
            child.setParentId(parentId +category_splitter);
            rebuild(parentId + category_splitter + id, child.getChildren());
        }
    }

    private Mono<Void> initDefaultData() {<FILL_FUNCTION_BODY>}
}

        return Mono
            .fromCallable(() -> {
                ClassPathResource resource = new ClassPathResource("device-category.json");

                try (InputStream stream = resource.getInputStream()) {
                    String json = StreamUtils.copyToString(stream, StandardCharsets.UTF_8);

                    List<DeviceCategoryEntity> all = JSON.parseArray(json, DeviceCategoryEntity.class);

                    List<DeviceCategoryEntity> root = TreeSupportEntity.list2tree(all, DeviceCategoryEntity::setChildren);

                    for (DeviceCategoryEntity category : root) {
                        String id = category.getId();
                        category.setId(category_splitter + id + category_splitter);
                        Optional
                            .ofNullable(category.getParentId())
                            .ifPresent(parentId -> {
                                category.setParentId(category_splitter + parentId + category_splitter);
                            });
                        rebuild(category_splitter + id, category.getChildren());
                    }
                    return root;
                }

            })
            .flatMap(all -> save(Flux.fromIterable(all)))
            .then();
    
<no_super_class>