MyBatis嵌套对象中的List查询

  1. <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>

posted @ 2019-11-07 08:44  JAVA之家TY  阅读(7975)  评论(0编辑  收藏  举报