mybatis sql出现查询的返回值为object类型问题

原来sql是这么写的 

select * from 

(select e.keyid,e.trade_sub_id,e.product_id,e.product_name,a.owenauth_userid from 

<!-- e --> (select id as keyid,trade_sub_id,product_id,product_name from ente_product where sysdate() between start_date and end_date  and ente_id=#{ente_id} ) e 

<!-- a --> left join (select ifnull(owenauth_userid,'') as owenauth_userid,trade_sub_id from ent_total_authno where isauth='1' and sysdate() between auth_start_date and auth_end_date

and owenauth_userid=#{owenauth_userid}

) a 

<!-- pro --> on e.trade_sub_id=a.trade_sub_id group by e.keyid) pro 

left join 

<!-- goo -->(select distinct g.id as gid,g.inurl,ifnull(p.mainpicurl,'') as mainpicurl from goods_mainpic p right join goods g on g.id=p.goodsid group by g.id) goo 

on goo.gid=pro.product_id

返回的值中owenauth_userid  为object类型 且取值不正确, 后来把红色改为owenauth_userid 就得到正常值了,原因是owenauth_userid在数据库是bigint类型,所以应该写成ifnull(owenauth_userid ,0) as owenauth_userid 

相关推荐