一、sq语句中增加别名解决
<sql id="selectVoteResultVo">
select v.id,v.a,v.b,v.c,v.d,v.e,v.f,v.g,v.h,v.i,v.j,v.qrcode_key,v.number,v.votedcount,v.alive,v.time,
w.a as aa,w.b as bb,w.c as cc,w.d as dd,w.e as ee,w.f as ff,w.g as gg,w.h as hh,w.i as ii,w.j as jj,w.theme,w.deviceName from votebean v
left join word w on v.qrcode_key=w.qrcode_key
</sql>
二、resultMap中使用别名
<resultMap id="Result1" type="Bean">
<result property="id" column="id"/>
<result property="a" column="a"/>
<result property="b" column="b"/>
<result property="c" column="c"/>
<result property="d" column="d"/>
<result property="e" column="e"/>
<result property="f" column="f"/>
<result property="g" column="g"/>
<result property="h" column="h"/>
<result property="i" column="i"/>
<result property="j" column="j"/>
<association property="word" resultMap="Result2"/>
</resultMap>
<resultMap id="Result2" type="Word">
<result property="a" column="aa" javaType="String"/>
<result property="b" column="bb" javaType="String"/>
<result property="c" column="cc" javaType="String"/>
<result property="d" column="dd" javaType="String"/>
<result property="e" column="ee" javaType="String"/>
<result property="f" column="ff" javaType="String"/>
<result property="g" column="gg" javaType="String"/>
<result property="h" column="hh" javaType="String"/>
<result property="i" column="ii" javaType="String"/>
<result property="j" column="jj" javaType="String"/>
</resultMap>
MyBatis 多表联合查询,两张表中字段重复时,在配置文件中,sql语句联合查询时使用字段别名,resultMap中对应的column属性使用相应的别名