package com.sptg.video.cloud.biz.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.PageBean;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.video.cloud.api.dto.VCApiLogDto;
import com.sptg.video.cloud.api.entity.VCApiLog;
import com.sptg.video.cloud.api.feigns.VCApiLogFeign;
import com.sptg.video.cloud.biz.service.VCApiLogServiceInterface;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author zwx
 * @create 2020/11/18 19:26
 */
@Slf4j
@RestController
@RequiredArgsConstructor
public class VCApiLogController implements VCApiLogFeign {

    private final VCApiLogServiceInterface vcApiLogServiceInterface;

    @Override
    @PostMapping(value = "/vcApiLog/pagingQuery")
    public ResultBean<Page<VCApiLog>> pagingQuery(@RequestBody PageBean<VCApiLog, VCApiLogDto> pageBean) {
        Page<VCApiLog> apiLogPage = this.vcApiLogServiceInterface.pagingQuery(pageBean);
        return new ResultBean<>(ResultEnum.SUCCESS, apiLogPage);
    }

    @Override
    @GetMapping(value = "/vcApiLog/findById/{id}")
    public VCApiLog findById(@PathVariable(value = "id") Long id) {
        return this.vcApiLogServiceInterface.findById(id);
    }
}
