需求是进行列表查询,传如的参数是string,数据库的类型是timestamp(对应java的date)
mybatis 中做一下处理:
<if test="createBeginTime != null and createBeginTime != ''">
and create_time <![CDATA[ >= ]]> DATE_FORMAT(#{createBeginTime},'%Y-%m-%d %h:%i:%S')
</if>
<if test="createEndTime != null and createEndTime !=''">
and create_time <![CDATA[ <= ]]> DATE_FORMAT(#{createEndTime},'%Y-%m-%d %h:%i:%S')
</if>
如下:
数据库:
内容扩展:https://www.cnblogs.com/winner-0715/p/5912157.html