package com.sptg.gateway.controller.iot;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.PageBean;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.device.api.dto.DeviceDto;
import com.sptg.device.api.entity.Device;
import com.sptg.device.api.feigns.DeviceFeign;
import com.sptg.iot.api.dto.IotDeviceDto;
import com.sptg.iot.api.entity.IotDevice;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created By lidexi in 2021/3/18
 **/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping(value = "/grid/doordevice")
public class DoorDeviceController {

    private DeviceFeign deviceFeign;
    /**
     * 功能描述:门禁设备列表查询
     * @param deviceDto 门禁设备设备业务对象（含查询条件）
     * @param page 分页条件
     * @return ResultBean<Page<IotDevice>>
     *
     *
     */

    @GetMapping(value = "/list")
    public ResultBean<Page<Device>> showIotDeviceList(DeviceDto deviceDto, Page<Device> page) {
        PageBean pageBean = new PageBean();
        pageBean.setDto(deviceDto);
        pageBean.setCurrent(1);
        pageBean.setSize(9000000);
        // 暂时拿全部的数据
//
        return this.deviceFeign.getPageByCondition(pageBean);
    }
}
