package cn.lihongjie.coal.acDeviceData.controller;

import cn.lihongjie.coal.acDeviceData.dto.AcDeviceDataDto;
import cn.lihongjie.coal.acDeviceData.dto.AcDeviceDataReportRequest;
import cn.lihongjie.coal.acDeviceData.dto.CreateAcDeviceDataDto;
import cn.lihongjie.coal.acDeviceData.dto.UpdateAcDeviceDataDto;
import cn.lihongjie.coal.acDeviceData.service.AcDeviceDataService;
import cn.lihongjie.coal.annotation.OrgScope;
import cn.lihongjie.coal.annotation.SysLog;
import cn.lihongjie.coal.base.dto.CommonQuery;
import cn.lihongjie.coal.base.dto.IdRequest;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
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;

@RestController
@RequestMapping("/acDeviceData")
@SysLog(module = "门禁设备数据")
@Slf4j
@OrgScope
public class AcDeviceDataController {
    @Autowired private AcDeviceDataService service;

    @PostMapping("/create")
    public AcDeviceDataDto create(@RequestBody CreateAcDeviceDataDto request) {
        return this.service.create(request);
    }

    @PostMapping("/update")
    public AcDeviceDataDto update(@RequestBody UpdateAcDeviceDataDto request) {
        return this.service.update(request);
    }

    @PostMapping("/delete")
    public Object delete(@RequestBody IdRequest request) {
        this.service.delete(request);
        return true;
    }

    @PostMapping("/getById")
    public AcDeviceDataDto getById(@RequestBody IdRequest request) {
        return this.service.getById(request.getId());
    }

    @PostMapping("/list")
    public Page<AcDeviceDataDto> list(@RequestBody CommonQuery request) {
        
        
        return this.service.list(request);
    }

    @PostMapping("/report")
    public Page report(@RequestBody AcDeviceDataReportRequest request) {
        return this.service.report(request);
    }
}
