写个查询接口的时候报错
There is no getter for property named 'code' in 'class java.lang.String'"
sql语句为
<where>
<if test="code != null and code != ''">
code = #{code}
</if>
</where>
后来发现
错误之所以出现,是因为mybatis在对parameterType="String"
的sql语句做了限制,假如你使用<when test="code!= null">
这样的条件判断时,就会出现该错误
此处应该将 <if test="code != null and code != ''">改为
<if test="_parameter != null and _parameter != ''">
即
<where>
<if test="_parameter != null and _parameter != ''">
code = #{code}
</if>
</where>
源码分析 There is no getter for property named '*' in 'class java.lang.String_沉默王二-CSDN博客