首页 > 编程语言 > 详细

There is no getter for property named 'id' in 'class java.lang.Integer'

时间:2020-07-10 11:13:26      阅读:94      评论:0      收藏:0      [点我收藏+]

使用mybatis传入参数, 当参数类型是String ,Integer 等这些时。如果用他的<if test="year != null and year != ‘‘">标签判断该参数是否为空,通常会爆There is no getter for property named ‘year’ in ‘class java.lang.Integer异常。

技术分享图片

 

但是实际上实体类中写了相关的方法,最后找到问题出现在Mapper接口中,

List<EneElectricity> getProAndLiveByMonth(Integer year);

注意只需要在mapper层中修改,其它层无需改动,将代码改为:

List<EneElectricity> getProAndLiveByMonth(@Param(value="year") Integer year);

问题解决。

There is no getter for property named 'id' in 'class java.lang.Integer'

原文:https://www.cnblogs.com/wanlige/p/13278233.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!