From 2f55cebbad3dea187a5f91d16ec80a9677dab699 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 13 十一月 2024 11:16:53 +0800
Subject: [PATCH] 1

---
 src/main/java/com/yssh/controller/LocationController.java |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/yssh/controller/LocationController.java b/src/main/java/com/yssh/controller/LocationController.java
index 9997c8e..3d839ae 100644
--- a/src/main/java/com/yssh/controller/LocationController.java
+++ b/src/main/java/com/yssh/controller/LocationController.java
@@ -1,5 +1,6 @@
 package com.yssh.controller;
 
+import com.yssh.utils.CacheUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
@@ -20,13 +21,6 @@
 
 import javax.annotation.Resource;
 
-/**
- * @author wMeng
- * @ClassName YsshLocationController
- * @Description YsshLocationController
- * @date 2022/10/30 13:21
- * @Version 1.0
- */
 @Api(tags="鍘傚尯鐑偣鐐逛綅")
 @RestController
 @RequestMapping("/location")
@@ -39,7 +33,7 @@
     @GetMapping("/query")
     public Result query(
             @RequestParam(value = "name", required = false) String name,
-            @RequestParam(value = "type", required = true) String type) {
+            @RequestParam(value = "type", required = false) String type) {
         List<Location> data = locationService.query(name, type);
         return Result.OK(data);
     }
@@ -48,10 +42,16 @@
     @GetMapping("/list")
     @ApiOperation(value = "鏌ヨ鎵�鏈夌偣浣嶆暟鎹�", notes = "鏌ヨ鎵�鏈夊巶鍖虹儹鐐圭偣浣嶆暟鎹�")
     public Result list() {
-        List<Location> list = locationService.getAll();
+        //List<Location> list = locationService.getAll();
+        String key = "locationService.getAll";
+        List<Location> list = CacheUtils.getListByKey(key);
+        if (null == list) {
+            list = locationService.getAll();
+            CacheUtils.putListByKey(key, list);
+        }
+
         return Result.OK(list);
     }
-
 
     @ApiOperation(value = "鏂板鐐逛綅鏁版嵁", notes = "鏂板鐐逛綅璇︽儏鏁版嵁")
     @PostMapping

--
Gitblit v1.9.3