package com.usoftchina.bi.server.controller.common;

import com.github.pagehelper.PageInfo;
import com.usoftchina.bi.core.base.RepCode;
import com.usoftchina.bi.core.base.RepEntity;
import com.usoftchina.bi.core.base.TestPage;
import com.usoftchina.bi.server.model.po.MessageLog;
import com.usoftchina.bi.server.model.pojo.annotation.CheckToken;
import com.usoftchina.bi.server.service.common.MessageLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author chenwei
 * @Date 2019-04-26
 */
@RestController
@RequestMapping("/messageLog")
@Api(description = "操作日志接口")
public class MessageLogController {

    @Autowired
    private MessageLogService messageLogService;

    @GetMapping("/list")
    @CheckToken
    @ApiOperation(value = "操作日志列表", notes = "操作日志列表(分页)", response = RepEntity.class)
    public RepEntity<PageInfo<MessageLog>> list(@RequestHeader String token, TestPage testPage){
        return new RepEntity<>(RepCode.success, messageLogService.list(testPage));
    }

}
