1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <mapper namespace="cn.itcast.entity.DeptMapper">
<resultMap id="deptResultMap" type="Dept"> <id property="deptId" column="dept_id" /> <result property="deptName" column="dept_name" /> <result property="deptAddress" column="dept_address" /> </resultMap>
<resultMap id="deptExtResultMap" type="Dept" extends="deptResultMap"> <collection property="emps" ofType="Emp" resultMap="cn.itcast.entity.EmpMapper.empResultMap" /> </resultMap>
<select id="selectDeptEmpList" parameterType="Dept" resultMap="deptExtResultMap"> select d.*, e.* from dept d inner join emp e on d.dept_id=e.dept_id where d.dept_name like #{deptName} </select>
</mapper>
|