数据库查询能得到值,调用方法得到的结果是null?

错误原因:

数据库字段与实体类属性名称不一致

解决方法

使用as或使用resultmap

例如使用as

select b.id_ as id ,b.title_ as title ,b.bill_time_ as billTime,b.type_id_ as typeId,b.price_  as price ,b.explain_  as 'explain' ,bt.name_  as name from bill_ b left join bill_type_ bt on b.type_id_ =bt.id_

Guess you like

Origin blog.csdn.net/love_yr/article/details/121490595