liding
2 天以前 49e1bc66ebaf696ebd3fc3ed33d65c8795fd3cde
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>