mybatis时间范围查询

2019-08-18  本文已影响0人  叫我胖虎大人
<if test="excStartTime!=null and excStartTime!=''">
                <![CDATA[   and DATE_FORMAT(dl.exc_start_time, '%Y-%m-%d')>=  DATE_FORMAT(#{excStartTime}, '%Y-%m-%d')   ]]>
        </if>
        <if test="excEndTime!=null and excEndTime!=''">
            <![CDATA[  and DATE_FORMAT(dl.exc_end_time, '%Y-%m-%d') <= DATE_FORMAT(#{excEndTime}, '%Y-%m-%d')    ]]>
        </if>

大于号和小于号在mybatis中不起作用,所以要转换一下.或者使用转义符.

<if test="excTimeLength != null">
       and dl.exc_time_length &gt;= #{excTimeLength,jdbcType=INTEGER}
      </if>

&lt;小于号 < &gt; 大于号>

转载至https://www.cnblogs.com/bulrush/p/10550529.html

上一篇 下一篇

猜你喜欢

热点阅读