The original sql is written like this
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
In the returned value, owenauth_userid is of object type and the value is incorrect. Later, change the red color to owenauth_userid to get a normal value. The reason is that owenauth_userid is of bigint type in the database, so it should be written as ifnull( owenauth_userid ,0 ) as owenauth_userid