| | |
| | | } |
| | | //电源id查询最大值 |
| | | int powerId = mapper.getMaxPowerId(); |
| | | powerInf.setPowerId(powerId); |
| | | powerInf.setPowerId(powerId+1); |
| | | //对站点名称进行查询,如果存在则直接绑定关系 |
| | | //如果不存在,则新增后,再绑定关系 |
| | | StationInf stationInf = stationInfService.getByStationName(powerInf.getStationName()); |
| | | Integer stationId = stationInf.getSinfId(); |
| | | if(stationInf == null){ |
| | | StationInf stationNew = new StationInf(); |
| | | stationNew.setSinfName(powerInf.getStationName()); |
| | | int stationId = stationInfService.getMaxStationId(); |
| | | stationNew.setSinfId(stationId+1); |
| | | int stationIdInDB = stationInfService.getMaxStationId(); |
| | | stationId = stationIdInDB + 1; |
| | | stationNew.setSinfId(stationId); |
| | | stationInfService.add(stationNew); |
| | | } |
| | | //站点和电源id关联 |
| | | stationPowerRelationService.add(stationId,powerId); |
| | | } |
| | | mapper.insert(powerInf); |
| | | return new Response().setII(1,"新增完成"); |
| | | } |