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