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

/**
 * 用户开门记录 提供者
 *
 * @author ics
 * @date 2024-03-11
 */
@RestController
@RequestMapping("record")
public class RoomRecordController extends BaseController {

    @Autowired
    private IRoomRecordService roomRecordService;

    /**
     * 查询用户开门记录
     */
    @GetMapping("get/{id}")
    public RoomRecord get(@PathVariable("id") Long id) {
        return roomRecordService.selectRoomRecordById(id);
    }

    /**
     * 查询用户开门记录列表
     */
    @RequiresPermissions("meeting:record:list")
    @GetMapping("list")
    public R list(RoomRecord roomRecord) {
        startPage();
        return result(roomRecordService.selectRoomRecordList(roomRecord));
    }


    /**
     * 新增保存用户开门记录
     */
    @RequiresPermissions("meeting:record:add")
    @PostMapping("save")
    public R addSave(@RequestBody RoomRecord roomRecord) {
        return toAjax(roomRecordService.insertRoomRecord(roomRecord));
    }

    /**
     * 修改保存用户开门记录
     */
    @RequiresPermissions("meeting:record:edit")
    @PostMapping("update")
    public R editSave(@RequestBody RoomRecord roomRecord) {
        return toAjax(roomRecordService.updateRoomRecord(roomRecord));
    }

    /**
     * 删除用户开门记录
     */
    @RequiresPermissions("meeting:record:remove")
    @PostMapping("remove")
    public R remove(String ids) {
        return toAjax(roomRecordService.deleteRoomRecordByIds(ids));
    }

}
