From 9f1cce696af7a385d7673853f517261da91af111 Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Mon, 14 Dec 2020 14:54:08 +0800
Subject: [PATCH] 修复离线设备获取AQI的BUG

---
 src/main/resources/mapper/AccountMapper.xml |   41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/AccountMapper.xml b/src/main/resources/mapper/AccountMapper.xml
index a7e353d..f981613 100644
--- a/src/main/resources/mapper/AccountMapper.xml
+++ b/src/main/resources/mapper/AccountMapper.xml
@@ -88,6 +88,19 @@
         a.account_name = #{accountName} and r.id is not null
     </select>
 
+    <select id="getScreenRoleByAccountName" resultType="int">
+         SELECT channel_id
+         from
+         (select DISTINCT channel_id FROM role_menu
+         WHERE role_id in ( select r.id from
+         role r
+         right join account_role ar on ar.role_id = r.id
+         right join account a on a.id = ar.account_id
+         where
+         a.account_name = #{accountName} and r.id is not null)) s
+         where s.channel_id=1;
+    </select>
+
     <select id="getParentMenuListsByAccountName" resultMap="MenuResultMap" parameterType="java.lang.String">
         select
         DISTINCT
@@ -108,7 +121,7 @@
             where
                 a.account_name = #{accountName} and r.is_delete=0 and r.id is not null
         )
-        where m.menu_parent_id=0
+        where m.menu_parent_id=0 and m.is_delete=0
         order by m.menu_order
     </select>
 
@@ -132,7 +145,7 @@
             where
                 a.account_name = #{accountName} and r.is_delete=0 and r.id is not null
         )
-        where m.menu_parent_id = #{id}
+        where m.menu_parent_id = #{id} and m.is_delete=0
         order by m.menu_order
     </select>
 
@@ -143,4 +156,28 @@
         where account_name = #{accountName}
     </select>
 
+    <select id="getScreenMenuListsByAccountName" resultMap="MenuResultMap" parameterType="java.lang.String">
+        select
+        DISTINCT
+        m.id,m.menu_name,m.menu_icon,m.menu_url,m.menu_order,m.menu_parent_id
+        from
+        menu m
+        right join role_menu rm on rm.channel_id = m.channel_id and rm.menu_id=m.id and m.channel_id=1
+        right join role on rm.role_id in
+        (
+            select
+                r.id
+            from
+                role r
+            right join
+                account_role ar on ar.role_id = r.id
+            right join
+                account a on a.id = ar.account_id
+            where
+                a.account_name = #{accountName} and r.is_delete=0 and r.id is not null
+        )
+        where m.menu_parent_id=0 and m.is_delete=0
+        order by m.menu_order
+    </select>
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0