fix: 菜单查询新增字段deleted

This commit is contained in:
萌狼蓝天 2024-11-04 17:40:43 +08:00
parent 92b01751bf
commit 8e63cb4ef9
3 changed files with 15 additions and 18 deletions

View File

@ -20,4 +20,5 @@ public class MenuDataItem {
private long keepAlive;
private String target;
private String locale;
private int deleted;
}

View File

@ -10,9 +10,19 @@ import java.util.List;
@Mapper
public interface SystemMapper extends BaseMapper<MenuDataItem> {
List<SystemMenu> 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<MenuDataItem> getMenus(String roleId);
@Select("SELECT * from menu_data_item")
/**
* 查询所有菜单不区分角色
* @return
*/
@Select("SELECT * from menu_data_item where deleted!=1")
List<MenuDataItem> getMenusAll();
}

View File

@ -3,20 +3,6 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.guaiguailang.harmony.mapper.SystemMapper">
<!-- 查询所有菜单 -->
<select id="getAllMenus" resultType="com.guaiguailang.harmony.domain.entity.SystemMenu">
SELECT id,
title,
`key`,
name,
component,
redirect,
icon,
status,
parent,
`order`
FROM system_menu
ORDER BY `order`
</select>
</mapper>