Mybatis 大于小于、大于等于、小于等于等转移字符书写

 

第一种写法:

原符号 < <= > >= & ' "
替换符号 &lt; &lt;= &gt; &gt;= &amp; &apos; &quot;

SQL示例如下:

 select * from (
            select * from (<include refid="baseOrderInfoVo" />) a
            union all
            select * from (<include refid="baseOrderReturnVo" />) b
            union all
            select * from (<include refid="baseSpjhdVo" />) c
        ) billdtovo
        <where>
            <if test="term.q!=null and term.q!='' "> and djbh like concat('%',#{term.q},'%') </if>
            <if test="term.djlx!=null and term.djlx!='' ">and  djlx=#{term.djlx} </if>
            <if test="term.state!=null  ">and  status=#{term.state} </if>
            <if test="term.rqf!=null and term.rqf!='' "> and rq &gt;= #{term.rqf} </if>
            <if test="term.rqt!=null and term.rqt!='' "> and rq &lt;= #{term.rqt} </if>
        </where>
        order by djlx,rq,djbh

第二种写法:

大于等于 <![CDATA[ >= ]]>
小于等于 <![CDATA[ <= ]]>

SQL示例如下:

   select * from (
            select * from (<include refid="baseOrderInfoVo" />) a
            union all
            select * from (<include refid="baseOrderReturnVo" />) b
            union all
            select * from (<include refid="baseSpjhdVo" />) c
        ) billdtovo
        <where>
            <if test="term.q!=null and term.q!='' "> and djbh like concat('%',#{term.q},'%') </if>
            <if test="term.djlx!=null and term.djlx!='' ">and  djlx=#{term.djlx} </if>
            <if test="term.state!=null  ">and  status=#{term.state} </if>
            <if test="term.rqf!=null and term.rqf!='' "> and rq <![CDATA[ >= ]]> #{term.rqf} </if>
            <if test="term.rqt!=null and term.rqt!='' "> and rq <![CDATA[ <= ]]> #{term.rqt} </if>
        </where>
        order by djlx,rq,djbh
上一篇:区分接口继承和实现继承


下一篇:智能指针(二)智能指针和哑类