在mybatis里面
当有三张表 o,u,ui 我想用o表查到ui的数据
返回类型是 o 时 ,这个resultMapper 改怎么写呢?
下面这个mapper 的写法是对的吗?
select o.* ,ui.id as ui_id,ui.name as ui_name from order o, u_user u LEFT JOIN u_userinfo ui ON u.`id`=ui.`user_id`
where o.user_id = u.id
<resultMap id="fuckJiLianResult" type="com.ronhan.ctoc.model.Review">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="score1" jdbcType="TINYINT" property="score1" />
<result column="score2" jdbcType="TINYINT" property="score2" />
<result column="score3" jdbcType="TINYINT" property="score3" />
<result column="comments" jdbcType="VARCHAR" property="comments" />
<association column="user" property="user" javaType="com.ronhan.ctoc.model.User" resultMap="userResult"/>
</collection>
</resultMap>
<resultMap id="userResult" type="com.ronhan.ctoc.model.User">
<id column="id" jdbcType="BIGINT" property="id" />
<association column="userInfo" property="userInfo" javaType="com.ronhan.ctoc.model.UserInfo" resultMap="userInfoResult"/>
</resultMap>
<resultMap id="userInfoResult" type="com.ronhan.ctoc.model.UserInfo">
<id column="ui_id" jdbcType="BIGINT" property="id" />
<result column="ui_name" jdbcType="VARCHAR" property="name" />
<result column="ui_buys" jdbcType="Integer" property="buys" />
</resultMap>