Mybatis--xml 处理字符串和Boolean
字符串
<if test='startDate != null and startDate != "" ' > and status = 0 </if> 外面是单引号,里面是双引号。 如果里面是单引号,mybatis处理时是用的OGNL 的表达式, 单引号的 ('y')会被解析成字符
Boolean
<choose>
<when test="isReSend">
and (info.batchId is not null)
</when>
<otherwise>
and (info.batchId = '' or info.batchId is null)
</otherwise>
</choose>
或者
<choose>
<when test="isReSend==true">
and (info.batchId is not null)
</when>
<otherwise>
and (info.batchId = '' or info.batchId is null)
</otherwise>
</choose>

浙公网安备 33010602011771号