Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
有来技术
youlai-mall
提交
1370634c
Y
youlai-mall
项目概览
有来技术
/
youlai-mall
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
youlai-mall
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1370634c
编写于
9月 15, 2020
作者:
H
haoxr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
动态权限接口
上级
a3bc6a1b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
39 addition
and
31 deletion
+39
-31
youlai-admin/src/main/java/com/youlai/admin/controller/SysMenuController.java
...n/java/com/youlai/admin/controller/SysMenuController.java
+10
-11
youlai-admin/src/main/java/com/youlai/admin/domain/entity/SysMenu.java
...src/main/java/com/youlai/admin/domain/entity/SysMenu.java
+7
-2
youlai-admin/src/main/java/com/youlai/admin/domain/vo/MenuVO.java
...dmin/src/main/java/com/youlai/admin/domain/vo/MenuVO.java
+2
-0
youlai-admin/src/main/java/com/youlai/admin/mapper/SysMenuMapper.java
.../src/main/java/com/youlai/admin/mapper/SysMenuMapper.java
+1
-1
youlai-admin/src/main/java/com/youlai/admin/service/ISysMenuService.java
...c/main/java/com/youlai/admin/service/ISysMenuService.java
+1
-1
youlai-admin/src/main/java/com/youlai/admin/service/impl/SysMenuServiceImpl.java
...ava/com/youlai/admin/service/impl/SysMenuServiceImpl.java
+16
-14
youlai-admin/src/test/java/com/youlai/admin/AdminApplicationTests.java
...src/test/java/com/youlai/admin/AdminApplicationTests.java
+2
-2
未找到文件。
youlai-admin/src/main/java/com/youlai/admin/controller/SysMenuController.java
浏览文件 @
1370634c
...
...
@@ -71,8 +71,8 @@ public class SysMenuController {
map
.
put
(
"checkedKeys"
,
checkedKeys
);
return
Result
.
success
(
map
);
}
}
else
if
(
mode
.
equals
(
3
))
{
list
=
iSysMenuService
.
listForRoute
();
}
else
if
(
mode
.
equals
(
3
))
{
list
=
iSysMenuService
.
listForRoute
r
();
}
else
{
list
=
iSysMenuService
.
list
(
baseQuery
);
}
...
...
@@ -83,29 +83,28 @@ public class SysMenuController {
@ApiImplicitParam
(
name
=
"id"
,
value
=
"菜单id"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"Integer"
)
@GetMapping
(
"/{id}"
)
public
Result
detail
(
@PathVariable
Integer
id
)
{
SysMenu
sysM
enu
=
iSysMenuService
.
getById
(
id
);
return
Result
.
success
(
sysM
enu
);
SysMenu
m
enu
=
iSysMenuService
.
getById
(
id
);
return
Result
.
success
(
m
enu
);
}
@ApiOperation
(
value
=
"新增菜单"
,
httpMethod
=
"POST"
)
@ApiImplicitParam
(
name
=
"
sysM
enu"
,
value
=
"实体JSON对象"
,
required
=
true
,
paramType
=
"body"
,
dataType
=
"SysMenu"
)
@ApiImplicitParam
(
name
=
"
m
enu"
,
value
=
"实体JSON对象"
,
required
=
true
,
paramType
=
"body"
,
dataType
=
"SysMenu"
)
@PostMapping
public
Result
add
(
@RequestBody
SysMenu
sysM
enu
)
{
boolean
status
=
iSysMenuService
.
save
(
sysM
enu
);
public
Result
add
(
@RequestBody
SysMenu
m
enu
)
{
boolean
status
=
iSysMenuService
.
save
(
m
enu
);
return
Result
.
status
(
status
);
}
@ApiOperation
(
value
=
"修改菜单"
,
httpMethod
=
"PUT"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"菜单id"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"
sysM
enu"
,
value
=
"实体JSON对象"
,
required
=
true
,
paramType
=
"body"
,
dataType
=
"SysMenu"
)
@ApiImplicitParam
(
name
=
"
m
enu"
,
value
=
"实体JSON对象"
,
required
=
true
,
paramType
=
"body"
,
dataType
=
"SysMenu"
)
})
@PutMapping
(
value
=
"/{id}"
)
public
Result
update
(
@PathVariable
Integer
id
,
@RequestBody
SysMenu
sysMenu
)
{
sysMenu
.
setUpdateTime
(
new
Date
());
boolean
status
=
iSysMenuService
.
updateById
(
sysMenu
);
@RequestBody
SysMenu
menu
)
{
boolean
status
=
iSysMenuService
.
updateById
(
menu
);
return
Result
.
status
(
status
);
}
...
...
youlai-admin/src/main/java/com/youlai/admin/domain/entity/SysMenu.java
浏览文件 @
1370634c
package
com.youlai.admin.domain.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.youlai.common.core.entity.BaseEntity
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
SysMenu
extends
BaseEntity
{
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
SysMenu
extends
BaseEntity
{
@TableId
private
Integer
id
;
...
...
@@ -32,6 +33,10 @@ public class SysMenu extends BaseEntity {
private
String
perms
;
private
String
redirect
;
private
Integer
type
;
@TableField
(
exist
=
false
)
private
List
<
Integer
>
roles
;
...
...
youlai-admin/src/main/java/com/youlai/admin/domain/vo/MenuVO.java
浏览文件 @
1370634c
...
...
@@ -22,6 +22,8 @@ public class MenuVO extends BaseEntity {
private
Integer
status
;
private
String
component
;
private
String
path
;
private
String
perms
;
...
...
youlai-admin/src/main/java/com/youlai/admin/mapper/SysMenuMapper.java
浏览文件 @
1370634c
...
...
@@ -22,5 +22,5 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
@Result
(
id
=
true
,
column
=
"id"
,
property
=
"id"
),
@Result
(
property
=
"roles"
,
column
=
"id"
,
many
=
@Many
(
select
=
"com.youlai.admin.mapper.SysRoleMenuMapper.listByMenuId"
))
})
List
<
SysMenu
>
listForRoute
();
List
<
SysMenu
>
listForRoute
r
();
}
youlai-admin/src/main/java/com/youlai/admin/service/ISysMenuService.java
浏览文件 @
1370634c
...
...
@@ -16,5 +16,5 @@ public interface ISysMenuService extends IService<SysMenu> {
List
<
TreeSelectVO
>
listForTreeSelect
(
LambdaQueryWrapper
<
SysMenu
>
baseQuery
);
List
listForRoute
();
List
listForRoute
r
();
}
youlai-admin/src/main/java/com/youlai/admin/service/impl/SysMenuServiceImpl.java
浏览文件 @
1370634c
...
...
@@ -11,7 +11,6 @@ import com.youlai.admin.domain.vo.RouterVO;
import
com.youlai.admin.domain.vo.TreeSelectVO
;
import
com.youlai.admin.mapper.SysMenuMapper
;
import
com.youlai.admin.service.ISysMenuService
;
import
org.apache.logging.log4j.util.Strings
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
...
...
@@ -37,8 +36,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
}
@Override
public
List
listForRoute
()
{
List
<
SysMenu
>
menuList
=
this
.
baseMapper
.
listForRoute
();
public
List
listForRoute
r
()
{
List
<
SysMenu
>
menuList
=
this
.
baseMapper
.
listForRoute
r
();
List
<
RouterVO
>
list
=
recursionForRoutes
(
AdminConstant
.
ROOT_MENU_ID
,
menuList
);
return
list
;
}
...
...
@@ -51,20 +50,23 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
.
forEach
(
menu
->
{
RouterVO
routerVO
=
new
RouterVO
();
routerVO
.
setName
(
menu
.
getName
());
routerVO
.
setPath
(
menu
.
getPath
());
String
component
=
StrUtil
.
isNotBlank
(
menu
.
getComponent
())
?
menu
.
getComponent
()
:
"Layout"
;
routerVO
.
setComponent
(
component
);
RouterVO
.
Meta
meta
=
routerVO
.
new
Meta
(
if
(
parentId
==
AdminConstant
.
ROOT_MENU_ID
)
{
routerVO
.
setAlwaysShow
(
Boolean
.
TRUE
);
routerVO
.
setPath
(
"/"
+
menu
.
getPath
());
}
else
{
routerVO
.
setPath
(
menu
.
getPath
());
}
routerVO
.
setRedirect
(
menu
.
getRedirect
());
routerVO
.
setComponent
(
StrUtil
.
isNotBlank
(
menu
.
getComponent
())
?
menu
.
getComponent
()
:
"Layout"
);
routerVO
.
setMeta
(
routerVO
.
new
Meta
(
menu
.
getName
(),
menu
.
getIcon
(),
menu
.
getRoles
()
);
routerVO
.
setMeta
(
meta
);
if
(
AdminConstant
.
ROOT_MENU_ID
==
parentId
)
{
routerVO
.
setAlwaysShow
(
Boolean
.
TRUE
);
routerVO
.
setRedirect
(
"noRedirect"
);
}
));
List
<
RouterVO
>
children
=
recursionForRoutes
(
menu
.
getId
(),
menuList
);
routerVO
.
setChildren
(
children
);
list
.
add
(
routerVO
);
...
...
youlai-admin/src/test/java/com/youlai/admin/AdminApplicationTests.java
浏览文件 @
1370634c
...
...
@@ -20,8 +20,8 @@ public class AdminApplicationTests {
private
ISysMenuService
iSysMenuService
;
@Test
public
void
testlistForRoute
()
{
List
list
=
iSysMenuService
.
listForRoute
();
public
void
testlistForRoute
r
()
{
List
list
=
iSysMenuService
.
listForRoute
r
();
Assert
.
isTrue
(
list
.
size
()>
0
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录