| | |
| | | public Response getStationConfig() { |
| | | NjHomeStation njHomeStation=getStation(); |
| | | if(njHomeStation!=null){ |
| | | Map<String,Object> map=new HashMap<>(); |
| | | //Map<String,Object> map=new HashMap<>(); |
| | | //获取battinf信息 |
| | | QueryWrapper wrapperBinf=new QueryWrapper(); |
| | | /*QueryWrapper wrapperBinf=new QueryWrapper(); |
| | | wrapperBinf.eq("BattGroupId",njHomeStation.getBattgroupId()); |
| | | wrapperBinf.last("limit 1"); |
| | | Battinf binf=battInfMapper.selectOne(wrapperBinf); |
| | | map.put("binf",binf); |
| | | map.put("binf",binf);*/ |
| | | |
| | | //获取statinf信息 |
| | | QueryWrapper wrapperSinf=new QueryWrapper(); |
| | | wrapperSinf.eq("stationId",njHomeStation.getStationId()); |
| | | wrapperSinf.last("limit 1"); |
| | | StationInf sinf=stationInfMapper.selectOne(wrapperSinf); |
| | | map.put("sinf",sinf); |
| | | |
| | | ///map.put("sinf",sinf); |
| | | /* |
| | | //获取powerinf信息 |
| | | QueryWrapper wrapperPinf=new QueryWrapper(); |
| | | wrapperPinf.eq("PowerDeviceId",njHomeStation.getPowerDevId()); |
| | | wrapperPinf.last("limit 1"); |
| | | PowerInf pinf=powerInfMapper.selectOne(wrapperPinf); |
| | | map.put("pinf",pinf); |
| | | return new Response().setII(1,true,map,"获取首页机房配置信息"); |
| | | map.put("pinf",pinf);*/ |
| | | return new Response().setII(1,true,sinf,"获取首页机房配置信息"); |
| | | }else{ |
| | | return new Response().set(1,false,"获取首页机房配置信息"); |
| | | } |
| | | |
| | | } |
| | | //编辑首页机房配置信息 |
| | | 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) { |
| | | //先清空表后添加 |