这里只做最简单的用法,其它方法请自行查询;
一对多 collection
<collection property="要查询的实体集合" javaType="java.util.List"
ofType="要查询的实体所在包路径"
select="要查询的mapper方法"
column="关联的实体中的字段=关联的数据库中的字段"/>
举例:
<collection property="stsManageStudentList" javaType="java.util.List"
ofType="com.crm.project.domain.StsManageStudent"
select="com.crm.project.mapper.StsManageStudentMapper.selectStsManageStudentList"
column="manageId=manage_id"/>
一对一 & 多对一
<association property="要查询的实体" column="数据库中的关联字段"
javaType="要查询的实体所在包路径"
select="要查询的mapper方法"/>
举例
<association property="stsStudent" column="student_id"
javaType="com.crm.project.domain.StsStudent"
select="com.crm.project.mapper.StsStudentMapper.selectStsStudentById"/>