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