1
次の詳細は私の問題を説明します。
フレームワーク:春ブーツ
データベース:のNeo4j組み込みモード
リポジトリ: 特定の深さでfindOneを使用する:GraphRepositoryNeo4jノードエンティティの階層データを生成
以下は、これまでに試してみました、私の組織POJO
@NodeEntity
public class Organization extends UserBaseEntity {
@NotNull(message = "error.Organization.name.notnull")
private String name;
private String email;
@Relationship(type = HAS_SUB_ORGANIZATION)
private List<Organization> children = new ArrayList<>();
// getter and setters
}
です。
例: graphRepo.findOne(organizationId、3);
これは組織の完全なネットワークを返します。
I組織の階層データを生成する必要があります。
再帰的なクエリを作成して組織階層を生成する方法はありません。 まず:
は、私はあなたに私は以下のように自分のアプリケーションに実装ソリューションを提案するだけで、ID、名前、子供(サブ組織)
サンプル・フォーマット
[
{
id: 1,
name: 'Organization 1',
children: [
{ id: 2, name: 'Organization 1 ' },
{ id: 3, name: 'Organization 2' }
]
},
{
id: 4,
name: 'Organization 2',
children: [
{
id: 5,
name: 'Organization 2 unit'
}
]
}
]
'@ Query'アノテーションでカスタムリポジトリクエリを使用しようとしましたか? – digx1