<!-- 一个resultMap 包含多个association --><selectid="querryAll"resultMap="res1">
select b.*,rn
from
(select d.id did,d.title,d.description,d.answer,d.create_date,t.id tid,t.realname realname,s.id sid,s.name sname,ROWNUM rn
from IN_DETAIL d left join in_teacher t
on d.teacher_id=t.id
left join IN_STUDENT s
on d.STUDENT_ID=s.ID
ORDER BY did desc
) b
where rn between #{begin} and #{end}
</select><resultMapid="res1"type="Detail"><idcolumn="did"property="id"></id><resultcolumn="title"property="title"></result><resultcolumn="description"property="description"></result><resultcolumn="answer"property="answer"></result><resultcolumn="create_date"property="create_date"></result><associationproperty="teacher"javaType="Teacher"><idcolumn="tid"property="id"></id><resultcolumn="realname"property="realname"></result></association><associationproperty="student"javaType="Student"><idcolumn="sid"property="id"></id><resultcolumn="sname"property="name"></result></association></resultMap>