package com.ruoyi.ems.controller;

import com.huashe.common.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.ems.domain.EmsObjAbilityCallLog;
import com.ruoyi.ems.domain.EmsObjEventLog;
import com.ruoyi.ems.service.IEmsObjAbilityCallLogService;
import com.ruoyi.ems.service.IEmsObjEventLogService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用电业务Controller
 *
 * @author ruoyi
 * @date 2024-07-23
 */
@RestController
@RequestMapping("/object/log")
@Api(value = "EmsObjLogController", description = "能源对象日志服务")
public class EmsObjLogController extends BaseController {
    /**
     * 事件日志
     */
    @Autowired
    private IEmsObjEventLogService eventLogService;

    /**
     * 能力调用日志
     */
    @Autowired
    private IEmsObjAbilityCallLogService abilityCallLogService;

    /**
     * 获取上报日志详细
     */
    @GetMapping(value = "/eventLog/{id}")
    public AjaxResult getEventLogInfo(@PathVariable("id") Long id) {
        return success(eventLogService.selectLogById(id));
    }

    /**
     * 查询上报日志列表
     */
    @GetMapping("/eventLog/list")
    public TableDataInfo listEventLog(EmsObjEventLog param) {
        startPage();
        List<EmsObjEventLog> list = eventLogService.selectLog(param);
        return getDataTable(list);
    }

    /**
     * 获取上报日志详细
     */
    @GetMapping(value = "/callLog/{id}")
    public AjaxResult getCallLogInfo(@PathVariable("id") Long id) {
        return success(abilityCallLogService.selectLogById(id));
    }

    /**
     * 查询上报日志列表
     */
    @GetMapping("/callLog/list")
    public TableDataInfo listCallLog(EmsObjAbilityCallLog param) {
        startPage();
        List<EmsObjAbilityCallLog> list = abilityCallLogService.selectLogList(param);
        return getDataTable(list);
    }
}
