SQL按时间段对数据进行筛选

<if test="s_time != e_time">
<if test="s_time !=null and s_time !=''">
         AND str_to_date(A.REC_TIME,'%Y-%m-%d') <![CDATA[>=]]>str_to_date(#{s_time},'%Y-%m-%d')
 </if>
 <if  test="e_time !=null and  e_time !=''">
        AND str_to_date(A.REC_TIME,'%Y-%m-%d') <![CDATA[<=]]>str_to_date(#{e_time},'%Y-%m-%d')
</if>
</if>
<if test="s_time !=null and s_time !='' and  e_time !=null and  e_time !='' and s_time == e_time  ">
       AND str_to_date(A.REC_TIME,'%Y-%m-%d') <![CDATA[=]]>str_to_date(#{s_time},'%Y-%m-%d')
 </if>

猜你喜欢

转载自blog.csdn.net/qt_lls/article/details/87882030