Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
bd87c5fb
提交
bd87c5fb
编写于
5月 25, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
路径
上级
31356bee
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
87 行增加
和
52 行删除
+87
-52
sys-role-permissioncustom-view.vue
...-permissioncustom-view/sys-role-permissioncustom-view.vue
+21
-52
UAACoreService.java
...n/ibizlab/core/uaa/extensions/service/UAACoreService.java
+46
-0
UAACoreResource.java
.../java/cn/ibizlab/api/rest/extensions/UAACoreResource.java
+20
-0
未找到文件。
app_web/src/pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue
浏览文件 @
bd87c5fb
...
...
@@ -476,60 +476,29 @@
this
.
$emit
(
'close'
,
null
);
return
;
}
// 先删除当前角色的所有角色权限关系
let
url
=
`sys_permissions/deleteRolePermissionByRoleid`
;
let
param
=
{
roleid
:
this
.
srfparentkey
};
this
.
$http
.
post
(
url
,
param
).
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
this
.
selectData
.
forEach
((
item
:
any
)
=>
{
let
_itemTemp
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
let
_item
:
any
=
{};
if
(
_itemTemp
.
type
)
{
_item
.
permissionid
=
_itemTemp
.
id
;
_item
.
permissiontype
=
_itemTemp
.
type
;
_item
.
permissionname
=
_itemTemp
.
fullName
;
Object
.
assign
(
_item
,
{
_select
:
false
})
this
.
viewSelections
.
push
(
_item
);
}
});
// 保存选中的权限信息
let
url
=
'/sysroles/'
+
this
.
srfparentkey
+
'/sysrolepermissions/refreshbatch'
;
this
.
$http
.
post
(
url
,
this
.
viewSelections
).
then
((
response
:
any
)
=>
{
if
(
!
(
!
response
||
response
.
status
!==
200
))
{
}
else
{
// 再重新添加新选中的权限
this
.
selectData
.
forEach
((
item
:
any
)
=>
{
let
_itemTemp
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
let
_item
:
any
=
{};
if
(
_itemTemp
.
sys_permissionId
)
{
// 应用菜单
_item
.
srfdataaccaction
=
_itemTemp
.
sys_permissionId
;
_item
.
srfkey
=
_itemTemp
.
sys_permissionId
;
_item
.
sys_permission
=
_itemTemp
.
sys_permissionId
;
_item
.
sys_permissionid
=
_itemTemp
.
sys_permissionId
;
_item
.
srfmajortext
=
_itemTemp
.
label
;
_item
.
sys_permissionname
=
_itemTemp
.
label
;
Object
.
assign
(
_item
,
{
_select
:
false
})
this
.
viewSelections
.
push
(
_item
);
}
else
{
if
(
!
_itemTemp
.
children
)
{
// 数据能力或者统一资源
_item
.
srfdataaccaction
=
_itemTemp
.
id
;
_item
.
srfkey
=
_itemTemp
.
id
;
_item
.
sys_permission
=
_itemTemp
.
id
;
_item
.
sys_permissionid
=
_itemTemp
.
id
;
_item
.
srfmajortext
=
_itemTemp
.
label
;
_item
.
sys_permissionname
=
_itemTemp
.
label
;
Object
.
assign
(
_item
,
{
_select
:
false
})
this
.
viewSelections
.
push
(
_item
);
}
}
});
// 保存选中的权限信息
url
=
'sys_permissions/saveRolePermissionByRoleid'
;
Object
.
assign
(
param
,{
roleid
:
this
.
srfparentkey
,
checkedNodes
:
this
.
viewSelections
});
this
.
$http
.
post
(
url
,
param
).
then
((
response
:
any
)
=>
{
if
(
!
(
!
response
||
response
.
status
!==
200
))
{
// 选中节点多,执行时间长,因此不需要success提示
// this.$Notice.success({title: '', desc: '保存权限成功!'});
}
else
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
}).
catch
((
e
)
=>
{
console
.
log
(
e
);
});
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
}).
catch
((
e
)
=>
{
console
.
log
(
e
);
});
}).
catch
((
e
)
=>
{
}
);
}
else
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
'未选中数据!'
});
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UAACoreService.java
浏览文件 @
bd87c5fb
...
...
@@ -2,6 +2,8 @@ package cn.ibizlab.core.uaa.extensions.service;
import
cn.ibizlab.core.uaa.domain.SysPSSystem
;
import
cn.ibizlab.core.uaa.domain.SysPermission
;
import
cn.ibizlab.core.uaa.domain.SysRole
;
import
cn.ibizlab.core.uaa.domain.SysRolePermission
;
import
cn.ibizlab.core.uaa.extensions.domain.PermissionNode
;
import
cn.ibizlab.core.uaa.extensions.domain.PermissionType
;
...
...
@@ -9,6 +11,7 @@ import cn.ibizlab.core.uaa.filter.SysPSSystemSearchContext;
import
cn.ibizlab.core.uaa.filter.SysRolePermissionSearchContext
;
import
cn.ibizlab.core.uaa.service.ISysPSSystemService
;
import
cn.ibizlab.core.uaa.service.ISysRolePermissionService
;
import
cn.ibizlab.core.uaa.service.ISysRoleService
;
import
cn.ibizlab.core.uaa.service.ISysUserRoleService
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -19,6 +22,7 @@ import org.springframework.data.domain.Page;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
...
...
@@ -39,6 +43,10 @@ public class UAACoreService {
@Lazy
private
ISysUserRoleService
userRoleService
;
@Autowired
@Lazy
private
ISysRoleService
sysRoleService
;
public
Map
<
String
,
List
<
PermissionNode
>>
getPermissionTree
()
{
List
<
PermissionNode
>
apps
=
new
ArrayList
<>();
...
...
@@ -88,4 +96,42 @@ public class UAACoreService {
return
authorities
;
}
public
void
saveByRoleid
(
String
roleid
,
List
<
SysRolePermission
>
list
)
{
if
(
list
==
null
)
return
;
SysRole
role
=
sysRoleService
.
getById
(
roleid
);
Set
<
String
>
delIds
=
new
HashSet
<
String
>();
List
<
SysRolePermission
>
_update
=
new
ArrayList
<
SysRolePermission
>();
List
<
SysRolePermission
>
_create
=
new
ArrayList
<
SysRolePermission
>();
for
(
SysRolePermission
before:
rolePermissionService
.
selectByRoleid
(
roleid
)){
delIds
.
add
(
before
.
getRolepermissionid
());
}
for
(
SysRolePermission
sub:
list
)
{
SysPermission
sysPermission
=
new
SysPermission
();
sysPermission
.
setEnable
(
1
);
sysPermission
.
setPermissiontype
(
sub
.
getPermissiontype
());
sysPermission
.
setPermissionname
(
sub
.
getPermissionname
());
sysPermission
.
setPermissionid
(
sub
.
getPermissionid
());
sub
.
setPermission
(
sysPermission
);
sub
.
setRoleid
(
roleid
);
sub
.
setRole
(
role
);
if
(
ObjectUtils
.
isEmpty
(
sub
.
getRolepermissionid
()))
sub
.
setRolepermissionid
((
String
)
sub
.
getDefaultKey
(
true
));
if
(
delIds
.
contains
(
sub
.
getRolepermissionid
()))
{
delIds
.
remove
(
sub
.
getRolepermissionid
());
_update
.
add
(
sub
);
}
else
_create
.
add
(
sub
);
}
if
(
_update
.
size
()>
0
)
rolePermissionService
.
updateBatch
(
_update
);
if
(
_create
.
size
()>
0
)
rolePermissionService
.
createBatch
(
_create
);
if
(
delIds
.
size
()>
0
)
rolePermissionService
.
removeBatch
(
delIds
);
}
}
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UAACoreResource.java
浏览文件 @
bd87c5fb
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.api.dto.SysPSSystemDTO
;
import
cn.ibizlab.api.dto.SysRolePermissionDTO
;
import
cn.ibizlab.api.mapping.SysPSSystemMapping
;
import
cn.ibizlab.api.mapping.SysRolePermissionMapping
;
import
cn.ibizlab.core.uaa.domain.SysPSSystem
;
import
cn.ibizlab.core.uaa.domain.SysRolePermission
;
import
cn.ibizlab.core.uaa.extensions.domain.PermissionNode
;
import
cn.ibizlab.core.uaa.extensions.domain.SysStructure
;
import
cn.ibizlab.core.uaa.extensions.service.UAACoreService
;
import
cn.ibizlab.core.uaa.service.ISysPSSystemService
;
import
cn.ibizlab.core.uaa.service.ISysRolePermissionService
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
...
...
@@ -28,10 +32,18 @@ public class UAACoreResource {
@Autowired
private
ISysPSSystemService
sysPSSystemService
;
@Autowired
private
ISysRolePermissionService
sysRolePermissionService
;
@Autowired
@Lazy
public
SysPSSystemMapping
syspssystemMapping
;
@Autowired
@Lazy
public
SysRolePermissionMapping
sysrolepermissionMapping
;
/**
* 获取全部菜单列表和数据能力列表和统一资源列表
*
...
...
@@ -54,4 +66,12 @@ public class UAACoreResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
sysPSSystemService
.
save
(
sysPSSystem
));
}
@ApiOperation
(
value
=
"RefreshBatchBySysRole"
,
tags
=
{
"SysRolePermission"
},
notes
=
"RefreshBatchBySysRole"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/sysroles/{sysrole_id}/sysrolepermissions/refreshbatch"
)
public
ResponseEntity
<
Boolean
>
saveBatchBySysRole
(
@PathVariable
(
"sysrole_id"
)
String
sysrole_id
,
@RequestBody
List
<
SysRolePermissionDTO
>
sysrolepermissiondtos
)
{
List
<
SysRolePermission
>
domainlist
=
sysrolepermissionMapping
.
toDomain
(
sysrolepermissiondtos
);
uaaCoreService
.
saveByRoleid
(
sysrole_id
,
domainlist
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录