| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.Page; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | |
| | | |
| | | /**分页*/ |
| | | public Response getAll(int pageNum,int pageSize) { |
| | | IPage<AFEInverterState> afeInverterStateIPage = mapper.selectPage(new Page<>(pageNum, pageSize), null); |
| | | IPage<AFEInverterState> afeInverterStateIPage = mapper.selectPage(new Page(pageNum, pageSize), null); |
| | | return new Response().set(1,afeInverterStateIPage); |
| | | } |
| | | |
| | |
| | | |
| | | /**======History======*/ |
| | | |
| | | public Response<PageInfo<AFEInverterState>> getHistory(int pageNum, int pageSize,String tablePrefixTime) { |
| | | |
| | | |
| | | public Response<PageInfo<AFEInverterState>> getHistory(int pageNum, int pageSize,int devId) { |
| | | List<String> tableNames = commonMapper.getTableName("db_3.5mw_motor_history", "tb_afe_inverter_state_" + devId); |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<AFEInverterState> afeInverterStates = historyMapper.getHistory(tableNames); |
| | | PageInfo<AFEInverterState> afeInverterStatePageInfo = new PageInfo<>(afeInverterStates); |
| | | return new Response<PageInfo<AFEInverterState>>().set(1,afeInverterStatePageInfo); |
| | | } |
| | | |
| | | /**采用二叉树*/ |
| | | /**采用N叉树(二叉树的特殊版)*/ |
| | | public Response<String> getTableNames() { |
| | | List<String> tableNames = commonMapper.getTableName("`db_3.5mw_motor`", "tb_afe_inverter_state"); |
| | | List<String> tableNames = commonMapper.getTableName("db_3.5mw_motor_history", "tb_afe_inverter_state"); |
| | | for (int i = 0; i < tableNames.size(); i++) { |
| | | String tableName = tableNames.get(i); |
| | | String year = tableName.split("_")[4]; |