【若依框架】按时间查询数据的操作
若依框架按起止时间查询数据示例:
Date tempDate = DateUtil.offsetDay(new Date(), -days);
Map<String, Object> map = new HashMap<>();
map.put("beginRecordTime", DateUtil.beginOfHour(tempDate));
map.put("endRecordTime", new Date());
daMeter.setParams(map);
List<DaMeter> resultList = daMeterService.selectDaMeterList(daMeter);
mybatis
<select id="selectDaMeterList" parameterType="DaMeter" resultMap="DaMeterResult">
<include refid="selectDaMeterVo"/>
<where>
<if test="devId != null">
and dev_id = #{devId}
</if>
<if test="params.beginRecordTime != null and params.endRecordTime != null ">
and record_time between #{params.beginRecordTime} and #{params.endRecordTime}
</if>
</where>
order by record_time
</select>
```