mybatis字符串==问题记录
1public class Params {
2 private String arr1;
3}
比如传参 {arr1: "ss"}
1<if test="arr1 != null and arr1 == 'a'"></if>
通过字符串相等 arr1 == 'a' 会自动把 arr1 的数据转化为 number,而出现报错
1Error querying database. Cause: java.lang.NumberFormatException: For input string: "ss"
而正确写法应该这样 arr1 == "a"
1<if test='arr1 != null and arr1 == "a"'></if>
关注 “AUTRE” 微信公众号,给我留言