批量儲存一條資訊
阿新 • • 發佈:2018-12-04
// 閘道器儲存
@RequestMapping(value = "/gatewayUpdate/{roomid}", method = RequestMethod.POST)
@ResponseBody
public ApiResponseResult add(Long hotelId, Long gwId, String roomid, Model model) {
String[] ary = roomid.split(",");
Hotel s = hotelService.getHotel(hotelId);
for (int i = 0; i < ary.length; i++) {
Room room = roomService.getRoom(Long.parseLong(ary[i]));
room.setHotel(s);
if (gwId != null) {
GatewayInfo gate = gatewayInfoService.getGatewayInfo(gwId);
room.setGwId(gate);
room.setSuccessRegister(0);
}
roomService.addOrUpdate(room);
}
return ApiResponseResult.success();
}// ...