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 >= #{excTimeLength,jdbcType=INTEGER}
</if>
<
小于号 < >
大于号>