MyBatis:There is no getter for property named '*' in 'class java.lang.String

原文链接: https://blog.csdn.net/DengShangYu_/article/details/89853832

出现这个错误,是因为mybatis默认OGNL解析参数,所以会自动采用对象树形式取String.xxx值。

解决方法:

方法1:在方法中提前定义

public int  methodName(@Param(value="state") String state ){

  ...

}

方法2:把#{xxx}改为#{_parameter}即可。

where <if test="user_id!=null">user_id=#{user_id}</if>改成

                  where <if test="_parameter !=null">user_id=#{user_id}</if>

猜你喜欢

转载自blog.csdn.net/CHS007chs/article/details/102666691
今日推荐