|
@@ -58,4 +58,20 @@
|
|
|
UNION ALL
|
|
|
SELECT #{nodeId} as ancestor, descendant, depth + 1, 0 FROM distri_share_path WHERE ancestor = #{nodeId};
|
|
|
</insert>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 查询某节点的所有后代节点 -->
|
|
|
+ <select id="findAllDescendants" resultType="long">
|
|
|
+ SELECT descendant
|
|
|
+ FROM distri_share_path
|
|
|
+ WHERE ancestor = #{ancestorId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询排序号小于当前节点的兄弟节点 -->
|
|
|
+ <select id="findLessSortedSiblings" resultType="long">
|
|
|
+ SELECT a.descendant
|
|
|
+ FROM distri_share_path a
|
|
|
+ JOIN distri_share_path b ON a.ancestor = b.ancestor
|
|
|
+ WHERE b.descendant = #{descendantId} AND a.sort < b.sort
|
|
|
+ </select>
|
|
|
</mapper>
|