<!--级联查询返回模型--> <resultMap type="Map" id="fatherMap"> <id column="id" property="id"/> <collection property="list" ofType="com.jmxf.entity.zdbwManage.ZdbwIndoor" column="id" select="findMenuByPid"/> </resultMap> <!--级联查询父菜单--> <select id="selectAllMenu" resultMap="fatherMap" > select * from zdbw_indoor where fip = '0' </select> <!--级联查询子菜单--> <select id="findMenuByPid" resultMap="fatherMap" > select * from zdbw_indoor where fid = #{id} </select> <!--级联查询返回模型-->
参数需要多个/参数需要传到子节点
<!-- 室内设备列表 --> <resultMap type="Map" id="indoorMap"> <id column="dm" property="dm" /> <id column="sncsid" property="sncsid" /> <collection property="list" ofType="java.util.Map" column="{dm=dm,sncsid=sncsid}" select="findCustomDev" /> </resultMap> <!--级联查询父菜单 --> <select id="queryIndoorDevWork" resultMap="indoorMap"> select dm,mc,icon,IFNULL(#{sncsid},'') sncsid from code_indoor_dev_type where zt='1' </select> <!--级联查询子菜单 --> <select id="findCustomDev" resultType="java.util.Map"> select * from zdbw_custom_dev where sbzl = #{dm} and jmsnbz = '2' <if test ='""!= sncsid'> and sncsid = #{sncsid}</if> </select> <!-- 室内设备列表 -->