From 9a30a3a8d3862a9b2ce898535b7cb51c3ddac816 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期三, 20 五月 2026 16:01:11 +0800
Subject: [PATCH] refactor(controller): 将控制器响应结果统一为R类型并继承BaseController
---
src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java | 140 +++++++++++++++++++++++-----------------------
1 files changed, 70 insertions(+), 70 deletions(-)
diff --git a/src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java b/src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java
index 81bab02..ee36e80 100644
--- a/src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java
+++ b/src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java
@@ -1,70 +1,70 @@
-package com.ruoyi.project.monitor.controller;
-
-import java.util.List;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.monitor.domain.SysOperLog;
-import com.ruoyi.project.monitor.service.ISysOperLogService;
-
-/**
- * 鎿嶄綔鏃ュ織璁板綍
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/operlog")
-@AllArgsConstructor
-public class SysOperlogController extends BaseController
-{
- private ISysOperLogService operLogService;
-
- @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysOperLog operLog)
- {
- startPage();
- List<SysOperLog> list = operLogService.selectOperLogList(operLog);
- return getDataTable(list);
- }
-
- @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.EXPORT)
- @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysOperLog operLog)
- {
- List<SysOperLog> list = operLogService.selectOperLogList(operLog);
- ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
- util.exportExcel(response, list, "鎿嶄綔鏃ュ織");
- }
-
- @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.DELETE)
- @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
- @DeleteMapping("/{operIds}")
- public AjaxResult remove(@PathVariable Long[] operIds)
- {
- return toAjax(operLogService.deleteOperLogByIds(operIds));
- }
-
- @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.CLEAN)
- @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
- @DeleteMapping("/clean")
- public AjaxResult clean()
- {
- operLogService.cleanOperLog();
- return success();
- }
-}
+package com.ruoyi.project.monitor.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.monitor.domain.SysOperLog;
+import com.ruoyi.project.monitor.service.ISysOperLogService;
+
+/**
+ * 鎿嶄綔鏃ュ織璁板綍
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/operlog")
+@AllArgsConstructor
+public class SysOperlogController extends BaseController
+{
+ private ISysOperLogService operLogService;
+
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysOperLog operLog)
+ {
+ startPage();
+ List<SysOperLog> list = operLogService.selectOperLogList(operLog);
+ return getDataTable(list);
+ }
+
+ @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysOperLog operLog)
+ {
+ List<SysOperLog> list = operLogService.selectOperLogList(operLog);
+ ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
+ util.exportExcel(response, list, "鎿嶄綔鏃ュ織");
+ }
+
+ @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.DELETE)
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
+ @DeleteMapping("/{operIds}")
+ public R<?> remove(@PathVariable Long[] operIds)
+ {
+ operLogService.deleteOperLogByIds(operIds);
+ return R.ok();
+ }
+
+ @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.CLEAN)
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
+ @DeleteMapping("/clean")
+ public R<?> clean()
+ {
+ operLogService.cleanOperLog();
+ return R.ok();
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.3