-
<resultMap id="myDept" type="com.stayreal.mybatis.Department">
<id column="did" property="id"/>
<result column="dept_name" property="name"/>
<!-- collection定义关联集合类型的属性封装规则
offType:指定集合中的元素类型
-->
<collection property="employees" ofType="com.stayreal.mybatis.Employee">
<id column="eid" property="id"/>
<result column="last_name" property="lastName"/>
<result column="email" property="email"/>
<result column="gender" property="gender"/>
</collection>
来源:https://www.cnblogs.com/java-ty/p/11809879.html