SysOperlogController.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package com.ruoyi.system.controller;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.web.bind.annotation.DeleteMapping;
  6. import org.springframework.web.bind.annotation.GetMapping;
  7. import org.springframework.web.bind.annotation.PathVariable;
  8. import org.springframework.web.bind.annotation.PostMapping;
  9. import org.springframework.web.bind.annotation.RequestBody;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import com.ruoyi.common.core.utils.poi.ExcelUtil;
  13. import com.ruoyi.common.core.web.controller.BaseController;
  14. import com.ruoyi.common.core.web.domain.AjaxResult;
  15. import com.ruoyi.common.core.web.page.TableDataInfo;
  16. import com.ruoyi.common.log.annotation.Log;
  17. import com.ruoyi.common.log.enums.BusinessType;
  18. import com.ruoyi.common.security.annotation.InnerAuth;
  19. import com.ruoyi.common.security.annotation.RequiresPermissions;
  20. import com.ruoyi.system.api.domain.SysOperLog;
  21. import com.ruoyi.system.service.ISysOperLogService;
  22. /**
  23. * 操作日志记录
  24. *
  25. * @author ruoyi
  26. */
  27. @RestController
  28. @RequestMapping("/operlog")
  29. public class SysOperlogController extends BaseController
  30. {
  31. @Autowired
  32. private ISysOperLogService operLogService;
  33. @RequiresPermissions("system:operlog:list")
  34. @GetMapping("/list")
  35. public TableDataInfo list(SysOperLog operLog)
  36. {
  37. startPage();
  38. List<SysOperLog> list = operLogService.selectOperLogList(operLog);
  39. return getDataTable(list);
  40. }
  41. @Log(title = "操作日志", businessType = BusinessType.EXPORT)
  42. @RequiresPermissions("system:operlog:export")
  43. @PostMapping("/export")
  44. public void export(HttpServletResponse response, SysOperLog operLog)
  45. {
  46. List<SysOperLog> list = operLogService.selectOperLogList(operLog);
  47. ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
  48. util.exportExcel(response, list, "操作日志");
  49. }
  50. @Log(title = "操作日志", businessType = BusinessType.DELETE)
  51. @RequiresPermissions("system:operlog:remove")
  52. @DeleteMapping("/{operIds}")
  53. public AjaxResult remove(@PathVariable Long[] operIds)
  54. {
  55. return toAjax(operLogService.deleteOperLogByIds(operIds));
  56. }
  57. @RequiresPermissions("system:operlog:remove")
  58. @Log(title = "操作日志", businessType = BusinessType.CLEAN)
  59. @DeleteMapping("/clean")
  60. public AjaxResult clean()
  61. {
  62. operLogService.cleanOperLog();
  63. return success();
  64. }
  65. @InnerAuth
  66. @PostMapping
  67. public AjaxResult add(@RequestBody SysOperLog operLog)
  68. {
  69. return toAjax(operLogService.insertOperlog(operLog));
  70. }
  71. }