package com.ruoyi.web.controller.api; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.query.SysOperLogQuery; import com.ruoyi.system.service.ISysOperLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; 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; /** * 操作日志接口 * * @author ruoyi */ @RestController @RequestMapping("/system/operation/log") public class SysOperationLogController extends BaseController { private static final int EXPORT_PAGE_SIZE = 10000; @Autowired private ISysOperLogService operLogService; /** * 分页查询操作日志 */ @PreAuthorize("@ss.hasPermi('visitor:operation-log:view')") @PostMapping("/page") public AjaxResult page(@RequestBody(required = false) SysOperLogQuery request) { return success(operLogService.selectOperLogPageList(request == null ? new SysOperLogQuery() : request)); } /** * 导出操作日志 */ @Log(title = "操作日志", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('visitor:operation-log:export')") @PostMapping("/export") public AjaxResult export(@RequestBody(required = false) SysOperLogQuery request) { SysOperLogQuery query = request == null ? new SysOperLogQuery() : request; query.setPageNum(1); query.setPageSize(EXPORT_PAGE_SIZE); return success(operLogService.selectOperLogPageList(query).getRecords()); } }