时间段交集查询

<choose>
<when test="strategyBeginTime != null and strategyEndTime==null">
and #{strategyBeginTime,jdbcType=TIMESTAMP} &lt;= s.end_time
</when>
<when test="strategyEndTime != null and strategyBeginTime == null">
and #{strategyEndTime,jdbcType=TIMESTAMP} >= s.begin_time
</when>
<when test="strategyEndTime != null and strategyBeginTime != null">
and ((s.begin_time &lt;=#{strategyBeginTime} and s.end_time >#{strategyBeginTime}) or (s.begin_time >=#{strategyBeginTime} and s.begin_time&lt;=#{strategyEndTime}))
</when>
</choose>
posted @ 2018-05-17 17:26  zfzf1  阅读(255)  评论(0编辑  收藏  举报