(1)接口中编写方法
public Emp getEmpandDept();
(2)编写Mapper文件
<resultMap type="com.eu.bean.Emp" id="emp2">
<id column="id" property="id"/>
<result column="last_name" property="lastName"/>
<result column="gender" property="geder"/>
<result column="email" property="email"/>
<result column="id" property="dept.id"/>
<result column="dept_name" property="dept.deptName"/>
</resultMap> <select id="getEmpandDept" resultMap="emp2">
SELECT *
FROM emp e
JOIN dept d
ON e.d_id=d.id
</select>