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>

 

posted @ 2019-08-05 13:50  walkerluo  阅读(3689)  评论(0编辑  收藏  举报