| | |
| | | } |
| | | HistoryAqi historyAqi = new HistoryAqi(); |
| | | historyAqi.setGuid(guid); |
| | | historyAqi.setTime(time); |
| | | historyAqi.setTime(DateUtils.addHours(time, -1)); |
| | | //存入数据库 |
| | | historyAqi.setValue(JSONObject.toJSONString(map)); |
| | | historyAqiMapper.insert(historyAqi); |
| | |
| | | @Override |
| | | public HistoryAqi getHistoryApiByTimeAndGuid(String guid, String time) { |
| | | QueryWrapper<HistoryAqi> wrapper_historyAqi = new QueryWrapper<>(); |
| | | wrapper_historyAqi.eq("guid",guid).eq("time",time); |
| | | wrapper_historyAqi.eq("guid", guid).eq("time", time); |
| | | HistoryAqi historyAqi = new HistoryAqi(); |
| | | if (historyAqiMapper.selectCount(wrapper_historyAqi)==1){ |
| | | if (historyAqiMapper.selectCount(wrapper_historyAqi) == 1) { |
| | | historyAqi = historyAqiMapper.selectOne(wrapper_historyAqi); |
| | | } |
| | | return historyAqi; |
| | | } |
| | | |
| | | @Override |
| | | public List<HistoryAqi> getHistoryAqi() { |
| | | String time = DateUtils.getDateStringOfHour(-1, DateUtils.yyyy_MM_dd_HH_EN) + ":00:00"; |
| | | QueryWrapper<HistoryAqi> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("time", time); |
| | | return historyAqiMapper.selectList(queryWrapper); |
| | | } |
| | | } |