关联集合对象

【关联集合对象】1.Teacher.java
private List list;//添加list,查找老师的所有学生
2.TeacherMapper.xml








select * from teacher


3.StudentMapper.xml


select * from student where tid=#{0}


使用实现加载集合数据(联合查询方式)
1.在TeacherMapper.xml中配置



//List list






select t.id tid,t.name tname,s.id sid.s.name sname,age,tid from teacher t LEFT JOIN student s on t.id=s.id

    推荐阅读