| | |
| | | import com.moral.util.DateUtils; |
| | | |
| | | import com.moral.util.MybatisPLUSUtils; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Override |
| | | public void createTable(String timeUnits) { |
| | | historyHourlyMapper.createTable(timeUnits); |
| | | } |
| | | |
| | | @Override |
| | | public void createTableComplete(String timeUnits) { |
| | | historyHourlyMapper.createTableComplete(timeUnits); |
| | | } |
| | | |
| | | @Override |
| | |
| | | * @Date: 2021/9/23 |
| | | */ |
| | | @Override |
| | | public List<HistoryHourly> getValueByMacAndTime(String mac, Date startDate, Date endDate){ |
| | | public List<HistoryHourly> getValueByMacAndTime(String mac, Date startDate, Date endDate) { |
| | | QueryWrapper<HistoryHourly> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("mac",mac); |
| | | wrapper.between("time",startDate,endDate); |
| | | wrapper.eq("mac", mac); |
| | | wrapper.between("time", startDate, endDate); |
| | | List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(startDate, endDate, SeparateTableType.MONTH); |
| | | List<HistoryHourly> datas = multiTableQuery(wrapper, tableNames); |
| | | return datas; |
| | |
| | | * @Author: 陈凯裕 |
| | | * @Date: 2021/9/23 |
| | | */ |
| | | private List<HistoryHourly> multiTableQuery(QueryWrapper<HistoryHourly> wrapper,List<String> tableNames){ |
| | | private List<HistoryHourly> multiTableQuery(QueryWrapper<HistoryHourly> wrapper, List<String> tableNames) { |
| | | List<HistoryHourly> result = new ArrayList<>(); |
| | | for (String tableName : tableNames) { |
| | | MybatisPlusConfig.tableName.set(tableName); |