<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yhy.module.core.dal.mysql.quota.QuotaCatalogItemMapper">

    <!-- 查询所有子孙节点（通过 path 数组包含查询） -->
    <select id="selectDescendants" resultType="com.yhy.module.core.dal.dataobject.quota.QuotaCatalogItemDO">
        SELECT *
        FROM yhy_catalog_item
        WHERE #{id}::text = ANY(path)
          AND deleted = 0
        ORDER BY array_length(path, 1), sort_order
    </select>

</mapper>
