mybatis特殊字符轉義


使用mybatis的時候,特殊字符,例如<,>,<>,.....

需使用以下進行轉義

&lt; < 小於號  
&gt; > 大於號
&amp; &  
&apos; ' 單引號
&quot; " 雙引號

 

    <select id="selectByExampleExt" parameterType="com.cn21.redisCluster.model.AppInfoExampleExt" resultMap="BaseResultMapExt"> SELECT temp.*,r.* from ( SELECT a.* from appinfo as a where 1=1 <if test="appid != null and appid != '' "> and a.appid=#{appid,jdbcType=VARCHAR} </if> <if test="productid != null"> and a.productid=#{productid,jdbcType=INTEGER} </if> ORDER BY a.lastupdatetime DESC <if test="limitStart&gt;=0 and limit&gt;0"> (這里就是類似的 <if test="limitStart>=0 and limit>0"> LIMIT ${limitStart} , ${limit} </if> <if test="limitStart==-1 and limit&gt;0"> LIMIT ${limit} </if> ) temp,redisdb r where temp.appid = r.appid </select>

 


免責聲明!

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



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