连表后得到的数据
两个表都创建一个实体类
aoao 表实体类
sss 表实体类
在这个表的实体类中添加 aoao表这个实体类并设置tostring和get set方法
接口
User getAll(@Param("id") int id);
mapper表配置映射
<resultMap id="userResultMap" type="User">
<id property="id" column="id"></id>
<result property="ids" column="ids"></result>
<result property="names" column="name"></result>
<result property="orderdate" column="orderdate"></result>
<result property="cost" column="cost"></result>
<!--设置 aoao表级联-->
<result property="aoao.No" column="No"></result>
<result property="aoao.loginPwd" column="loginPwd"></result>
<result property="aoao.loginEmail" column="loginEmail"></result>
</resultMap>
<select id="getAll" resultMap="userResultMap">
SELECT * from sss as a1 left join aoao as a2 on a1.id = a2.`No` WHERE a1.id=#{id}
</select>
</mapper>
运行后