| | |
| | | import com.moral.api.entity.*; |
| | | import com.moral.api.mapper.ServicesScopeDeviceMapper; |
| | | import com.moral.api.mapper.ServicesScopeMapper; |
| | | import com.moral.api.pojo.vo.historyMonthly.HistoryResultVo; |
| | | import com.moral.api.vo.HistoryHourlyVo; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | List<HistoryHourly> datas = multiTableQuery(mapParams, tableNames); |
| | | return datas; |
| | | } |
| | | |
| | | @Override |
| | | public List<HistoryResultVo> getAvgValueByMacAndTime(List<String> mac,String type, Date startDate, Date endDate) { |
| | | Map<String, Object> mapParams = new HashMap<>(); |
| | | mapParams.put("startTime",startDate); |
| | | mapParams.put("endTime",endDate); |
| | | mapParams.put("type",type); |
| | | mapParams.put("macs",mac); |
| | | List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(startDate, endDate, SeparateTableType.MONTH); |
| | | List<HistoryResultVo> datas = multiTableQueryAvg(mapParams, tableNames); |
| | | return datas; |
| | | } |
| | | @Override |
| | | public List<HistoryHourly> getValueByMacs(List<String> macs, String time) { |
| | | Map<String, Object> mapParams = new HashMap<>(); |
| | |
| | | return result; |
| | | } |
| | | |
| | | private List<HistoryResultVo> multiTableQueryAvg(Map<String, Object> params, List<String> tableNames) { |
| | | List<HistoryResultVo> result = new ArrayList<>(); |
| | | for (String tableName : tableNames) { |
| | | params.put("table",tableName); |
| | | List<HistoryResultVo> datas = historyHourlyMapper.listAvgResult(params); |
| | | result.addAll(datas); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * @Description: 多表查询,传入表名集合,以及条件wrapper,返回数据 |
| | | * @Param: [wrapper, tableNames] |