package com.fdage.controller;

import com.fdage.aop.WebControllerLog;
import com.fdage.pojo.TbLog;
import com.fdage.request.RequestLog;
import com.fdage.service.ILogService;
import com.fdage.util.AjaxJson;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Hb_zzZ on 2020/7/28.
 */
@Controller
@RequestMapping("/zhoushan/log")
@Slf4j
@Api(tags = "sys-工作日志模块")
public class LogController {

    @Autowired
    private ILogService logService;

    @PostMapping("list")
    @ResponseBody
    @WebControllerLog(description = "工作日志-获取日志列表")
    @ApiOperation("获取日志列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "资讯类型，0表示海报，1表示视频", dataType = "String"),
            @ApiImplicitParam(name = "name", value = "资讯名称", dataType = "String"),
            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
    public AjaxJson list(@RequestBody RequestLog bo){
        List<TbLog> list = logService.findList(bo);
        PageInfo<TbLog> pageInfo = new PageInfo<>(list);
        return AjaxJson.success(pageInfo);
    }
}
