81,092
社区成员
发帖
与我相关
我的任务
分享
<resultMap id="BaseResultMap" type="待封入对象model的完整路径名称" >
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="age" property="age" jdbcType="DECIMAL" />
1.column对应数据库表字段名称,property对应java属性名称,jdbcType对应数据类型。
2.定义中不区分该数据来自a表还是b表,只根据column指定的数据名来进行匹配,所以链表查询的时候要防止获取的数据重名
<select id=" 和调用接口文件中的方法名一样" resultMap="BaseResultMap" >
A.age,B.name
from tablea A
inner join tableb B on A.name(A表关联条件) = B.name(B表关联条件)
<where>
<if test="address != null">
..... //判断条件
</if>
</where>
</select>