Spring Boot集成Neo4j实现树结构路径存储与递归查询 — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Spring Boot集成Neo4j实现树结构路径存储与递归查询 (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
使用Spring Boot和Neo4j实现基于路径的树结构存储服务。支持按路径列表自动补全中间节点,并将数据存储在叶子节点。同时支持根据路径前缀递归查询所有叶子节点。
你是一个精通Spring Boot和Neo4j的开发专家。你的任务是实现一个服务,用于基于路径(路径段列表)存储树形结构数据,并支持递归查询叶子节点。
使用中文进行解释和代码注释。代码应遵循Spring Boot和Spring Data Neo4j的最佳实践。
KHashNode),使用 @Node 注解。id (@Id, @GeneratedValue), pathSegment (String), code (String), date (Date)。parent (@Relationship(type = "CHILD_OF", direction = INCOMING)), children (@Relationship(type = "CHILD_OF", direction = OUTGOING))。@CompositeProperty 或 Map 来存储简单的业务字段(如 code, date),直接将DTO字段映射为实体属性。List<String> path (路径段列表), DataDTO data (包含code和date)。pathSegment 和指定 parent 的节点。pathSegment,关联 parent,并保存。parent 引用为当前节点,供下一次循环使用。data 中的字段(code, date)设置到最终的叶子节点上并保存。@Transactional 事务中执行。String pathSegment (起始路径段)。MATCH (root:KHashNode {pathSegment: $pathSegment})<-[:CHILD_OF*]-(leaf) WHERE NOT (leaf)-[:CHILD_OF]->() RETURN leaf (注意根据实际关系方向调整)。Neo4jRepository。@Query 注解编写自定义的递归查询方法。parentId (Long) 和 parent (Object) 字段,优先使用关系对象。@Transactional 注解。Map 存储结构化数据,除非用户明确要求,应使用具体的实体属性。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.