From e7a7b634352f684085bb6eea34b331fc069ff44d Mon Sep 17 00:00:00 2001
From: whycxzp <perryhsu@163.com>
Date: 星期五, 05 三月 2021 09:32:59 +0800
Subject: [PATCH] update api

---
 src/main/java/com/whyc/service/CentralMonitorSysSTService.java |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/whyc/service/CentralMonitorSysSTService.java b/src/main/java/com/whyc/service/CentralMonitorSysSTService.java
index 51344a5..beb52e0 100644
--- a/src/main/java/com/whyc/service/CentralMonitorSysSTService.java
+++ b/src/main/java/com/whyc/service/CentralMonitorSysSTService.java
@@ -1,19 +1,30 @@
 package com.whyc.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.whyc.dto.Response;
 import com.whyc.mapper.CentralMonitorSysRTMapper;
+import com.whyc.mapper.CentralMonitorSysSTHistoryMapper;
 import com.whyc.mapper.CentralMonitorSysSTMapper;
+import com.whyc.mapper.CommonMapper;
 import com.whyc.pojo.CentralMonitorSysRT;
 import com.whyc.pojo.CentralMonitorSysST;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 @Service
 public class CentralMonitorSysSTService {
     @Resource
     private CentralMonitorSysSTMapper mapper;
+
+    @Resource
+    private CentralMonitorSysSTHistoryMapper historyMapper;
+
+    @Resource
+    private CommonMapper commonMapper;
 
     public Response getInfoByDevId(int devId) {
         QueryWrapper<CentralMonitorSysST> queryWrapper = new QueryWrapper<>();
@@ -27,4 +38,12 @@
         }
     }
 
+    public Response<PageInfo<CentralMonitorSysST>> getHistory(int pageNum, int pageSize, int devId) {
+        List<String> tableNames = commonMapper.getTableName("db_3.5mw_motor_history", "tb_central_monitor_sys_st_" + devId);
+        PageHelper.startPage(pageNum,pageSize);
+        List<CentralMonitorSysST> centralMonitorSysSTs = historyMapper.getHistory(tableNames);
+        PageInfo<CentralMonitorSysST> centralMonitorSysSTPageInfo = new PageInfo<>(centralMonitorSysSTs);
+        return new Response<PageInfo<CentralMonitorSysST>>().set(1,centralMonitorSysSTPageInfo);
+
+    }
 }

--
Gitblit v1.9.1