批量保存一条信息

// 网关保存
    @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();
    }// ...
 

猜你喜欢

转载自blog.csdn.net/LRXmrlirixing/article/details/84400149