mybatis 一對多 嵌套一對多

實體類School學校

public class School {

    private Integer SchoolId;
    private String  SchoolName;
    private List<Student>list;
    ...
}

  

學生類

public class Student {

    private Integer StudentId;
    private String  StudentName;
    ...
}

Mapper中BaseResultMap使用<collection>便籤連接

其中標籤內參數property值爲實體類School中List集合名,javaType是類型名,ofType是對應實體類定對象類型的

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章