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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM