From 8e63cb4ef9f87db66991bc8b8a9cb42c92155ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E7=8B=BC=E8=93=9D=E5=A4=A9?= Date: Mon, 4 Nov 2024 17:40:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=8F=9C=E5=8D=95=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5deleted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../harmony/domain/entity/MenuDataItem.java | 1 + .../harmony/mapper/SystemMapper.java | 16 +++++++++++++--- src/main/resources/mapper/SystemMapper.xml | 16 +--------------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/guaiguailang/harmony/domain/entity/MenuDataItem.java b/src/main/java/com/guaiguailang/harmony/domain/entity/MenuDataItem.java index 93ca9f8..c87289e 100644 --- a/src/main/java/com/guaiguailang/harmony/domain/entity/MenuDataItem.java +++ b/src/main/java/com/guaiguailang/harmony/domain/entity/MenuDataItem.java @@ -20,4 +20,5 @@ public class MenuDataItem { private long keepAlive; private String target; private String locale; + private int deleted; } diff --git a/src/main/java/com/guaiguailang/harmony/mapper/SystemMapper.java b/src/main/java/com/guaiguailang/harmony/mapper/SystemMapper.java index 65f443a..126134d 100644 --- a/src/main/java/com/guaiguailang/harmony/mapper/SystemMapper.java +++ b/src/main/java/com/guaiguailang/harmony/mapper/SystemMapper.java @@ -10,9 +10,19 @@ import java.util.List; @Mapper public interface SystemMapper extends BaseMapper { - List getAllMenus(); - @Select("SELECT * from menu_data_item where id in (select system_role_menu.menu_id from system_role_menu where role_id=#{roleId})") + /** + * 查询某个角色所拥有的菜单 + * @param roleId + * @return + */ + @Select(""" + SELECT * from menu_data_item where id in (select system_role_menu.menu_id from system_role_menu where role_id=#{roleId} and deleted!=1)""") List getMenus(String roleId); - @Select("SELECT * from menu_data_item") + + /** + * 查询所有菜单,不区分角色 + * @return + */ + @Select("SELECT * from menu_data_item where deleted!=1") List getMenusAll(); } diff --git a/src/main/resources/mapper/SystemMapper.xml b/src/main/resources/mapper/SystemMapper.xml index ecc1d37..8d6575a 100644 --- a/src/main/resources/mapper/SystemMapper.xml +++ b/src/main/resources/mapper/SystemMapper.xml @@ -3,20 +3,6 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - + \ No newline at end of file