Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cocktail-party-server
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cocktail-party
cocktail-party-server
Commits
a96d4bf2
提交
a96d4bf2
authored
6月 29, 2024
作者:
RuoYi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
菜单管理新增路由名称
上级
8264b8fb
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
42 行增加
和
11 行删除
+42
-11
SysMenu.java
...ain/java/com/ruoyi/common/core/domain/entity/SysMenu.java
+17
-2
SysMenuServiceImpl.java
...ava/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
+17
-5
SysMenuMapper.xml
...system/src/main/resources/mapper/system/SysMenuMapper.xml
+8
-4
ry_20240629.sql
sql/ry_20240629.sql
+0
-0
没有找到文件。
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java
浏览文件 @
a96d4bf2
...
...
@@ -42,6 +42,9 @@ public class SysMenu extends BaseEntity
/** 路由参数 */
private
String
query
;
/** 路由名称,默认和路由地址相同的驼峰格式(注意:因为vue3版本的router会删除名称相同路由,为避免名字的冲突,特殊情况可以自定义) */
private
String
routeName
;
/** 是否为外链(0是 1否) */
private
String
isFrame
;
...
...
@@ -53,7 +56,7 @@ public class SysMenu extends BaseEntity
/** 显示状态(0显示 1隐藏) */
private
String
visible
;
/** 菜单状态(0正常 1停用) */
private
String
status
;
...
...
@@ -151,6 +154,16 @@ public class SysMenu extends BaseEntity
this
.
query
=
query
;
}
public
String
getRouteName
()
{
return
routeName
;
}
public
void
setRouteName
(
String
routeName
)
{
this
.
routeName
=
routeName
;
}
public
String
getIsFrame
()
{
return
isFrame
;
...
...
@@ -232,7 +245,7 @@ public class SysMenu extends BaseEntity
{
this
.
children
=
children
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
@@ -242,6 +255,8 @@ public class SysMenu extends BaseEntity
.
append
(
"orderNum"
,
getOrderNum
())
.
append
(
"path"
,
getPath
())
.
append
(
"component"
,
getComponent
())
.
append
(
"query"
,
getQuery
())
.
append
(
"routeName"
,
getRouteName
())
.
append
(
"isFrame"
,
getIsFrame
())
.
append
(
"IsCache"
,
getIsCache
())
.
append
(
"menuType"
,
getMenuType
())
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
浏览文件 @
a96d4bf2
...
...
@@ -188,7 +188,7 @@ public class SysMenuServiceImpl implements ISysMenuService
RouterVo
children
=
new
RouterVo
();
children
.
setPath
(
menu
.
getPath
());
children
.
setComponent
(
menu
.
getComponent
());
children
.
setName
(
StringUtils
.
capitalize
(
menu
.
getPath
()));
children
.
setName
(
getRouteName
(
menu
.
getRouteName
(),
menu
.
getPath
()));
children
.
setMeta
(
new
MetaVo
(
menu
.
getMenuName
(),
menu
.
getIcon
(),
StringUtils
.
equals
(
"1"
,
menu
.
getIsCache
()),
menu
.
getPath
()));
children
.
setQuery
(
menu
.
getQuery
());
childrenList
.
add
(
children
);
...
...
@@ -203,7 +203,7 @@ public class SysMenuServiceImpl implements ISysMenuService
String
routerPath
=
innerLinkReplaceEach
(
menu
.
getPath
());
children
.
setPath
(
routerPath
);
children
.
setComponent
(
UserConstants
.
INNER_LINK
);
children
.
setName
(
StringUtils
.
capitalize
(
routerPath
));
children
.
setName
(
getRouteName
(
menu
.
getRouteName
(),
routerPath
));
children
.
setMeta
(
new
MetaVo
(
menu
.
getMenuName
(),
menu
.
getIcon
(),
menu
.
getPath
()));
childrenList
.
add
(
children
);
router
.
setChildren
(
childrenList
);
...
...
@@ -354,13 +354,25 @@ public class SysMenuServiceImpl implements ISysMenuService
*/
public
String
getRouteName
(
SysMenu
menu
)
{
String
routerName
=
StringUtils
.
capitalize
(
menu
.
getPath
());
// 非外链并且是一级目录(类型为目录)
if
(
isMenuFrame
(
menu
))
{
r
outerName
=
StringUtils
.
EMPTY
;
r
eturn
StringUtils
.
EMPTY
;
}
return
routerName
;
return
getRouteName
(
menu
.
getRouteName
(),
menu
.
getPath
());
}
/**
* 获取路由名称,如没有配置路由名称则取路由地址
*
* @param routerName 路由名称
* @param path 路由地址
* @return 路由名称(驼峰格式)
*/
public
String
getRouteName
(
String
name
,
String
path
)
{
String
routerName
=
StringUtils
.
isNotEmpty
(
name
)
?
name
:
path
;
return
StringUtils
.
capitalize
(
routerName
);
}
/**
...
...
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
浏览文件 @
a96d4bf2
...
...
@@ -13,6 +13,7 @@
<result
property=
"path"
column=
"path"
/>
<result
property=
"component"
column=
"component"
/>
<result
property=
"query"
column=
"query"
/>
<result
property=
"routeName"
column=
"route_name"
/>
<result
property=
"isFrame"
column=
"is_frame"
/>
<result
property=
"isCache"
column=
"is_cache"
/>
<result
property=
"menuType"
column=
"menu_type"
/>
...
...
@@ -28,7 +29,7 @@
</resultMap>
<sql
id=
"selectMenuVo"
>
select menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
select menu_id, menu_name, parent_id, order_num, path, component, `query`,
route_name,
is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
from sys_menu
</sql>
...
...
@@ -49,13 +50,13 @@
</select>
<select
id=
"selectMenuTreeAll"
resultMap=
"SysMenuResult"
>
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.
route_name, m.
visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
order by m.parent_id, m.order_num
</select>
<select
id=
"selectMenuListByUserId"
parameterType=
"SysMenu"
resultMap=
"SysMenuResult"
>
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.
route_name, m.
visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
...
...
@@ -74,7 +75,7 @@
</select>
<select
id=
"selectMenuTreeByUserId"
parameterType=
"Long"
resultMap=
"SysMenuResult"
>
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.
route_name, m.
visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
...
...
@@ -141,6 +142,7 @@
<if
test=
"path != null and path != ''"
>
path = #{path},
</if>
<if
test=
"component != null"
>
component = #{component},
</if>
<if
test=
"query != null"
>
`query` = #{query},
</if>
<if
test=
"routeName != null"
>
route_name = #{routeName},
</if>
<if
test=
"isFrame != null and isFrame != ''"
>
is_frame = #{isFrame},
</if>
<if
test=
"isCache != null and isCache != ''"
>
is_cache = #{isCache},
</if>
<if
test=
"menuType != null and menuType != ''"
>
menu_type = #{menuType},
</if>
...
...
@@ -164,6 +166,7 @@
<if
test=
"path != null and path != ''"
>
path,
</if>
<if
test=
"component != null and component != ''"
>
component,
</if>
<if
test=
"query != null and query != ''"
>
`query`,
</if>
<if
test=
"routeName != null"
>
route_name,
</if>
<if
test=
"isFrame != null and isFrame != ''"
>
is_frame,
</if>
<if
test=
"isCache != null and isCache != ''"
>
is_cache,
</if>
<if
test=
"menuType != null and menuType != ''"
>
menu_type,
</if>
...
...
@@ -182,6 +185,7 @@
<if
test=
"path != null and path != ''"
>
#{path},
</if>
<if
test=
"component != null and component != ''"
>
#{component},
</if>
<if
test=
"query != null and query != ''"
>
#{query},
</if>
<if
test=
"routeName != null"
>
#{routeName},
</if>
<if
test=
"isFrame != null and isFrame != ''"
>
#{isFrame},
</if>
<if
test=
"isCache != null and isCache != ''"
>
#{isCache},
</if>
<if
test=
"menuType != null and menuType != ''"
>
#{menuType},
</if>
...
...
sql/ry_20240
5
29.sql
→
sql/ry_20240
6
29.sql
浏览文件 @
a96d4bf2
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论