No.1
<if test="isFlag=='Y'">
and msg.expire_time < now()
</if>
会报NumberFormatException异常,这样就可以了。
<if test="isFlag=='Y'.toString()">
and msg.expire_time < now()
</if>
No.2
<if test=" name=='hellworld' ">
<if>
这样会有问题,换成
<if test=' name=="hellworld" '>
<if>
原因:mybatis是用OGNL表达式来解析的,在OGNL的表达式中,单引号里单个字符会被解析成char类型(多个字符是可以的),java是强类型的,char 和一个string 会导致不等