| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class CentralMonitorSysSTService { |
| | |
| | | @Resource |
| | | private CommonMapper commonMapper; |
| | | |
| | | public Response getInfoByDevId(int devId) { |
| | | public Response<CentralMonitorSysST> getInfoByDevId(int devId) { |
| | | QueryWrapper<CentralMonitorSysST> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("dev_id",devId); |
| | | try{ |
| | | CentralMonitorSysST centralMonitorSysST = mapper.selectOne(queryWrapper); |
| | | return new Response<>().set(1,centralMonitorSysST); |
| | | return new Response<CentralMonitorSysST>().set(1,centralMonitorSysST); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new Response<>().setCode(0); |
| | | return new Response<CentralMonitorSysST>().setCode(0); |
| | | } |
| | | } |
| | | |
| | | public Response<Map<String, List>> getField() { |
| | | Map<String,List> fieldMap = new HashMap(); |
| | | List<String> fieldNames = new LinkedList(); |
| | | fieldNames.add("A排电流"); |
| | | fieldNames.add("A排电压"); |
| | | fieldNames.add("B排电流"); |
| | | fieldNames.add("B排电压"); |
| | | |
| | | List<String> fieldValues = new LinkedList(); |
| | | fieldValues.add("curr_a"); |
| | | fieldValues.add("vol_a"); |
| | | fieldValues.add("curr_b"); |
| | | fieldValues.add("vol_b"); |
| | | |
| | | //List<String> unit = new LinkedList(); |
| | | //unit.add("A"); |
| | | //unit.add("V"); |
| | | //unit.add("A"); |
| | | //unit.add("V"); |
| | | |
| | | fieldMap.put("fieldNames",fieldNames); |
| | | fieldMap.put("fieldValues",fieldValues); |
| | | return new Response<Map<String,List>>().set(1,fieldMap); |
| | | } |
| | | |
| | | public Response<PageInfo<CentralMonitorSysST>> getHistory(int pageNum, int pageSize, int devId) { |
| | |
| | | return new Response<PageInfo<CentralMonitorSysST>>().set(1,centralMonitorSysSTPageInfo); |
| | | |
| | | } |
| | | |
| | | public Response updateStatus(int devId, int switchCloseBusScreen) { |
| | | UpdateWrapper<CentralMonitorSysST> wrapper = Wrappers.update(); |
| | | wrapper.set("switch_close_bus_screen",switchCloseBusScreen).eq("dev_id",devId); |
| | | |
| | | mapper.update(null,wrapper); |
| | | return new Response().setMsg(1,"更新成功"); |
| | | } |
| | | } |