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.RoomItemByRoom;
import com.ics.admin.service.meeting.IRoomItemByRoomService;
import org.wf.jwtp.annotation.RequiresPermissions;

/**
 * 房间物品关联 提供者
 *
 * @author chen
 * @date 2024-02-25
 */
@RestController
@RequestMapping("/meeting/roomItemByRoom")
public class RoomItemByRoomController extends BaseController {

    @Autowired
    private IRoomItemByRoomService roomItemByRoomService;

    /**
     * 查询房间物品关联
     */
    @GetMapping("get/{id}")
    public RoomItemByRoom get(@PathVariable("id") Long id) {
        return roomItemByRoomService.selectRoomItemByRoomById(id);
    }

    /**
     * 查询房间物品关联列表
     */
    @RequiresPermissions("meeting:roomItemByRoomList:list")
    @GetMapping("list")
    public R list(RoomItemByRoom roomItemByRoom) {
        startPage();
        return result(roomItemByRoomService.selectRoomItemByRoomList(roomItemByRoom));
    }


    /**
     * 新增保存房间物品关联
     */
    @RequiresPermissions("meeting:roomItemByRoom:add")
    @PostMapping("save")
    public R addSave(@RequestBody RoomItemByRoom roomItemByRoom) {
        return toAjax(roomItemByRoomService.insertRoomItemByRoom(roomItemByRoom));
    }

    /**
     * 修改保存房间物品关联
     */
    @RequiresPermissions("meeting:roomItemByRoom:edit")
    @PostMapping("update")
    public R editSave(@RequestBody RoomItemByRoom roomItemByRoom) {
        return toAjax(roomItemByRoomService.updateRoomItemByRoom(roomItemByRoom));
    }

    /**
     * 删除房间物品关联
     */
    @RequiresPermissions("meeting:roomItemByRoom:remove")
    @PostMapping("remove")
    public R remove(String ids) {
        return toAjax(roomItemByRoomService.deleteRoomItemByRoomByIds(ids));
    }

}
