记得先看是什么数据库
1.创建实体类
1.1.记得加入startTime和endTime属性用于保存前端传来的日期段
1.2 写好getter和setter方法
2.编辑dao方法类
List<实体类> queryByParams(Map<String,Object> map)
3.编辑mapper.xml文件
r为表的别名
postgresql
<where> <if test="startTime !=null and startTime !=''"> and r.createtime >= to_date('${startTime}') </if> <if test="endTime !=null and endTime !=''"> and r.createtime <= to_date('${endTime}') </if> </where>
oracle
<if test="startTime !=null and startTime !=''">
and LASTLOGINTIME >= to_date('${startTime}','yyyy/mm/dd hh24:mi:ss')
</if>
<if test="endTime !=null and endTime !=''">
and LASTLOGINTIME <= to_date('${endTime}','yyyy/mm/dd hh24:mi:ss')
</if>