From b8a02f8d72f56d0d18565e60133247187b7b4521 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 24 五月 2023 10:19:32 +0800
Subject: [PATCH] 1

---
 src/main/resources/mapping/QxshMapper.xml                          |    9 ++++++---
 src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java |    2 +-
 src/main/java/com/yssh/controller/WarningAnalyseController.java    |   28 ++++++++++++++--------------
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/src/main/java/com/yssh/controller/WarningAnalyseController.java b/src/main/java/com/yssh/controller/WarningAnalyseController.java
index 97bb845..2070733 100644
--- a/src/main/java/com/yssh/controller/WarningAnalyseController.java
+++ b/src/main/java/com/yssh/controller/WarningAnalyseController.java
@@ -79,15 +79,15 @@
         Object obj = CacheUtils.get(key);
         Map<String, List<Double>> map;
 
-        if (null != obj) {
-            map = (Map<String, List<Double>>) obj;
-        } else {
+        //if (null != obj) {
+        //    map = (Map<String, List<Double>>) obj;
+        //} else {
             //map = warningService.selectEachLocationDataChange();
             map = warningService.select3Hours();
-            if (null != map && map.size() > 0) {
-                CacheUtils.put(key, map);
-            }
-        }
+        //    if (null != map && map.size() > 0) {
+        //        CacheUtils.put(key, map);
+        //    }
+        //}
 
         return Result.ok(map);
     }
@@ -102,15 +102,15 @@
         Object obj = CacheUtils.get(key);
         List<Qxsh> list;
 
-        if (null != obj) {
-            list = (List<Qxsh>) obj;
-        } else {
+        //if (null != obj) {
+        //    list = (List<Qxsh>) obj;
+        //} else {
             //list = warningService.selectThisMonthLocationValueDataTop10();
             list = warningService.selectMonthTop10();
-            if (null != list && list.size() > 0) {
-                CacheUtils.put(key, list);
-            }
-        }
+        //    if (null != list && list.size() > 0) {
+        //        CacheUtils.put(key, list);
+        //    }
+        //}
 
         return Result.ok(list);
     }
diff --git a/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java b/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java
index e21bc2c..e36e1a5 100644
--- a/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java
+++ b/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java
@@ -374,7 +374,7 @@
 
     @Override
     public Map<String, List<Double>> select3Hours() {
-        Map<String, List<Double>> map = new HashMap<>();
+        Map<String, List<Double>> map = new LinkedHashMap<>();
 
         List<String> times = DateUtils.get3Hours();
         List<Qxsh> list = qxshMapper.select3Hours(times);
diff --git a/src/main/resources/mapping/QxshMapper.xml b/src/main/resources/mapping/QxshMapper.xml
index 69df436..0186e8c 100644
--- a/src/main/resources/mapping/QxshMapper.xml
+++ b/src/main/resources/mapping/QxshMapper.xml
@@ -9,9 +9,12 @@
     </select>
 
     <select id="selectMonthTop10" resultType="com.yssh.entity.Qxsh">
-        select id, name, format(value, 3) "value", time
-        from yssh_qxsh
-        where time like #{time} and name like 'AI-%'
+        with rs as (
+            select id, name, cast(value as decimal(12, 3)) "value", time
+            from yssh_qxsh
+            where time like #{time} and name like 'AI-%'
+        )
+        select id, name, value, time from rs
         order by value desc
         limit 10;
     </select>

--
Gitblit v1.9.3