标签:mybatis
<!-- namespace: Mpper 接口全类名 -->
<mapper namespace="com.zelin.mybatis.one2one.ClassesMapper">
<resultMap>
<id property="id" column="c_id">
<result property="name" column="c_name"
<association property="teacher" javaType="Teacher">
<id property="id" column="t_id"/>
<result property="name" column="t_name" />
</association>
</resultMap>
<select id="getId" parameterType="int" resultMap="classesMap">
select *
from m_calss mc,m_teacher mt
where mc.teacher_id = mt.t_id
AND mc.c_id = #{id}
</select>
</mapper>
mybatis3.0 配置等值连接两种方式:resultMap和resulttype
标签:mybatis
原文地址:http://11336730.blog.51cto.com/11326730/1789736