package com.sptg.iot.api.feigns;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.iot.api.beans.ApiResultBean;
import com.sptg.iot.api.dto.IotApiLogDto;
import com.sptg.iot.api.entity.IotApiLog;
import com.sptg.iot.api.feigns.fallback.IotApiLogFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
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 java.util.List;
import java.util.Map;

/**
 * @author zwx
 * @create 2020/10/21 0:40
 */
@FeignClient(value = "smart-house-iot", fallbackFactory = IotApiLogFeignFallbackFactory.class)
public interface IotApiLogFeign {

    /**
     * 接口日志记录
     */
    @PostMapping(value = "/iot/apiLog/record")
    public ResultBean<String> recordIotApiLog(@RequestBody Map<String, Object> map);

    /**
     * 分页获取本地告警工单列表
     * @param iotApiLogDto
     * @return
     */
    @PostMapping(value = "/iot/apiLog/pagingQuery")
    public ResultBean<Page<IotApiLog>> pagingQuery(@RequestBody IotApiLogDto iotApiLogDto);

    /**
     * 获取本地告警工单记录
     * @param id
     * @return
     */
    @GetMapping(value = "/iot/apiLog/getApiLog/{id}")
    public IotApiLog getIotApiLogById(@PathVariable(value = "id") Long id);
}
