Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-manage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
finance-oa
finance-manage
Commits
a5e38f6f
Commit
a5e38f6f
authored
Sep 08, 2021
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单管理支持配置路由参数
parent
4988b585
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
169 additions
and
119 deletions
+169
-119
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java
...ain/java/com/ruoyi/common/core/domain/entity/SysMenu.java
+13
-0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java
...em/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java
+15
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
...ava/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
+1
-0
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
...system/src/main/resources/mapper/system/SysMenuMapper.xml
+8
-4
ruoyi-ui/src/layout/components/Sidebar/Link.vue
ruoyi-ui/src/layout/components/Sidebar/Link.vue
+1
-1
ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue
ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue
+6
-2
ruoyi-ui/src/router/index.js
ruoyi-ui/src/router/index.js
+13
-12
ruoyi-ui/src/views/system/menu/index.vue
ruoyi-ui/src/views/system/menu/index.vue
+25
-14
sql/quartz.sql
sql/quartz.sql
+3
-3
sql/ry_20210908.sql
sql/ry_20210908.sql
+84
-83
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java
View file @
a5e38f6f
...
...
@@ -38,6 +38,9 @@ public class SysMenu extends BaseEntity
/** 组件路径 */
private
String
component
;
/** 路由参数 */
private
String
query
;
/** 是否为外链(0是 1否) */
private
String
isFrame
;
...
...
@@ -137,6 +140,16 @@ public class SysMenu extends BaseEntity
this
.
component
=
component
;
}
public
String
getQuery
()
{
return
query
;
}
public
void
setQuery
(
String
query
)
{
this
.
query
=
query
;
}
public
String
getIsFrame
()
{
return
isFrame
;
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java
View file @
a5e38f6f
...
...
@@ -36,6 +36,11 @@ public class RouterVo
*/
private
String
component
;
/**
* 路由参数:如 {"id": 1, "name": "ry"}
*/
private
String
query
;
/**
* 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
*/
...
...
@@ -101,6 +106,16 @@ public class RouterVo
this
.
component
=
component
;
}
public
String
getQuery
()
{
return
query
;
}
public
void
setQuery
(
String
query
)
{
this
.
query
=
query
;
}
public
Boolean
getAlwaysShow
()
{
return
alwaysShow
;
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
View file @
a5e38f6f
...
...
@@ -151,6 +151,7 @@ public class SysMenuServiceImpl implements ISysMenuService
router
.
setName
(
getRouteName
(
menu
));
router
.
setPath
(
getRouterPath
(
menu
));
router
.
setComponent
(
getComponent
(
menu
));
router
.
setQuery
(
menu
.
getQuery
());
router
.
setMeta
(
new
MetaVo
(
menu
.
getMenuName
(),
menu
.
getIcon
(),
StringUtils
.
equals
(
"1"
,
menu
.
getIsCache
()),
menu
.
getPath
()));
List
<
SysMenu
>
cMenus
=
menu
.
getChildren
();
if
(!
cMenus
.
isEmpty
()
&&
cMenus
.
size
()
>
0
&&
UserConstants
.
TYPE_DIR
.
equals
(
menu
.
getMenuType
()))
...
...
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
View file @
a5e38f6f
...
...
@@ -12,6 +12,7 @@
<result
property=
"orderNum"
column=
"order_num"
/>
<result
property=
"path"
column=
"path"
/>
<result
property=
"component"
column=
"component"
/>
<result
property=
"query"
column=
"query"
/>
<result
property=
"isFrame"
column=
"is_frame"
/>
<result
property=
"isCache"
column=
"is_cache"
/>
<result
property=
"menuType"
column=
"menu_type"
/>
...
...
@@ -27,7 +28,7 @@
</resultMap>
<sql
id=
"selectMenuVo"
>
select menu_id, menu_name, parent_id, order_num, path, component, 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,
is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
from sys_menu
</sql>
...
...
@@ -48,13 +49,13 @@
</select>
<select
id=
"selectMenuTreeAll"
resultMap=
"SysMenuResult"
>
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, 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.
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.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.
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
...
...
@@ -73,7 +74,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.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.
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
...
...
@@ -132,6 +133,7 @@
<if
test=
"orderNum != null and orderNum != ''"
>
order_num = #{orderNum},
</if>
<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=
"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>
...
...
@@ -154,6 +156,7 @@
<if
test=
"orderNum != null and orderNum != ''"
>
order_num,
</if>
<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=
"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>
...
...
@@ -171,6 +174,7 @@
<if
test=
"orderNum != null and orderNum != ''"
>
#{orderNum},
</if>
<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=
"isFrame != null and isFrame != ''"
>
#{isFrame},
</if>
<if
test=
"isCache != null and isCache != ''"
>
#{isCache},
</if>
<if
test=
"menuType != null and menuType != ''"
>
#{menuType},
</if>
...
...
ruoyi-ui/src/layout/components/Sidebar/Link.vue
View file @
a5e38f6f
...
...
@@ -10,7 +10,7 @@ import { isExternal } from '@/utils/validate'
export
default
{
props
:
{
to
:
{
type
:
String
,
type
:
[
String
,
Object
]
,
required
:
true
}
},
...
...
ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue
View file @
a5e38f6f
<
template
>
<div
v-if=
"!item.hidden"
>
<template
v-if=
"hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow"
>
<app-link
v-if=
"onlyOneChild.meta"
:to=
"resolvePath(onlyOneChild.path)"
>
<app-link
v-if=
"onlyOneChild.meta"
:to=
"resolvePath(onlyOneChild.path
, onlyOneChild.query
)"
>
<el-menu-item
:index=
"resolvePath(onlyOneChild.path)"
:class=
"
{'submenu-title-noDropdown':!isNest}">
<item
:icon=
"onlyOneChild.meta.icon||(item.meta&&item.meta.icon)"
:title=
"onlyOneChild.meta.title"
/>
</el-menu-item>
...
...
@@ -82,13 +82,17 @@ export default {
return
false
},
resolvePath
(
routePath
)
{
resolvePath
(
routePath
,
routeQuery
)
{
if
(
isExternal
(
routePath
))
{
return
routePath
}
if
(
isExternal
(
this
.
basePath
))
{
return
this
.
basePath
}
if
(
routeQuery
)
{
let
query
=
JSON
.
parse
(
routeQuery
);
return
{
path
:
path
.
resolve
(
this
.
basePath
,
routePath
),
query
:
query
}
}
return
path
.
resolve
(
this
.
basePath
,
routePath
)
}
}
...
...
ruoyi-ui/src/router/index.js
View file @
a5e38f6f
...
...
@@ -9,19 +9,20 @@ import Layout from '@/layout'
/**
* Note: 路由配置项
*
* hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
* alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
* // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
* // 若你想不管路由下面的 children 声明的个数都显示你的根路由
* // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
* hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
* alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
* // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
* // 若你想不管路由下面的 children 声明的个数都显示你的根路由
* // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
* query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
* meta : {
noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
noCache: true
// 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
title: 'title'
// 设置该路由在侧边栏和面包屑中展示的名字
icon: 'svg-name'
// 设置该路由的图标,对应路径src/assets/icons/svg
breadcrumb: false
// 如果设置为false,则不会在breadcrumb面包屑中显示
activeMenu: '/system/user'
// 当路由设置了该属性,则会高亮相对应的侧边栏。
}
*/
...
...
ruoyi-ui/src/views/system/menu/index.vue
View file @
a5e38f6f
...
...
@@ -205,6 +205,31 @@
</span>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
v-if=
"form.menuType == 'C'"
>
<el-input
v-model=
"form.query"
placeholder=
"请输入路由参数"
maxlength=
"255"
/>
<span
slot=
"label"
>
<el-tooltip
content=
'访问路由的默认传递参数,如:`{"id": 1, "name": "ry"}`'
placement=
"top"
>
<i
class=
"el-icon-question"
></i>
</el-tooltip>
路由参数
</span>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
v-if=
"form.menuType == 'C'"
>
<span
slot=
"label"
>
<el-tooltip
content=
"选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致"
placement=
"top"
>
<i
class=
"el-icon-question"
></i>
</el-tooltip>
是否缓存
</span>
<el-radio-group
v-model=
"form.isCache"
>
<el-radio
label=
"0"
>
缓存
</el-radio>
<el-radio
label=
"1"
>
不缓存
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
v-if=
"form.menuType != 'F'"
>
<span
slot=
"label"
>
...
...
@@ -239,20 +264,6 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
v-if=
"form.menuType == 'C'"
>
<span
slot=
"label"
>
<el-tooltip
content=
"选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致"
placement=
"top"
>
<i
class=
"el-icon-question"
></i>
</el-tooltip>
是否缓存
</span>
<el-radio-group
v-model=
"form.isCache"
>
<el-radio
label=
"0"
>
缓存
</el-radio>
<el-radio
label=
"1"
>
不缓存
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
...
sql/quartz.sql
View file @
a5e38f6f
...
...
@@ -56,7 +56,7 @@ create table QRTZ_TRIGGERS (
-- ----------------------------
create
table
QRTZ_SIMPLE_TRIGGERS
(
sched_name
varchar
(
120
)
not
null
comment
'调度名称'
,
trigger_name
varchar
(
200
)
not
null
comment
'qrtz_triggers表trigger_
name的外键'
,
trigger_name
varchar
(
200
)
not
null
comment
'qrtz_triggers表trigger_name的外键'
,
trigger_group
varchar
(
200
)
not
null
comment
'qrtz_triggers表trigger_group的外键'
,
repeat_count
bigint
(
7
)
not
null
comment
'重复的次数统计'
,
repeat_interval
bigint
(
12
)
not
null
comment
'重复的间隔时间'
,
...
...
@@ -134,7 +134,7 @@ create table QRTZ_FIRED_TRIGGERS (
-- ----------------------------
create
table
QRTZ_SCHEDULER_STATE
(
sched_name
varchar
(
120
)
not
null
comment
'调度名称'
,
instance_name
varchar
(
200
)
not
null
comment
'
之前配置文件中org.quartz.scheduler.instanceId配置的名字,就会写入该字段
'
,
instance_name
varchar
(
200
)
not
null
comment
'
实例名称
'
,
last_checkin_time
bigint
(
13
)
not
null
comment
'上次检查时间'
,
checkin_interval
bigint
(
13
)
not
null
comment
'检查间隔时间'
,
primary
key
(
sched_name
,
instance_name
)
...
...
@@ -154,7 +154,7 @@ create table QRTZ_LOCKS (
-- ----------------------------
create
table
QRTZ_SIMPROP_TRIGGERS
(
sched_name
varchar
(
120
)
not
null
comment
'调度名称'
,
trigger_name
varchar
(
200
)
not
null
comment
'qrtz_triggers表trigger_
name的外键'
,
trigger_name
varchar
(
200
)
not
null
comment
'qrtz_triggers表trigger_name的外键'
,
trigger_group
varchar
(
200
)
not
null
comment
'qrtz_triggers表trigger_group的外键'
,
str_prop_1
varchar
(
512
)
null
comment
'String类型的trigger的第一个参数'
,
str_prop_2
varchar
(
512
)
null
comment
'String类型的trigger的第二个参数'
,
...
...
sql/ry_20210
731
.sql
→
sql/ry_20210
908
.sql
View file @
a5e38f6f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment