天天看点

随记mybatis递归查询写法

sql递归速记

<select id="selectOrgTree" parameterType="com.jx.uac.api.doman.dto.OrganizationDto"
        resultType="com.jx.uac.api.doman.vo.OrganizationTreeVO">
    select
    ID,PID,NAME title, name label
    from SSO_ORGAN
    <include refid="getChild"></include>
</select>

<!-- 递归查询获取所有父级机构 -->
<select id="selectParentOrgan" parameterType="com.jx.uac.api.doman.dto.OrganizationDto"
        resultType="com.jx.uac.api.doman.vo.ParentOrganVO">
    select
    ID,NAME
    from SSO_ORGAN
    <include refid="getChild"></include>
</select>
           

继续阅读