分步查询
<resultMap id="maop" type="com.yunqing.mybatis.bean.Department">
<id column="did" property="id"/>
<result column="department" property="departmentName"/>
<collection property="bloggers" select="com.yunqing.mybatis.dao.BloggerMapper.getBloggersByDepId"
column="did">
</collection>
</resultMap>
<select id="getDepStep" resultMap="maop">
SELECT id did,department FROM t_dep WHERE id=#{id}
</select>
分步查询传递多列值
<resultMap id="maop" type="com.yunqing.mybatis.bean.Department">
<id column="did" property="id"/>
<result column="department" property="departmentName"/>
<collection property="bloggers" select="com.yunqing.mybatis.dao.BloggerMapper.getBloggersByDepId"
column="{depId=did}" fetchType="eager">
</collection>
</resultMap>
<select id="getDepStep" resultMap="maop">
SELECT id did,department FROM t_dep WHERE id=#{id}
</select>
传递多列值,column="{column1=key1,column2=key2}",cloumn1的来源是,select的里的方法的传递的参数。
延迟加载
fetchType 是可选的,有效值为 lazy(延迟加载)和eager(立即加载),如果使用,它将取代全局配置参数lazyLoadingEnabled。