From f0b5148973e9437f3651153e53f8f336c4c3c6ff Mon Sep 17 00:00:00 2001
From: 于紫祥_1901 <email@yuzixiang_1910>
Date: Thu, 22 Oct 2020 11:19:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 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