今天遇到if 标签判断字符串不生效,导致查询结果错误:
异常sql 的mapper 文件:
<if test="isBound != null and isBound !='' and isBound == '1'">
and box_sid is not null
</if>
<if test="isBound != null and isBound !='' and isBound == '2'">
and box_sid is null
</if>
正确sql 的mapper 文件
<if test="isBound != null and isBound !='' and isBound == '1'.toString()">
and box_sid is not null
</if>
<if test="isBound != null and isBound !='' and isBound == '2'.toString()">
and box_sid is null
</if>