码迷,mamicode.com
首页 > 其他好文 > 详细

MyBatis特殊字符转义

时间:2016-09-08 19:55:33      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:

使用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>

 

MyBatis特殊字符转义

标签:

原文地址:http://www.cnblogs.com/parryyang/p/5854075.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!