SysOperlogController.java 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package com.boman.system.controller;
  2. import java.io.IOException;
  3. import java.util.List;
  4. import javax.servlet.http.HttpServletResponse;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.DeleteMapping;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.PathVariable;
  9. import org.springframework.web.bind.annotation.PostMapping;
  10. import org.springframework.web.bind.annotation.RequestBody;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RestController;
  13. import com.boman.common.core.utils.poi.ExcelUtil;
  14. import com.boman.common.core.web.controller.BaseController;
  15. import com.boman.common.core.web.domain.AjaxResult;
  16. import com.boman.common.core.web.page.TableDataInfo;
  17. import com.boman.common.log.annotation.Log;
  18. import com.boman.common.log.enums.BusinessType;
  19. import com.boman.common.security.annotation.PreAuthorize;
  20. import com.boman.domain.SysOperLog;
  21. import com.boman.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. @PreAuthorize(hasPermi = "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. @PreAuthorize(hasPermi = "system:operlog:export")
  43. @PostMapping("/export")
  44. public void export(HttpServletResponse response, SysOperLog operLog) throws IOException
  45. {
  46. List<SysOperLog> list = operLogService.selectOperLogList(operLog);
  47. ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
  48. util.exportExcel(response, list, "操作日志");
  49. }
  50. @PreAuthorize(hasPermi = "system:operlog:remove")
  51. @DeleteMapping("/{ids}")
  52. public AjaxResult remove(@PathVariable Long[] ids)
  53. {
  54. return toAjax(operLogService.deleteOperLogByIds(ids));
  55. }
  56. @PreAuthorize(hasPermi = "system:operlog:remove")
  57. @Log(title = "操作日志", businessType = BusinessType.CLEAN)
  58. @DeleteMapping("/clean")
  59. public AjaxResult clean()
  60. {
  61. operLogService.cleanOperLog();
  62. return AjaxResult.success();
  63. }
  64. @PostMapping
  65. public AjaxResult add(@RequestBody SysOperLog operLog)
  66. {
  67. return toAjax(operLogService.insertOperlog(operLog));
  68. }
  69. }