package com.diagbot.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.diagbot.dto.RespDTO;
import com.diagbot.dto.SysLoginLogDTO;
import com.diagbot.dto.SysOperationLogDTO;
import com.diagbot.facade.LogManagementFacade;
import com.diagbot.vo.SysLoginLogVO;
import com.diagbot.vo.SysOperationLogVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;


/**
 * @Description: 日志管理API
 * @author: songxl
 * @time: 2022/5/09 14:28
 */
@RestController
@Api(value = "日志管理API", tags = { "日志管理API" })
@RequestMapping("/logManage")
public class LogManagementController {
    @Autowired
    private LogManagementFacade logManagementFacade;


    @ApiOperation(value = "查看登录日志[by:songxl]")
    @PostMapping("/loginLogPage")
    public RespDTO<IPage<SysLoginLogDTO>> loginLogPage(@RequestBody SysLoginLogVO sysLoginLogVO) {
        return RespDTO.onSuc(logManagementFacade.getLoginLog(sysLoginLogVO));
    }

    @ApiOperation(value = "查看操作日志[by:songxl]")
    @PostMapping("/operationLogPage")
    public RespDTO<IPage<SysOperationLogDTO>> operationLogPage(@RequestBody SysOperationLogVO sysOperationLogVO) {
        return RespDTO.onSuc(logManagementFacade.getOperationLog(sysOperationLogVO));
    }


}