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>
相關文章
相關標籤/搜索