| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.CommonMapper; |
| | | import com.whyc.mapper.RectifierPowerHistoryMapper; |
| | | import com.whyc.mapper.RectifierPowerMapper; |
| | | import com.whyc.pojo.CentralMonitorSysST; |
| | | import com.whyc.pojo.RectifierPowerRT; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.sql.Wrapper; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class RectifierPowerService { |
| | | |
| | | @Resource |
| | | private RectifierPowerMapper mapper; |
| | | |
| | | @Resource |
| | | private RectifierPowerHistoryMapper historyMapper; |
| | | |
| | | @Resource |
| | | private CommonMapper commonMapper; |
| | | |
| | | public Response<IPage<RectifierPowerRT>> getAll(int pageNum, int pageSize) { |
| | | IPage<RectifierPowerRT> rectifierPowerRTIPage = mapper.selectPage(new Page<>(pageNum, pageSize), null); |
| | |
| | | RectifierPowerRT rectifierPowerRT = mapper.selectOne(query); |
| | | return new Response<RectifierPowerRT>().set(1,rectifierPowerRT); |
| | | } |
| | | |
| | | public Response<PageInfo<RectifierPowerRT>> getHistory(int pageNum, int pageSize, int devId) { |
| | | List<String> tableNames = commonMapper.getTableName("db_3.5mw_motor_history", "tb_rectifier_power_" + devId); |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<RectifierPowerRT> rectifierPowerRTs = historyMapper.getHistory(tableNames); |
| | | PageInfo<RectifierPowerRT> rectifierPowerRTPageInfo = new PageInfo<>(rectifierPowerRTs); |
| | | return new Response<PageInfo<RectifierPowerRT>>().set(1,rectifierPowerRTPageInfo); |
| | | } |
| | | } |