错误信息
HTTP Status 500 - Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘plotId’ not found. Available parameters are [qo, param1]
type Exception report
message Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘plotId’ not found. Available parameters are [qo, param1]
description The server encountered an internal error that prevented it from fulfilling this request.
exception
…
错误截图
错误代码
<sql id="mySQL">
<where>
<if test="qo.id != null">
and id = #{qo.id}
</if>
<if test="qo.plotId != null and qo.plotId !=-1">
<!-- 错误代码 -->
and plotId=#{plotId}
</if>
</where>
</sql>
解决办法
其实就是本应从 qo(条件查询的工具类) 中取出的, 但是上面的代码中忘记写了,这也是一个低级的错误.
- 将 {plotId} 改成 {qo.plotId},如下图所示:
<if test="qo.plotId != null and qo.plotId !=-1">
<!-- 更改代码 -->
and plotId=#{qo.plotId}
</if>