- 仅仅适用于查询对象
- 只能使用多表联合查询
- 要求:查询出的列别和属性名相同
实现方式:
"."在SQl中是关键字符,两侧添加反单引号。
<mapper namespace="com.ouc.mapper.StudentMapper">
<select id="selAll" resultType="student">
select t.tid `teacher.tid`,t.tname `teacher.tname`,sid,sname,sage,s.tid stid
from student s LEFT JOIN teacher t
on t.tid=s.tid
</select>
</mapper>
<mapper namespace="com.ouc.mapper.TeacherMapper">
select t.tid id,tname,sid `list.sid`,sname `list.sname`,sage `list.sage`,s.tid `list.tid`
from teacher t LEFT JOIN student s
on t.tid=s.tid
</mapper>