package com.usky.issue.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.bean.CommonPage;
import com.usky.issue.annotation.CheckSign;
import com.usky.issue.domain.YtDeviceStatus;
import com.usky.issue.service.YtDeviceStatusService;
import com.usky.issue.service.vo.YtDeviceStatusRequestVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 离线设备VIEW 前端控制器
 * </p>
 *
 * @author fu
 * @since 2023-11-23
 */
@CrossOrigin
@RestController
@RequestMapping("/ytDeviceStatus")
public class YtDeviceStatusController {
    @Autowired
    private YtDeviceStatusService ytDeviceStatusService;

    @CheckSign
    @PostMapping("hello")
    ApiResult<String> hello(@RequestBody String requestBody){
        return ApiResult.success(requestBody);
    }

    /**
     * 离线设备查询
     * @param requestVO
     * @return
     */
    //CheckSign
    @PostMapping("page")
    ApiResult<CommonPage<YtDeviceStatus>> page(@RequestBody YtDeviceStatusRequestVO requestVO){
        return ApiResult.success(ytDeviceStatusService.page(requestVO));
    }

    /**
     * 导出
     * @param
     * @return
     */
    @GetMapping("export")
    ApiResult<List<YtDeviceStatus>> export(){
        return ApiResult.success(ytDeviceStatusService.export());
    }

    /**
     * 查询对应单位对应类型设备
     * @param
     * @return
     */
    @CheckSign
    @PostMapping("deviceList")
    ApiResult <List<Map<String, Object>>> deviceList(@RequestBody String requestBody){
        return ApiResult.success(ytDeviceStatusService.deviceList(requestBody));
    }

}

