mybatis一对一查询,字段重复解决办法

一、sq语句中增加别名解决

 
        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
    

 二、resultMap中使用别名

 
        
        
        
        
        
        
        
        
        
        
        
        
    
    
        
        
        
        
        
        
        
        
        
        
    

 

      MyBatis 多表联合查询,两张表中字段重复时,在配置文件中,sql语句联合查询时使用字段别名,resultMap中对应的column属性使用相应的别名

你可能感兴趣的:(项目记录)