MyBatis的Mapper.xml文件中关于字符串的判断写法 Coder_文小白 2024-07-15 192 阅读1分钟 在mybatis的Mapper.xml文件中,如果需要在<if>标签中判断字符串是否相等,是不能使用: <if test="str == '0'"></if> 这种方式的。 解决方式有两种: 使用toString()方法: <if test="str == '0'.toString() "></if> 使用单引号嵌套双引号的方法: <if test='str == "0" '></if>