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

/**
 * 楼层与设备关联 提供者
 *
 * @author ics
 * @date 2024-03-27
 */
@RestController
@RequestMapping("equipment")
public class DetailEquipmentController extends BaseController {

    @Autowired
    private IDetailEquipmentService detailEquipmentService;

    /**
     * 查询楼层与设备关联
     */
    @GetMapping("get/{id}")
    public DetailEquipment get(@PathVariable("id") Long id) {
        return detailEquipmentService.selectDetailEquipmentById(id);
    }

    /**
     * 查询楼层与设备关联列表
     */
    @RequiresPermissions("meeting:equipment:list")
    @GetMapping("list")
    public R list(DetailEquipment detailEquipment) {
        startPage();
        return result(detailEquipmentService.selectDetailEquipmentList(detailEquipment));
    }


    /**
     * 新增保存楼层与设备关联
     */
    @RequiresPermissions("meeting:equipment:add")
    @PostMapping("save")
    public R addSave(@RequestBody DetailEquipment detailEquipment) {
        return toAjax(detailEquipmentService.insertDetailEquipment(detailEquipment));
    }

    /**
     * 修改保存楼层与设备关联
     */
    @RequiresPermissions("meeting:equipment:edit")
    @PostMapping("update")
    public R editSave(@RequestBody DetailEquipment detailEquipment) {
        return toAjax(detailEquipmentService.updateDetailEquipment(detailEquipment));
    }

    /**
     * 删除楼层与设备关联
     */
    @RequiresPermissions("meeting:equipment:remove")
    @PostMapping("remove")
    public R remove(String ids) {
        return toAjax(detailEquipmentService.deleteDetailEquipmentByIds(ids));
    }

}
