package com.mvc.controller.log;

import com.mvc.model.ResPageModel;
import com.mvc.model.ResultGeekerModel;
import com.mvc.model.log.OperationLogModel;
import com.mvc.service.log.OperationLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Api(tags = "操作日志接口")
@RequestMapping("/OperationLogAction")
@Controller
public class OperationLogAction {

    @Resource
    private OperationLogService operationLogService;

    @ApiOperation("查询所有操作日志")
    @RequestMapping(value = "/findAllOperationLog", method = RequestMethod.POST)
    @ResponseBody
    public ResultGeekerModel findAllOperationLog(@RequestBody OperationLogModel model) {
        ResultGeekerModel resultModel;
        try {
            ResPageModel res = operationLogService.findAllOperationLog(model);
            resultModel = new ResultGeekerModel(res);
        } catch (Exception e) {
            e.printStackTrace();
            resultModel = new ResultGeekerModel(e.getMessage());
        }
        return resultModel;
    }
}
