package com.moral.api.controller; 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.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.Map; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.moral.api.entity.UserLog; import com.moral.api.service.UserLogService; import com.moral.constant.ResultMessage; import com.moral.util.PageResult; @Slf4j @RestController @RequestMapping("/log") @Api(tags = "日志管理") public class LogController { @Autowired private UserLogService userLogService; @ApiOperation(value = "分页查询日志", notes = "分页查询日志") @ApiImplicitParams({ @ApiImplicitParam(name = "page", value = "当前页", required = false, paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "size", value = "每页条数", required = false, paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "type", value = "操作类型,0:登陆,1:添加,2:修改,3:删除", required = false, paramType = "query", dataType = "String"), @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") }) @RequestMapping(value = "select", method = RequestMethod.POST) public ResultMessage select(@RequestBody Map parameters) { Page userLogPage = userLogService.selectLogs(parameters); PageResult pageResult = new PageResult<>( userLogPage.getTotal(), userLogPage.getPages(), userLogPage.getRecords() ); return ResultMessage.ok(pageResult); } }