<resultMap type="AuthMenu" id="AuthMenuMapper">
<id property="id" column="id" />
<collection property="childList" ofType="AuthMenu"
select="selectChildListByParentId"
column="id"/>
</resultMap>
<select id="selectMenuListByRoleIdAndMenuId" resultMap="AuthMenuMapper">
create temporary table temp_auth_menu
SELECT am.* FROM auth_role_menu arm
INNER JOIN auth_menu am ON arm.menu_id = am.id
WHERE arm.role_id = #{roleId} AND am.`status` = 1;
SELECT * FROM temp_auth_menu where id = #{menuId}
</select>
<select id="selectChildListByParentId" resultMap="AuthMenuMapper">
select * from temp_auth_menu
where parent_id = #{id}
order by sort_num asc
</select>