package com.sptg.gateway.controller.iot;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.iot.api.dto.IotDeviceDto;
import com.sptg.iot.api.entity.IotDevice;
import com.sptg.iot.api.feigns.IotDeviceFeign;
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;

/**
 * @author zwx
 * @create 2020/11/4 15:53
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping(value = "/grid/iot/device")
public class IotDeviceController {

    private final IotDeviceFeign iotDeviceFeign;

    /**
     * 功能描述:IOT物联网设备列表查询
     * @param iotDeviceDto IOT物联网设备业务对象（含查询条件）
     * @param page 分页条件
     * @return ResultBean<Page<IotDevice>>
     *
     *
     */
    @GetMapping(value = "/list")
    public ResultBean<Page<IotDevice>> showIotDeviceList(IotDeviceDto iotDeviceDto, Page<IotDevice> page) {
        // 暂时拿全部的数据
//        iotDeviceDto.setOrgPosition("0/1/");
        page.setSize(900000000);
        iotDeviceDto.setPage(page);
        return this.iotDeviceFeign.showIotDeviceList(iotDeviceDto);
    }
}
