mysql中查询两个时间之间

类似于这样,要查询2个时间之间的数据, 时间作为查询条件,可传可不传,可传1个,可传2个.

  <if test="map.beginCreatetime != null and map.beginCreatetime != ''">
            and DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%i:%S') &gt;= DATE_FORMAT(#{map.beginCreatetime}, '%Y-%m-%d %H:%i:%S')
        </if>
        <if test="map.endCreatetime != null and map.endCreatetime != ''">
            and DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%i:%S') &lt;= DATE_FORMAT(#{map.endCreatetime}, '%Y-%m-%d %H:%i:%S')
        </if>

猜你喜欢

转载自blog.csdn.net/qq_39940205/article/details/83865531
今日推荐