<!-- 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>
时间: 2024-11-01 04:26:11