| | |
| | | |
| | | } |
| | | //编辑首页机房配置信息 |
| | | public Response updateStationConfig(NjHomeStation njHomeConfig) { |
| | | mapper.update(njHomeConfig, null); |
| | | public Response updateStationConfig(int stationId) { |
| | | NjHomeStation njHomeStation=getStation(); |
| | | NjHomeStation nj=getStationById(stationId); |
| | | if(njHomeStation!=null){//判断表中是否有数据 |
| | | mapper.update(nj, null); |
| | | }else{ |
| | | mapper.insert(nj); |
| | | } |
| | | return new Response().set(1,true); |
| | | } |
| | | //获根据stationId获取信息 |
| | | public NjHomeStation getStationById(int stationId) { |
| | | NjHomeStation njHomeStation=new NjHomeStation(); |
| | | njHomeStation.setStationId(stationId); |
| | | //获取battinf信息 |
| | | QueryWrapper wrapperBinf=new QueryWrapper(); |
| | | wrapperBinf.eq("stationId",stationId); |
| | | wrapperBinf.last("limit 1"); |
| | | Battinf binf=battInfMapper.selectOne(wrapperBinf); |
| | | if(binf!=null){ |
| | | njHomeStation.setBattgroupId(binf.getBattGroupId()); |
| | | njHomeStation.setDevId(Integer.valueOf(String.valueOf(binf.getFBSDeviceId()))); |
| | | }else { |
| | | njHomeStation.setBattgroupId(0); |
| | | njHomeStation.setDevId(0); |
| | | } |
| | | |
| | | |
| | | //获取powerinf信息 |
| | | QueryWrapper wrapperPinf=new QueryWrapper(); |
| | | wrapperPinf.eq("stationId",stationId); |
| | | wrapperPinf.last("limit 1"); |
| | | PowerInf pinf=powerInfMapper.selectOne(wrapperPinf); |
| | | if(pinf!=null){ |
| | | njHomeStation.setPowerDevId(pinf.getPowerDeviceId()); |
| | | }else { |
| | | njHomeStation.setPowerDevId(0); |
| | | } |
| | | return njHomeStation; |
| | | } |
| | | //添加默认首页机房配置信息 |
| | | public Response addStationConfig(NjHomeStation njHomeStation) { |
| | | //先清空表后添加 |