1、映射
mybatis 通过映射,将数据库列和vo类中属性对应
<resultMaper type="com.jd.vo.Userinfo" id="ui">
//单个属性
<id column="id" property="id"/>
<result column="user_name" property="userName"/>
<result column="real_name" property="realName"/>
//泛型类
<collection property="list" ofType="com.jd.vo.Address">
<id column="id" property="id"/>
<result column="user_name" property="userName"/>
<result column="real_name" property="realName"/>
<collection/>
</resultMaper>
<select resultType="com.jd.userinfo.vo.Userinfo" id="select">
select ui.id,addr.user_id,addr.address from user_info ui left join address addr on ui.id = addr.user_id
</select>
resultMapper,type属性为vo类,i
result,column为数据库表的列名,property为映射的属性名