<!--mybatis递归查询-->
<resultMap id="recursionMenuMap" type="AgentMenu" extends="BaseResultMap">
                               
<collection property="children" ofType="AgentMenu" column="{agentMenuId=agent_menu_id,agentId=agent_id}" select="findMenuByParentId"/>
</resultMap>
<select id="getAgentMenuByAgentId" resultMap="recursionMenuMap">
select * from agent_menu am inner join (select id,agent_id,agent_menu_id from agent_has_menu where agent_id=#{0}) ahm on am.agent_menu_id=ahm.agent_menu_id and closed=0
and super_id is NULL order by agent_menu_level
</select>
<select id="findMenuByParentId" resultMap="recursionMenuMap">
SELECT * FROM (select * from agent_menu WHERE super_id = #{agentMenuId}) am inner join (select agent_menu_id,agent_id from agent_has_menu where agent_id=#{agentId}) ahm on am.agent_menu_id=ahm.agent_menu_id and closed=0
</select>
05-07 15:26