SysOperlogController.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.fjhx.base.monitor;
  2. import com.baomidou.dynamic.datasource.annotation.DS;
  3. import com.ruoyi.common.annotation.Log;
  4. import com.ruoyi.common.constant.DatasourceConstant;
  5. import com.ruoyi.common.core.controller.BaseController;
  6. import com.ruoyi.common.core.domain.AjaxResult;
  7. import com.ruoyi.common.core.page.TableDataInfo;
  8. import com.ruoyi.common.enums.BusinessType;
  9. import com.ruoyi.common.utils.poi.ExcelUtil;
  10. import com.ruoyi.system.domain.SysOperLog;
  11. import com.ruoyi.system.service.ISysOperLogService;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.security.access.prepost.PreAuthorize;
  14. import org.springframework.web.bind.annotation.*;
  15. import javax.servlet.http.HttpServletResponse;
  16. import java.util.List;
  17. /**
  18. * 操作日志记录
  19. *
  20. * @author ruoyi
  21. */
  22. @DS(DatasourceConstant.BASE)
  23. @RestController
  24. @RequestMapping("/monitor/operlog")
  25. public class SysOperlogController extends BaseController {
  26. @Autowired
  27. private ISysOperLogService operLogService;
  28. @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
  29. @GetMapping("/list")
  30. public TableDataInfo list(SysOperLog operLog) {
  31. startPage();
  32. List<SysOperLog> list = operLogService.selectOperLogList(operLog);
  33. return getDataTable(list);
  34. }
  35. @Log(title = "操作日志", businessType = BusinessType.EXPORT)
  36. @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
  37. @PostMapping("/export")
  38. public void export(HttpServletResponse response, SysOperLog operLog) {
  39. List<SysOperLog> list = operLogService.selectOperLogList(operLog);
  40. ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
  41. util.exportExcel(response, list, "操作日志");
  42. }
  43. @Log(title = "操作日志", businessType = BusinessType.DELETE)
  44. @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
  45. @DeleteMapping("/{operIds}")
  46. public AjaxResult remove(@PathVariable Long[] operIds) {
  47. return toAjax(operLogService.deleteOperLogByIds(operIds));
  48. }
  49. @Log(title = "操作日志", businessType = BusinessType.CLEAN)
  50. @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
  51. @DeleteMapping("/clean")
  52. public AjaxResult clean() {
  53. operLogService.cleanOperLog();
  54. return success();
  55. }
  56. }