mybatis 获取树形机构数据,参数从开始传递到结束

/**
 *实体定义
 */
public class TreeNodeEx {
    /**
     * id主键
     * */
    private Long id;
    /**
     * text显示的文本
     * */
    private String text;
    /**
     *state节点状态,'open' 或 'closed',默认:'open'。如果为'closed'的时候,将不自动展开该节点。
     * */
    private String state="open";
    /**
     *iconCls 节点图标id
     * */
    private String iconCls;
    /**
     * checked 是否被选中
     * */
    private boolean checked;
    /**
     *attributes 自定义属性
     * */
    private NodeAttributes attributes;
    /**
     * children 子节点
     * */
    private List<TreeNode> children;

}


/**
 *实体定义
 */

public class NodeAttributes {
    //编号
    private String no;
    //类型
    private Integer type;

 
}

/**
 *service调用
 */
    public List<TreeNodeEx> getOrganizationUserTree() {
        return userMapperEx.getNodeTree();
    }

/**
 *mapper接口定义
 */
    List<TreeNodeEx> getNodeTree();
    List<TreeNodeEx> getNextNodeTree(Map<String, Object> parameterMap);
/**
 *mapper实现
 *重点关注orgNo这个参数从开始传递到结束
 */
   <resultMap id="BaseTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNodeEx">
        <result column="id" property="id"/>
        <result column="text" property="text"/>
        <association property="attributes" javaType="com.jsh.erp.datasource.vo.NodeAttributes">
            <id column="orgNo" property="no"></id>
            <result column="type" property="type"></result>
        </association>
        <collection column="{orgId=id,orgNo=orgNo}" property="children" javaType="java.util.ArrayList"
                    ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
    </resultMap>

    <resultMap id="NextTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNodeEx">
        <result column="id" property="id"/>
        <result column="text" property="text"/>
        <result column="iconCls" property="iconCls"/>
        <association property="attributes" javaType="com.jsh.erp.datasource.vo.NodeAttributes">
            <id column="orgNo" property="no"></id>
            <result column="type" property="type"></result>
        </association>
        <collection column="{orgId=id,orgNo=orgNo}" property="children" javaType="java.util.ArrayList"
                    ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
    </resultMap>

   <select id="getNextNodeTree" resultMap="NextTreeResultMap">
        select id ,	text,orgNo,sort ,iconCls,type from (
            SELECT
            org.id, org.org_abr as text,org.org_no as orgNo,org.sort as sort,null as iconCls,'0' as type
            FROM jsh_organization org
            WHERE org.org_parent_no = #{orgNo}
            and ifnull(org.org_stcd,'0') !='5'
            union all
            select
            user.id,user.username as text, null as orgNo,rel.user_blng_orga_dspl_seq as sort,'icon-user' as iconCls,'1' as type
            from jsh_user user,jsh_orga_user_rel rel
            where
            1=1
            and user.id=rel.user_id
            and rel.orga_id=#{orgId}
            and rel.delete_flag !='1'
            and ifnull(user.status,'0') not in('1','2')
          ) node
          order by sort asc
    </select>

    <select id="getNodeTree" resultMap="BaseTreeResultMap">
        SELECT
         id, org_abr as text,org_no as orgNo,'0' as type
        FROM jsh_organization
        WHERE org_parent_no = -1
        and ifnull(org_stcd,'0') !='5'
        order by sort asc
    </select>