TSysOrgDao.xml 1000 Bytes
<?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.testor.module.notice.dao.TSysOrgDao">
    <resultMap id="treeVoMap" type="com.testor.module.notice.model.domain.TreeVO">
        <id column="org_id" property="id" />
        <result column="org_name" property="name" />
        <result column="parent_id" property="pid"  />
        <collection property="children" ofType="com.testor.module.notice.model.domain.TreeVO"
                    column="org_id" select="findTreeByPid"/>
    </resultMap>

    <!--级联查询父菜单-->
    <select id="selectAllTree" resultMap="treeVoMap" >
        select org_id , org_name , parent_id from t_sys_org where parent_id = #{id}
    </select>

    <!--级联查询子菜单-->
    <select id="findTreeByPid" resultMap="treeVoMap" >
        select org_id , org_name , parent_id from t_sys_org where parent_id = #{id}
    </select>

</mapper>