MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException

MyBatis 报了一个异常:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

### Error querying database. Cause: java.lang.NumberFormatException: For input string: "Y"

### Cause: java.lang.NumberFormatException: For input string: "Y"

原因是因为在使用动态sql的时候,我想在<if test>中判断某个属性的值是否等于"Y", 报错是因为一开始是这么写的:

<if test="isKey == 'Y'">
        AND eq.is_key_eq = 'Y'
</if>

然后将单双引号的顺序改变一下,外层单引号,内层双引号就OK了,这个设计让我很蛋疼啊!!!

<if test='isKey == "Y"'>
        AND eq.is_key_eq = 'Y'
</if>