Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
e1d5d8f8
提交
e1d5d8f8
编写于
5月 24, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
重构代码逻辑
上级
fb226095
变更
16
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
426 行增加
和
1122 行删除
+426
-1122
sys-role-permissioncustom-view.vue
...-permissioncustom-view/sys-role-permissioncustom-view.vue
+7
-7
UAACoreService.java
...va/cn/ibizlab/core/extensions/service/UAACoreService.java
+0
-670
SysPSSystem.java
...src/main/java/cn/ibizlab/core/uaa/domain/SysPSSystem.java
+17
-4
PermissionNode.java
...cn/ibizlab/core/uaa/extensions/domain/PermissionNode.java
+38
-0
PermissionType.java
...cn/ibizlab/core/uaa/extensions/domain/PermissionType.java
+6
-0
AppNode.java
...ibizlab/core/uaa/extensions/domain/Structure/AppNode.java
+18
-0
EntityNode.java
...zlab/core/uaa/extensions/domain/Structure/EntityNode.java
+30
-0
FuncItem.java
...bizlab/core/uaa/extensions/domain/Structure/FuncItem.java
+14
-0
MenuNode.java
...bizlab/core/uaa/extensions/domain/Structure/MenuNode.java
+18
-0
UniResNode.java
...zlab/core/uaa/extensions/domain/Structure/UniResNode.java
+10
-0
SysStructure.java
...a/cn/ibizlab/core/uaa/extensions/domain/SysStructure.java
+193
-0
UAACoreService.java
...n/ibizlab/core/uaa/extensions/service/UAACoreService.java
+61
-0
SysPSSystemMapper.xml
...in/resources/mapper/uaa/syspssystem/SysPSSystemMapper.xml
+3
-2
ClientAuthenticationResource.java
...lab/api/rest/extensions/ClientAuthenticationResource.java
+2
-2
PermissionFeignService.java
...n/ibizlab/api/rest/extensions/PermissionFeignService.java
+0
-379
UAACoreResource.java
.../java/cn/ibizlab/api/rest/extensions/UAACoreResource.java
+9
-58
未找到文件。
app_web/src/pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue
浏览文件 @
e1d5d8f8
...
...
@@ -388,17 +388,17 @@
private
initTree
()
{
const
_this
=
this
;
// get全部菜单和数据能力和统一资源的请求路径
const
url
=
`sys
_permissions/getallMenuAndPermissionAndUnires?roleid=`
+
_this
.
srfparentkey
;
const
url
=
`sys
roles/`
+
_this
.
srfparentkey
+
`/sysrolepermissions/tree`
;
this
.
$http
.
get
(
url
).
then
((
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!==
200
)
{
this
.
$Notice
.
error
({
title
:
'错误'
,
desc
:
response
.
message
});
return
;
}
else
{
// 给树赋值,数据结构在后台已经按照eltree格式化
_this
.
CDdata
=
response
.
data
[
0
]
;
_this
.
QXdata
=
response
.
data
[
1
]
;
_this
.
ZYdata
=
response
.
data
[
2
]
;
_this
.
defaultCheckedNodes
=
response
.
data
[
3
]
;
_this
.
CDdata
=
response
.
APPMENU
;
_this
.
QXdata
=
response
.
OPPRIV
;
_this
.
ZYdata
=
response
.
UNIRES
;
_this
.
defaultCheckedNodes
=
response
.
SELECTED
;
// 设置默认第一级展开
for
(
let
i
=
0
;
i
<
_this
.
CDdata
.
length
;
i
++
)
{
...
...
@@ -477,8 +477,8 @@
return
;
}
// 先删除当前角色的所有角色权限关系
let
url
=
`sys_permissions/deleteRolePermissionByRoleid`
;
let
param
=
{
roleid
:
this
.
srfparentkey
};
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
});
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/extensions/service/UAACoreService.java
已删除
100644 → 0
浏览文件 @
fb226095
此差异已折叠。
点击以展开。
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/domain/SysPSSystem.java
浏览文件 @
e1d5d8f8
...
...
@@ -7,7 +7,10 @@ import java.util.Map;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
java.math.BigDecimal
;
import
cn.ibizlab.core.uaa.extensions.domain.SysStructure
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
...
...
@@ -24,7 +27,7 @@ import org.springframework.data.annotation.Transient;
import
com.baomidou.mybatisplus.annotation.*
;
import
cn.ibizlab.util.domain.EntityMP
;
import
org.springframework.util.StringUtils
;
/**
* 实体[实体]
...
...
@@ -53,10 +56,10 @@ public class SysPSSystem extends EntityMP implements Serializable {
/**
* 结构
*/
@TableField
(
value
=
"sysstructure"
)
@TableField
(
value
=
"sysstructure"
,
typeHandler
=
JacksonTypeHandler
.
class
)
@JSONField
(
name
=
"sysstructure"
)
@JsonProperty
(
"sysstructure"
)
private
S
tring
sysstructure
;
private
S
ysStructure
sysstructure
;
...
...
@@ -70,11 +73,21 @@ public class SysPSSystem extends EntityMP implements Serializable {
/**
* 设置 [结构]
*/
public
void
setSysstructure
(
S
tring
sysstructure
){
public
void
setSysstructure
(
S
ysStructure
sysstructure
){
this
.
sysstructure
=
sysstructure
;
this
.
modify
(
"sysstructure"
,
sysstructure
);
}
public
SysStructure
getSysstructure
()
{
if
(
this
.
sysstructure
!=
null
)
{
if
(!
StringUtils
.
isEmpty
(
this
.
getPssystemid
()))
this
.
sysstructure
.
setSystemid
(
this
.
getPssystemid
());
}
return
this
.
sysstructure
;
}
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/domain/PermissionNode.java
0 → 100644
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
domain
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
PermissionNode
{
private
String
id
;
private
String
label
;
private
String
systemid
;
private
List
<
PermissionNode
>
children
=
new
ArrayList
<>();
private
String
fullName
;
private
PermissionType
type
;
public
PermissionNode
setUniKey
(
String
systemid
,
String
id
)
{
this
.
systemid
=
systemid
;
this
.
id
=
systemid
+
"-"
+
id
;
return
this
;
}
public
List
<
PermissionNode
>
getChildren
()
{
if
(
children
==
null
)
children
=
new
ArrayList
<>();
return
children
;
}
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/domain/PermissionType.java
0 → 100644
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
domain
;
public
enum
PermissionType
{
OPPRIV
,
UNIRES
,
APPMENU
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/domain/Structure/AppNode.java
0 → 100644
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
domain
.
Structure
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
AppNode
{
private
String
appid
;
private
String
appname
;
@JsonProperty
(
"appmenu"
)
@JSONField
(
name
=
"appmenu"
)
private
List
<
MenuNode
>
appmenus
;
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/domain/Structure/EntityNode.java
0 → 100644
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
domain
.
Structure
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
EntityNode
{
private
String
dename
;
private
String
delogicname
;
@JsonProperty
(
"sysmoudle"
)
@JSONField
(
name
=
"sysmoudle"
)
private
FuncItem
moudle
;
@JsonProperty
(
"dedataset"
)
@JSONField
(
name
=
"dedataset"
)
private
List
<
FuncItem
>
dataSets
;
@JsonProperty
(
"deaction"
)
@JSONField
(
name
=
"deaction"
)
private
List
<
FuncItem
>
actions
;
@JsonProperty
(
"datascope"
)
@JSONField
(
name
=
"datascope"
)
private
List
<
FuncItem
>
scopes
;
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/domain/Structure/FuncItem.java
0 → 100644
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
domain
.
Structure
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
FuncItem
{
private
String
id
;
private
String
name
;
private
String
type
;
private
List
<
FuncItem
>
items
;
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/domain/Structure/MenuNode.java
0 → 100644
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
domain
.
Structure
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
MenuNode
{
private
String
menuid
;
private
String
menuname
;
@JsonProperty
(
"menuitem"
)
@JSONField
(
name
=
"menuitem"
)
private
List
<
FuncItem
>
menuitems
;
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/domain/Structure/UniResNode.java
0 → 100644
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
domain
.
Structure
;
import
lombok.Data
;
@Data
public
class
UniResNode
{
private
String
unirescode
;
private
String
uniresname
;
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/domain/SysStructure.java
0 → 100644
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
domain
;
import
cn.ibizlab.core.uaa.extensions.domain.Structure.AppNode
;
import
cn.ibizlab.core.uaa.extensions.domain.Structure.EntityNode
;
import
cn.ibizlab.core.uaa.extensions.domain.Structure.FuncItem
;
import
cn.ibizlab.core.uaa.extensions.domain.Structure.UniResNode
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.util.*
;
@Data
public
class
SysStructure
{
private
String
systemid
;
private
List
<
EntityNode
>
entities
;
@JsonProperty
(
"unires"
)
@JSONField
(
name
=
"unires"
)
private
List
<
UniResNode
>
uniResIds
;
@JsonProperty
(
"appmenus"
)
@JSONField
(
name
=
"appmenus"
)
private
List
<
AppNode
>
apps
;
public
PermissionNode
getPermissionTree
(
PermissionType
type
)
{
PermissionNode
root
=
PermissionNode
.
builder
().
id
(
systemid
).
label
(
systemid
).
systemid
(
systemid
).
build
();
switch
(
type
)
{
case
OPPRIV:
Map
<
String
,
PermissionNode
>
moudlemap
=
new
LinkedHashMap
<>();
PermissionNode
emptyMoudle
=
PermissionNode
.
builder
().
label
(
"未分类模块"
).
build
().
setUniKey
(
systemid
,
"Ungroup"
);
for
(
EntityNode
node:
this
.
entities
)
{
PermissionNode
moudle
=
null
;
if
(
node
.
getMoudle
()!=
null
)
{
if
(
moudlemap
.
containsKey
(
systemid
+
"-"
+
node
.
getMoudle
().
getId
()))
moudle
=
moudlemap
.
get
(
systemid
+
"-"
+
node
.
getMoudle
().
getId
());
else
{
moudle
=
PermissionNode
.
builder
()
.
label
(
node
.
getMoudle
().
getName
()).
build
()
.
setUniKey
(
systemid
,
node
.
getMoudle
().
getId
());
moudlemap
.
put
(
moudle
.
getId
(),
moudle
);
}
}
else
{
moudle
=
emptyMoudle
;
moudlemap
.
put
(
"Ungroup"
,
moudle
);
}
PermissionNode
enode
=
PermissionNode
.
builder
()
.
label
(
node
.
getDelogicname
()).
build
()
.
setUniKey
(
systemid
,
node
.
getDename
());
moudle
.
getChildren
().
add
(
enode
);
if
(
node
.
getDataSets
()!=
null
)
node
.
getDataSets
().
forEach
(
dataset
->{
String
datasetname
=
dataset
.
getName
();
if
(
datasetname
.
toUpperCase
().
equals
(
"DEFAULT"
))
datasetname
=
""
;
datasetname
=
"查询"
+
datasetname
+
"数据"
;
PermissionNode
dataSetNode
=
PermissionNode
.
builder
()
.
label
(
datasetname
).
build
()
.
setUniKey
(
systemid
,
enode
.
getId
()+
"-"
+
dataset
.
getId
()+
"-all"
);
enode
.
getChildren
().
add
(
dataSetNode
);
});
if
(
node
.
getActions
()!=
null
)
{
node
.
getActions
().
forEach
(
action
->
{
String
actionname
=
action
.
getName
();
if
(
action
.
getId
().
toUpperCase
().
equals
(
"CREATE"
))
actionname
=
"新建"
;
else
if
(
action
.
getId
().
toUpperCase
().
equals
(
"UPDATE"
))
actionname
=
"修改"
;
else
if
(
action
.
getId
().
toUpperCase
().
equals
(
"REMOVE"
))
actionname
=
"删除"
;
else
if
(
action
.
getId
().
toUpperCase
().
equals
(
"SAVE"
))
actionname
=
"保存"
;
else
if
(
action
.
getId
().
toUpperCase
().
equals
(
"GET"
))
actionname
=
"查看"
;
else
if
(
action
.
getId
().
toUpperCase
().
equals
(
"CHECKKEY"
)
||
action
.
getId
().
toUpperCase
().
equals
(
"GETDRAFT"
)
||
action
.
getId
().
toUpperCase
().
indexOf
(
"BATCH"
)
>
0
)
return
;
if
(
node
.
getScopes
()
==
null
||
node
.
getScopes
().
size
()
<=
1
)
{
String
fullname
=
systemid
+
"/操作能力/"
+
enode
.
getLabel
()+
"/"
+
actionname
+
"任意数据"
;
enode
.
getChildren
().
add
(
PermissionNode
.
builder
()
.
label
(
actionname
).
type
(
PermissionType
.
OPPRIV
)
.
fullName
(
fullname
).
build
()
.
setUniKey
(
systemid
,
enode
.
getId
()
+
"-"
+
action
.
getId
()
+
"-all"
));
}
else
{
PermissionNode
actionNode
=
PermissionNode
.
builder
()
.
label
(
actionname
).
build
()
.
setUniKey
(
systemid
,
enode
.
getId
()
+
"-"
+
action
.
getId
());
final
String
preFullname
=
systemid
+
"/操作能力/"
+
enode
.
getLabel
()+
"/"
+
actionname
;
node
.
getScopes
().
forEach
(
scope
->
{
String
scopename
=
scope
.
getName
();
if
(
scope
.
getId
().
equals
(
"all"
))
scopename
=
"任意数据"
;
else
if
(
scope
.
getId
().
equals
(
"createman"
))
{
if
(
action
.
getId
().
toUpperCase
().
equals
(
"CREATE"
))
return
;
scopename
=
"本人创建的数据"
;
}
else
if
(
scope
.
getId
().
equals
(
"curorg"
))
scopename
=
"本单位的数据"
;
else
if
(
scope
.
getId
().
equals
(
"curorgdept"
))
scopename
=
"本部门的数据"
;
else
if
(
scope
.
getId
().
equals
(
"sorg"
))
scopename
=
"本单位及下辖全部单位数据"
;
else
if
(
scope
.
getId
().
equals
(
"curorgdept"
))
scopename
=
"本部门及下辖部门的数据"
;
else
return
;
actionNode
.
getChildren
().
add
(
PermissionNode
.
builder
()
.
label
(
scopename
).
type
(
PermissionType
.
OPPRIV
)
.
fullName
(
preFullname
+
scopename
).
build
()
.
setUniKey
(
systemid
,
enode
.
getId
()
+
"-"
+
action
.
getId
()
+
"-"
+
scope
.
getId
()));
});
enode
.
getChildren
().
add
(
actionNode
);
}
});
}
}
moudlemap
.
values
().
forEach
(
moudle
->
root
.
getChildren
().
add
(
moudle
));
break
;
case
UNIRES:
if
(
this
.
getUniResIds
()!=
null
)
{
this
.
getUniResIds
().
forEach
(
uniRes
->{
root
.
getChildren
().
add
(
PermissionNode
.
builder
()
.
label
(
uniRes
.
getUniresname
()).
type
(
PermissionType
.
UNIRES
)
.
fullName
(
systemid
+
"/自定义资源/"
+
uniRes
.
getUniresname
()).
build
()
.
setUniKey
(
systemid
,
uniRes
.
getUnirescode
()));
});
}
break
;
case
APPMENU:
if
(
this
.
getApps
()!=
null
)
{
this
.
getApps
().
forEach
(
app
->{
PermissionNode
appNode
=
PermissionNode
.
builder
()
.
label
(
"应用-"
+
app
.
getAppname
()).
build
()
.
setUniKey
(
systemid
,
app
.
getAppid
());
if
(
app
.
getAppmenus
()!=
null
)
{
app
.
getAppmenus
().
forEach
(
appmenu
->{
PermissionNode
appMenuNode
=
PermissionNode
.
builder
()
.
label
(
"菜单-"
+
appmenu
.
getMenuname
()).
build
()
.
setUniKey
(
systemid
,
appmenu
.
getMenuid
());
if
(
appmenu
.
getMenuitems
()!=
null
)
{
appmenu
.
getMenuitems
().
forEach
(
item
->{
appMenuNode
.
getChildren
().
add
(
loopMenuItem
(
appmenu
.
getMenuid
(),
systemid
+
"/菜单/"
+
app
.
getAppname
()+
appmenu
.
getMenuname
(),
item
));
});
}
appNode
.
getChildren
().
add
(
appMenuNode
);
});
}
root
.
getChildren
().
add
(
appNode
);
});
}
break
;
}
return
root
;
}
private
PermissionNode
loopMenuItem
(
String
menuId
,
String
fullName
,
FuncItem
item
)
{
fullName
=
fullName
+
"/"
+
item
.
getName
();
PermissionNode
itemNode
=
PermissionNode
.
builder
().
label
(
item
.
getName
()).
fullName
(
fullName
).
type
(
PermissionType
.
APPMENU
).
build
().
setUniKey
(
systemid
,
menuId
+
"-"
+
item
.
getId
());
if
(
item
.
getItems
()!=
null
)
{
final
String
fname
=
fullName
;
item
.
getItems
().
forEach
(
sub
->{
itemNode
.
getChildren
().
add
(
loopMenuItem
(
menuId
,
fname
,
sub
));
});
}
return
itemNode
;
}
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UAACoreService.java
0 → 100644
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
service
;
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.PermissionType
;
import
cn.ibizlab.core.uaa.filter.SysPSSystemSearchContext
;
import
cn.ibizlab.core.uaa.service.ISysPSSystemService
;
import
cn.ibizlab.core.uaa.service.ISysRolePermissionService
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
@Service
@Slf4j
public
class
UAACoreService
{
@Autowired
private
ISysPSSystemService
sysPSSystemService
;
@Autowired
private
ISysRolePermissionService
rolePermissionService
;
public
Map
<
String
,
List
<
PermissionNode
>>
getPermissionTree
()
{
List
<
PermissionNode
>
apps
=
new
ArrayList
<>();
List
<
PermissionNode
>
uniResIds
=
new
ArrayList
<>();
List
<
PermissionNode
>
oppirvs
=
new
ArrayList
<>();
Page
<
SysPSSystem
>
page
=
sysPSSystemService
.
searchDefault
(
new
SysPSSystemSearchContext
());
page
.
getContent
().
forEach
(
system
->{
if
(
system
.
getSysstructure
()==
null
)
return
;
apps
.
add
(
system
.
getSysstructure
().
getPermissionTree
(
PermissionType
.
APPMENU
));
uniResIds
.
add
(
system
.
getSysstructure
().
getPermissionTree
(
PermissionType
.
UNIRES
));
oppirvs
.
add
(
system
.
getSysstructure
().
getPermissionTree
(
PermissionType
.
OPPRIV
));
});
Map
<
String
,
List
<
PermissionNode
>>
map
=
new
HashMap
<>();
map
.
put
(
PermissionType
.
APPMENU
.
toString
(),
apps
);
map
.
put
(
PermissionType
.
UNIRES
.
toString
(),
uniResIds
);
map
.
put
(
PermissionType
.
OPPRIV
.
toString
(),
oppirvs
);
return
map
;
}
public
List
<
PermissionNode
>
getRolePermissionByRoleId
(
String
roleId
)
{
List
<
PermissionNode
>
rolePermissions
=
new
ArrayList
<>();
List
<
SysRolePermission
>
list
=
rolePermissionService
.
selectByRoleid
(
roleId
);
list
.
forEach
(
item
->{
rolePermissions
.
add
(
PermissionNode
.
builder
().
id
(
item
.
getPermissionid
()).
label
(
item
.
getPermissionname
()).
build
());
});
return
rolePermissions
;
}
}
ibzuaa-core/src/main/resources/mapper/uaa/syspssystem/SysPSSystemMapper.xml
浏览文件 @
e1d5d8f8
...
...
@@ -8,8 +8,9 @@
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap
id=
"SysPSSystemResultMap"
type=
"cn.ibizlab.core.uaa.domain.SysPSSystem"
autoMapping=
"true"
>
<id
property=
"pssystemid"
column=
"pssystemid"
/>
<!--主键字段映射-->
<result
column=
"sysstructure"
jdbcType=
"VARCHAR"
property=
"sysstructure"
typeHandler=
"com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
/>
</resultMap>
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/ClientAuthenticationResource.java
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.uaa.service.IS
YS_PERMISSION
Service
;
import
cn.ibizlab.core.uaa.service.IS
ysPermission
Service
;
import
cn.ibizlab.util.client.IBZOUFeignClient
;
import
cn.ibizlab.util.security.AuthTokenUtil
;
import
cn.ibizlab.util.security.AuthenticationInfo
;
...
...
@@ -57,7 +57,7 @@ public class ClientAuthenticationResource
private
IBZOUFeignClient
ouFeignClient
;
@Autowired
private
IS
YS_PERMISSION
Service
permissionService
;
private
IS
ysPermission
Service
permissionService
;
@PostMapping
(
value
=
"v7/login"
)
public
ResponseEntity
<
AuthenticationInfo
>
login
(
@Validated
@RequestBody
AuthorizationLogin
authorizationLogin
){
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/PermissionFeignService.java
已删除
100644 → 0
浏览文件 @
fb226095
此差异已折叠。
点击以展开。
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UAACoreResource.java
浏览文件 @
e1d5d8f8
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.extensions.service.UAACoreService
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
cn.ibizlab.core.uaa.extensions.domain.PermissionNode
;
import
cn.ibizlab.core.uaa.extensions.service.UAACoreService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.StringUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.constraints.NotBlank
;
import
java.util.List
;
import
java.util.Map
;
@RestController
public
class
UAACoreResource
{
...
...
@@ -24,60 +22,13 @@ public class UAACoreResource {
*
* @return
*/
@GetMapping
(
value
=
"/sys_permissions/getallMenuAndPermissionAndUnires"
)
public
ResponseEntity
<
JSONArray
>
getallMenuAndPermissionAndUnires
(
@Validated
@NotBlank
(
message
=
"roleid不允许为空"
)
@RequestParam
(
"roleid"
)
String
roleid
)
{
JSONArray
treeNode
=
new
JSONArray
();
// 获取应用菜单
treeNode
.
add
(
uaaCoreService
.
getAppMenu
());
// 获取数据能力
treeNode
.
add
(
uaaCoreService
.
getDEOppriv
());
// 获取统一资源
treeNode
.
add
(
uaaCoreService
.
getUnires
());
// 获取当前角色所有权限
treeNode
.
add
(
uaaCoreService
.
getallPermissionByRoleid
(
roleid
));
return
ResponseEntity
.
ok
().
body
(
treeNode
);
@GetMapping
(
value
=
"/sysroles/{roleid}/sysrolepermissions/tree"
)
public
ResponseEntity
<
Map
<
String
,
List
<
PermissionNode
>>>
getTree
(
@Validated
@NotBlank
(
message
=
"roleid不允许为空"
)
@PathVariable
(
"roleid"
)
String
roleid
)
{
Map
<
String
,
List
<
PermissionNode
>>
map
=
uaaCoreService
.
getPermissionTree
();
map
.
put
(
"SELECTED"
,
uaaCoreService
.
getRolePermissionByRoleId
(
roleid
));
return
ResponseEntity
.
ok
().
body
(
map
);
}
/**
* 删除当前角色的所有角色权限关系
* @param param
* @return
*/
@PostMapping
(
value
=
"/sys_permissions/deleteRolePermissionByRoleid"
)
public
ResponseEntity
<
JSONObject
>
deleteRolePermissionByRoleid
(
@RequestBody
JSONObject
param
)
{
JSONObject
resObj
=
new
JSONObject
();
String
roleid
=
param
.
getString
(
"roleid"
);
if
(
StringUtils
.
isEmpty
(
roleid
))
new
BadRequestAlertException
(
"操作失败,未获取到当前角色标识!"
,
""
,
""
);
uaaCoreService
.
clearRolePermissionByRoleid
(
roleid
);
return
ResponseEntity
.
ok
(
resObj
);
}
/**
* 保存选中的权限信息
* @param param
* @return
*/
@PostMapping
(
value
=
"/sys_permissions/saveRolePermissionByRoleid"
)
public
ResponseEntity
<
JSONObject
>
saveRolePermissionByRoleid
(
@RequestBody
JSONObject
param
)
{
JSONObject
resObj
=
new
JSONObject
();
// 角色id
String
roleid
=
param
.
getString
(
"roleid"
);
if
(
StringUtils
.
isEmpty
(
roleid
))
new
BadRequestAlertException
(
"操作失败,未获取到当前角色标识!"
,
""
,
""
);
// 选中的权限信息
JSONArray
checkedNodes
=
param
.
getJSONArray
(
"checkedNodes"
);
if
(
checkedNodes
.
size
()
>
0
)
{
// save操作
uaaCoreService
.
saveRolePermissionByRoleid
(
roleid
,
checkedNodes
);
}
else
{
new
BadRequestAlertException
(
"操作失败,未获取到选中数据!"
,
""
,
""
);
}
return
ResponseEntity
.
ok
(
resObj
);
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录