报错信息:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘investTime‘ in ‘class java.lang.String‘ at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:76) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399) at com.sun.proxy.$Proxy30.selectOne(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:165) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:69) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) at com.sun.proxy.$Proxy36.mokuUserTotalAmount(Unknown Source)
错误写法:
<if test="investDate!=null and investDate!=‘‘"> AND invest.addtime LIKE CONCAT(‘%‘,#{investDate},‘%‘) </if>
正确写法:
<if test="_parameter!=null and _parameter!=‘‘"> AND invest.addtime LIKE CONCAT(‘%‘,#{_parameter},‘%‘) </if>
总结:
如果不用if test来判断的话,不管哪种写法都不会报错!建议都用_parameter来写,多参数用Map或者封装一个bean来做参数
There is no getter for property named 'xxx' in 'class java.lang.String
时间: 2024-12-10 12:01:01