主要是时间,时间,时间!
首先,你要有项目中的一段SQL代码(这里是mybatis中的):
select * from news
where news_status=true and
department_id =
#{departmentId,jdbcType=VARCHAR}
and news_type =
#{newsType,jdbcType=VARCHAR}
and classes_id =
#{classesId,jdbcType=VARCHAR}
and ( news_date between
#{startDate,jdbcType=DATE} and
#{endDate,jdbcType=DATE} )
<if test="createDate != null">
and create_date = #{newsDate,jdbcType=DATE}
</if>
order by
news_date,news_time,news_time_quantum asc,update_date
desc
改写后的SQL
select * from news
where news_status=true and
department_id = '132433'
and news_type = '摄影'
and classes_id = '201506'
and ( news_date between
to_date('2015-10-20', 'yyyy-MM-dd')
and to_date('2015-11-16', 'yyyy-MM-dd') )
and create_date = to_date('2015-10-16', 'yyyy-MM-dd')
order by
news_date,news_time,news_time_quantum asc,update_date
desc