maven
2025-10-11 7cd9dbf45e8e29f3bb0c00ac4f14d5588029c3ba
main-business/src/main/resources/mapper/TreeMapper.xml
@@ -23,5 +23,14 @@
                update_time,
            id, name, parent_id
        </sql>
    <select id="listRecursiveSubNodeIds" resultType="java.lang.Long">
        WITH RECURSIVE sub_nodes AS (
            SELECT id FROM tree WHERE parent_id = #{treeId}
            UNION ALL
            SELECT t.id FROM tree t
                                 JOIN sub_nodes s ON t.parent_id = s.id
        )
        SELECT id FROM sub_nodes
    </select>
</mapper>