在使用 MyBatis if 进行条件判断时,一直不正确,如下: <if test="status!= null and status=='OK'"> result = #{result ,jdbcType=VARCHAR} </if> 123 123 MyBatis是使用的OGNL表达式来进行解析的,改成 <if test='status!= null and status== "OK" '> result = #{result ,jdbcType=VARCHAR} </if>