Mybatis reports an error: Error evaluating expression

Error message :

mybatis报错:Error evaluating expression ‘stu.id != null AND stu.id != ‘’’. Cause: org

Such an error was reported in the mapper file of mybatis

Error evaluating expression 'id != null AND id != '' '

The sql statement is as follows:

<select id="xxx" parameterType="yyy" resultType="zz">
 select * from stu
 <where>
  <if test="id != null AND id != '' ">
   and id = #{id}
  </if>
  <!-- ... -->
 </where>
</select>
Problem solved : the and of the expression in the test of the if tag cannot be written as uppercase AND

Guess you like

Origin blog.csdn.net/weixin_64854388/article/details/131738785