标签:嵌套结果 bat 查询方式 iat type from map sql _id
1、使用嵌套结果方式
sql语句:select c.* ,t.t_name from class c,teacher t where c.teacher_id = t.t_id where c.c_id = #{id}
<resultMap>
<id property="" column=""/>
<result property="" column=""/>
<association property="teacher" javaType="Teacher">
<association>
</resultMap>
2、使用嵌套查询方式
select * from class where c_id = #{id}
select * from teacher where t_id = #{teacher_id} //使用上一个查询的结果teacher_id
<resultMap>
<id property="" column=""/>
<result property="" column=""/>
<association property="teacher" column="teacher_id" select="getTeacher">
<association>
</resultMap>
标签:嵌套结果 bat 查询方式 iat type from map sql _id
原文地址:http://www.cnblogs.com/hy87/p/6213328.html