时间段交集查询

<choose>
<when test="strategyBeginTime != null and strategyEndTime==null">
and s.begin_time>= #{strategyBeginTime,jdbcType=TIMESTAMP}
</when>
<when test="strategyEndTime != null and strategyBeginTime == null">
and s.end_time &lt;= #{strategyEndTime,jdbcType=TIMESTAMP}
</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>

猜你喜欢

转载自www.cnblogs.com/zfzf1/p/9052187.html
今日推荐