xml中處理大於號小於號的方法(Mybati中大於、小於)


xml中處理大於號小於號的方法(Mybati中大於、小於)

1. 使用轉義字符

&lt; < 小於號
&gt; > 大於號
&amp; &
&apos; 單引號
&quot; " 雙引號
<if test="searchTimeBegin != null and searchTimeBegin != ''">
    AND tcci.consume_time &gt;= CONCAT(#{searchTimeBegin},' 00:00:00')
</if>
<if test="searchTimeEnd != null and searchTimeEnd != ''">
    AND tcci.consume_time &lt;= CONCAT(#{searchTimeEnd},' 23:59:59')
</if>

2. 使用<![CDATA[ ]]>符號

在XML文件中的<![CDATA[ ]]>這里面的內容將不被解析

    <if test="beginTime!=null">
      AND DATE (os.show_start_time) >= DATE(#{beginTime})
    </if>
    <if test="endTime!=null">
      AND DATE (os.show_start_time) <![CDATA[<=]]> DATE(#{endTime})
    </if>


免責聲明!

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



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