MyBatis的mapper.xml中SQL包含大於號等符號處理


xml處理sql的程序中,大於號小於號等符號需要進行特殊處理

按照下面的進行替換

< <= > >=
&lt; &lt;= &gt; &gt;=
 

 

 

eg:

<select id="getReading" resultMap="BaseResultMap">
        select * from files where status=2 and ifc_status=0
        <choose>
            <when test="dealBigFiles == 0">
                and size &lt;= #{maxFileSize}
            </when>
            <otherwise>
                and size &gt; #{maxFileSize}
            </otherwise>
        </choose>
        order by id asc limit 1
</select>

 


免責聲明!

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



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