MyBatis xml 传 boolean 布尔类型

使用 choose 标签

1
2
3
4
5
6
7
8
<choose>
<when test="isReSend">
and (info.batchId is not null)
</when>
<otherwise>
and (info.batchId = '' or info.batchId is null)
</otherwise>
</choose>

或者

1
2
3
4
5
6
7
8
<choose>
<when test="isReSend==true">
and (info.batchId is not null)
</when>
<otherwise>
and (info.batchId = '' or info.batchId is null)
</otherwise>
</choose>