package com.ics.admin.controller.meeting;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ics.common.core.domain.R;
import com.ics.common.core.controller.BaseController;
import com.ics.admin.domain.meeting.RoomServeByRoom;
import com.ics.admin.service.meeting.IRoomServeByRoomService;
import org.wf.jwtp.annotation.RequiresPermissions;

/**
 * 房间主体和服务关联 提供者
 *
 * @author ics
 * @date 2024-02-25
 */
@RestController
@RequestMapping("/meeting/roomServeByRoom")
public class RoomServeByRoomController extends BaseController {

    @Autowired
    private IRoomServeByRoomService roomServeByRoomService;

    /**
     * 查询房间主体和服务关联
     */
    @GetMapping("get/{id}")
    public RoomServeByRoom get(@PathVariable("id") Long id) {
        return roomServeByRoomService.selectRoomServeByRoomById(id);
    }

    /**
     * 查询房间主体和服务关联列表
     */
    @RequiresPermissions("meeting:roomServeByRoom:list")
    @GetMapping("list")
    public R list(RoomServeByRoom roomServeByRoom) {
        startPage();
        return result(roomServeByRoomService.selectRoomServeByRoomList(roomServeByRoom));
    }


    /**
     * 新增保存房间主体和服务关联
     */
    @RequiresPermissions("meeting:roomServeByRoom:add")
    @PostMapping("save")
    public R addSave(@RequestBody RoomServeByRoom roomServeByRoom) {
        return toAjax(roomServeByRoomService.insertRoomServeByRoom(roomServeByRoom));
    }

    /**
     * 修改保存房间主体和服务关联
     */
    @RequiresPermissions("meeting:roomServeByRoom:edit")
    @PostMapping("update")
    public R editSave(@RequestBody RoomServeByRoom roomServeByRoom) {
        return toAjax(roomServeByRoomService.updateRoomServeByRoom(roomServeByRoom));
    }

    /**
     * 删除房间主体和服务关联
     */
    @RequiresPermissions("meeting:roomServeByRoom:remove")
    @PostMapping("remove")
    public R remove(String ids) {
        return toAjax(roomServeByRoomService.deleteRoomServeByRoomByIds(ids));
    }

}
