Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
a96b989b
提交
a96b989b
编写于
5月 14, 2020
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
菜单usr代码
上级
1b27b217
变更
2
展开全部
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
214 行增加
和
38 行删除
+214
-38
ClientAuthenticationResource.java
...lab/api/rest/extensions/ClientAuthenticationResource.java
+53
-7
PermissionFeignService.java
...n/ibizlab/api/rest/extensions/PermissionFeignService.java
+161
-31
未找到文件。
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/ClientAuthenticationResource.java
浏览文件 @
a96b989b
...
@@ -14,13 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -14,13 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.StringUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -48,6 +46,10 @@ public class ClientAuthenticationResource
...
@@ -48,6 +46,10 @@ public class ClientAuthenticationResource
* 统一资源标识
* 统一资源标识
*/
*/
private
String
UniResTag
=
"UNIRES"
;
private
String
UniResTag
=
"UNIRES"
;
/**
* 菜单项标识
*/
private
String
AppMenuTag
=
"APPMENU"
;
@Autowired
@Autowired
@Qualifier
(
"IBZUSERService"
)
@Qualifier
(
"IBZUSERService"
)
...
@@ -107,6 +109,7 @@ public class ClientAuthenticationResource
...
@@ -107,6 +109,7 @@ public class ClientAuthenticationResource
JSONObject
permissionObj
=
new
JSONObject
();
JSONObject
permissionObj
=
new
JSONObject
();
//数据能力
String
opprivSQL
=
"SELECT\n"
+
String
opprivSQL
=
"SELECT\n"
+
"\tT2.pssysmoduleid as sysmodule,\n"
+
"\tT2.pssysmoduleid as sysmodule,\n"
+
"\tT2.psdataentityid as dataentity,\n"
+
"\tT2.psdataentityid as dataentity,\n"
+
...
@@ -128,8 +131,7 @@ public class ClientAuthenticationResource
...
@@ -128,8 +131,7 @@ public class ClientAuthenticationResource
"\t)\n"
+
"\t)\n"
+
"AND T1.PERMISSIONTYPE = #{et.param1} "
;
"AND T1.PERMISSIONTYPE = #{et.param1} "
;
//统一资源
String
uniResSQL
=
"SELECT\n"
+
String
uniResSQL
=
"SELECT\n"
+
"\tt2.SYS_PSSYSUNIRESID,\n"
+
"\tt2.SYS_PSSYSUNIRESID,\n"
+
"\tt2.SYS_PSSYSUNIRESNAME,\n"
+
"\tt2.SYS_PSSYSUNIRESNAME,\n"
+
...
@@ -148,24 +150,68 @@ public class ClientAuthenticationResource
...
@@ -148,24 +150,68 @@ public class ClientAuthenticationResource
"\t)\n"
+
"\t)\n"
+
"AND T1.PERMISSIONTYPE = #{et.param1} "
;
"AND T1.PERMISSIONTYPE = #{et.param1} "
;
//应用菜单
String
appMenuSQL
=
"SELECT\n"
+
"\tt2.PSAPPPMENUITEMID as MENUITEMID,\n"
+
"\tt2.SYS_PSAPPMENUITEMNAME AS MENUITEMNAME \n"
+
"FROM\n"
+
"\tibzrole_permission T\n"
+
"INNER JOIN ibzpermission T1 ON T.SYS_PERMISSIONID = T1.SYS_PERMISSIONID\n"
+
"INNER JOIN ibzpsappmenuitem T2 on T1.SYS_PERMISSIONID=t2.SYS_PSAPPMENUITEMID\n"
+
"WHERE\n"
+
"\tT.SYS_ROLEID IN (\n"
+
"\t SELECT SYS_ROLEID\n"
+
"\t FROM\n"
+
"\t IBZUSER_ROLE t LEFT JOIN IBZUSER t1 ON t.SYS_USERID=T1.USERID\n"
+
"\t WHERE\n"
+
"\t T1.USERID = #{et.param0}\n"
+
"\t)\n"
+
"AND T1.PERMISSIONTYPE = #{et.param1} "
;
Map
opprivParam
=
new
HashMap
();
Map
opprivParam
=
new
HashMap
();
opprivParam
.
put
(
"param0"
,
user
.
getUserid
());
opprivParam
.
put
(
"param0"
,
user
.
getUserid
());
opprivParam
.
put
(
"param1"
,
OPPriTag
);
opprivParam
.
put
(
"param1"
,
OPPriTag
);
List
<
JSONObject
>
entitiesList
=
permissionService
.
select
(
opprivSQL
,
opprivParam
);
//查询用户权限下的菜单数据
Map
uniresParam
=
new
HashMap
();
Map
uniresParam
=
new
HashMap
();
uniresParam
.
put
(
"param0"
,
user
.
getUserid
());
uniresParam
.
put
(
"param0"
,
user
.
getUserid
());
uniresParam
.
put
(
"param1"
,
UniResTag
);
uniresParam
.
put
(
"param1"
,
UniResTag
);
List
<
JSONObject
>
uniResList
=
permissionService
.
select
(
uniResSQL
,
uniresParam
);
//查询用户权限下的菜单数据
Map
appMenuParam
=
new
HashMap
();
appMenuParam
.
put
(
"param0"
,
user
.
getUserid
());
appMenuParam
.
put
(
"param1"
,
AppMenuTag
);
List
<
JSONObject
>
entitiesList
=
permissionService
.
select
(
opprivSQL
,
opprivParam
);
//查询用户权限下数据能力
List
<
JSONObject
>
uniResList
=
permissionService
.
select
(
uniResSQL
,
uniresParam
);
//查询用户权限下的统一资源
List
<
JSONObject
>
appMenuItemList
=
permissionService
.
select
(
appMenuSQL
,
appMenuParam
);
//查询用户权限下的菜单项
JSONObject
entities
=
getEntitiesList
(
entitiesList
);
JSONObject
entities
=
getEntitiesList
(
entitiesList
);
JSONArray
uniRes
=
getUniRes
(
uniResList
);
JSONArray
uniRes
=
getUniRes
(
uniResList
);
JSONArray
appMenuItem
=
getAppMenuItem
(
appMenuItemList
);
permissionObj
.
put
(
"entities"
,
entities
);
permissionObj
.
put
(
"entities"
,
entities
);
permissionObj
.
put
(
"unires"
,
uniRes
);
permissionObj
.
put
(
"unires"
,
uniRes
);
permissionObj
.
put
(
"appmenu"
,
appMenuItem
);
user
.
setPermissionList
(
permissionObj
);
user
.
setPermissionList
(
permissionObj
);
}
}
/**
* 获取应用菜单
* @param menuItemList
* @return
*/
private
JSONArray
getAppMenuItem
(
List
<
JSONObject
>
menuItemList
)
{
JSONArray
menuItemArr
=
new
JSONArray
();
for
(
int
a
=
0
;
a
<
menuItemList
.
size
();
a
++){
JSONObject
menuItem
=
menuItemList
.
get
(
a
);
JSONObject
newMenuItem
=
new
JSONObject
();
newMenuItem
.
put
(
"menuitemid"
,
menuItem
.
getString
(
"MENUITEMID"
));
newMenuItem
.
put
(
"menuitemname"
,
menuItem
.
getString
(
"MENUITEMNAME"
));
menuItemArr
.
add
(
newMenuItem
);
}
return
menuItemArr
;
}
/**
/**
* 获取统一资源
* 获取统一资源
* @param uniResList
* @param uniResList
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/PermissionFeignService.java
浏览文件 @
a96b989b
此差异已折叠。
点击以展开。
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录