liding
3 天以前 f6f57ba70679a0b050031f3cdf81b5bf5d4cbd60
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>