From a2d3c6f8d43fbf9daa372fea53acf50642094de4 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期六, 16 五月 2026 10:49:06 +0800
Subject: [PATCH] feat(task): 添加定时任务启用禁用功能

---
 src/main/java/com/ruoyi/device/controller/MaintenanceTaskController.java |   44 +++++++++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/ruoyi/device/controller/MaintenanceTaskController.java b/src/main/java/com/ruoyi/device/controller/MaintenanceTaskController.java
index fd8398c..7482f57 100644
--- a/src/main/java/com/ruoyi/device/controller/MaintenanceTaskController.java
+++ b/src/main/java/com/ruoyi/device/controller/MaintenanceTaskController.java
@@ -10,51 +10,57 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+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;
 
 import java.util.List;
 
-/**
- * @author :yys
- * @date : 2025/12/22 14:58
- */
-@Api(tags = "璁惧淇濆吇瀹氭椂浠诲姟绠$悊")
+@Api(tags = "Maintenance Timing Task")
 @RestController
 @RequestMapping("/deviceMaintenanceTask")
 public class MaintenanceTaskController extends BaseController {
 
-
     @Autowired
     private MaintenanceTaskService maintenanceTaskService;
 
-
     @GetMapping("/listPage")
-    @ApiOperation(value = "璁惧淇濆吇瀹氭椂浠诲姟鍒楄〃")
+    @ApiOperation(value = "Maintenance timing task list")
     public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) {
-        return maintenanceTaskService.listPage(page,maintenanceTask);
+        return maintenanceTaskService.listPage(page, maintenanceTask);
     }
 
-
     @PostMapping("/add")
-    @ApiOperation(value = "娣诲姞璁惧淇濆吇瀹氭椂浠诲姟")
-    @Log(title = "璁惧淇濆吇瀹氭椂浠诲姟", businessType = BusinessType.INSERT)
+    @ApiOperation(value = "Create maintenance timing task")
+    @Log(title = "Maintenance Timing Task", businessType = BusinessType.INSERT)
     public AjaxResult add(@RequestBody MaintenanceTask maintenanceTask) {
         return maintenanceTaskService.add(maintenanceTask);
     }
 
     @PostMapping("/update")
-    @ApiOperation(value = "淇敼璁惧淇濆吇瀹氭椂浠诲姟")
-    @Log(title = "璁惧淇濆吇瀹氭椂浠诲姟", businessType = BusinessType.UPDATE)
+    @ApiOperation(value = "Update maintenance timing task")
+    @Log(title = "Maintenance Timing Task", businessType = BusinessType.UPDATE)
     public AjaxResult update(@RequestBody MaintenanceTask maintenanceTask) {
         return maintenanceTaskService.updateByMaintenanceTaskId(maintenanceTask);
     }
 
+    @PostMapping("/changeEnable")
+    @ApiOperation(value = "Change enable status")
+    @Log(title = "Maintenance Timing Task", businessType = BusinessType.UPDATE)
+    public AjaxResult changeEnable(@RequestBody MaintenanceTask maintenanceTask) {
+        if (maintenanceTask.getId() == null || maintenanceTask.getIsEnabled() == null) {
+            return AjaxResult.error("id and isEnabled are required");
+        }
+        return maintenanceTaskService.changeEnable(maintenanceTask.getId(), maintenanceTask.getIsEnabled());
+    }
+
     @DeleteMapping("/delete")
-    @ApiOperation(value = "鍒犻櫎璁惧淇濆吇瀹氭椂浠诲姟")
-    @Log(title = "璁惧淇濆吇瀹氭椂浠诲姟", businessType = BusinessType.DELETE)
+    @ApiOperation(value = "Delete maintenance timing tasks")
+    @Log(title = "Maintenance Timing Task", businessType = BusinessType.DELETE)
     public AjaxResult delete(@RequestBody List<Long> ids) {
         return maintenanceTaskService.delete(ids);
     }
-
-
 }

--
Gitblit v1.9.3