From 453e3471e94b91169beec1e258a06a132d927011 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 02 十二月 2024 15:01:50 +0800
Subject: [PATCH] 1

---
 src/main/java/com/yssh/controller/AlertConfigController.java |   48 +++++++++++++++++++++++++++++-------------------
 1 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/yssh/controller/AlertConfigController.java b/src/main/java/com/yssh/controller/AlertConfigController.java
index dd29ecd..6640751 100644
--- a/src/main/java/com/yssh/controller/AlertConfigController.java
+++ b/src/main/java/com/yssh/controller/AlertConfigController.java
@@ -1,12 +1,13 @@
 package com.yssh.controller;
 
+import com.yssh.utils.CacheUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 
+import java.util.Date;
 import java.util.List;
 
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -18,66 +19,75 @@
 
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.yssh.entity.AlertConfig;
-import com.yssh.service.IAlertConfigService;
+import com.yssh.service.AlertConfigService;
 import com.yssh.utils.Result;
+
+import javax.annotation.Resource;
 
 @Api(tags="鍛婅閰嶇疆")
 @RestController
 @RequestMapping("/config")
 @SuppressWarnings("rawtypes")
 public class AlertConfigController {
-	
-    @Autowired
-    private IAlertConfigService alertConfigService;
+    @Resource
+    private AlertConfigService alertConfigService;
 
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "鏌ヨ鎵�鏈夊憡璀﹂厤缃暟鎹�", notes = "鏌ヨ鎵�鏈夊憡璀﹂厤缃暟鎹�")
     @GetMapping("/all")
-    public Result getAll(){
-        List<AlertConfig> list =  alertConfigService.getAll();
+    public Result getAll() {
+        List<AlertConfig> list = alertConfigService.getAll();
         return Result.OK(list);
     }
-    
+
     @ApiOperationSupport(order = 2)
     @ApiImplicitParam(name = "id", value = "鍛婅閰嶇疆缂栧彿", required = true, type = "int")
     @ApiOperation(value = "鏍规嵁缂栧彿鏌ヨ鍛婅閰嶇疆鏁版嵁璇︽儏", notes = "鏍规嵁缂栧彿鏌ヨ鍛婅閰嶇疆鏁版嵁璇︽儏")
     @GetMapping("/query/{id}")
-    public Result query(@PathVariable("id") Integer id){
-        List<AlertConfig>  data = alertConfigService.query(id);
+    public Result query(@PathVariable("id") Integer id) {
+        List<AlertConfig> data = alertConfigService.query(id);
         return Result.OK(data);
     }
 
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "鏇存柊鍛婅閰嶇疆鏁版嵁", notes = "鏍规嵁鍛婅閰嶇疆缂栧彿淇敼鍛婅閰嶇疆鏁版嵁鍐呭")
     @PutMapping
-    public Result update(@RequestBody AlertConfig config){
+    public Result update(@RequestBody AlertConfig config) {
         int row = alertConfigService.update(config);
-        if(row == 0){
+        if (row == 0) {
             return Result.error("鏇存柊澶辫触");
         }
         return Result.OK("鏇存柊鎴愬姛");
     }
-    
+
     @ApiOperationSupport(order = 4)
     @ApiOperation(value = "鏂板鍛婅閰嶇疆鏁版嵁", notes = "鏂板鍛婅閰嶇疆璇︽儏鏁版嵁")
     @PostMapping
-    public Result add(@RequestBody AlertConfig alert){
+    public Result add(@RequestBody AlertConfig alert) {
         int row = alertConfigService.insert(alert);
-        if(row == 0){
+        if (row == 0) {
             return Result.error("鏂板澶辫触");
         }
         return Result.OK("鏂板鎴愬姛");
     }
-    
+
     @ApiOperationSupport(order = 5)
     @ApiOperation(value = "鍒犻櫎鍛婅閰嶇疆鏁版嵁", notes = "鍒犻櫎鍛婅閰嶇疆璇︽儏鏁版嵁")
     @DeleteMapping("/{id}")
-    public Result delete(@PathVariable Integer id){
+    public Result delete(@PathVariable Integer id) {
         int row = alertConfigService.delete(id);
-        if(row == 0){
+        if (row == 0) {
             return Result.error("鍒犻櫎澶辫触");
         }
         return Result.OK("鍒犻櫎鎴愬姛");
     }
-    
+
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "娓呴櫎缂撳瓨", notes = "娓呴櫎缂撳瓨")
+    @GetMapping("/clearCache")
+    public Result clearCache() {
+        CacheUtils.clear();
+
+        return Result.OK("success.");
+    }
 }

--
Gitblit v1.9.3