Mybatis 大于小于、大于等于、小于等于等转移字符书写
程序员文章站
2024-02-24 13:44:46
...
第一种写法:
原符号 | < |
<= |
> |
>= |
& |
' |
" |
---|---|---|---|---|---|---|---|
替换符号 | < |
<= |
> |
>= |
& |
' |
" |
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 >= #{term.rqf} </if>
<if test="term.rqt!=null and term.rqt!='' "> and rq <= #{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
上一篇: 求小于等于k长度的最大区间和
下一篇: python基础练习题