Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
auth-master
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
吴超
auth-master
Commits
2d2d6363
Commit
2d2d6363
authored
Dec 25, 2025
by
周海峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
dce43812
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
64 行增加
和
14 行删除
+64
-14
src/main/java/com/metro/auth/platform/controller/WechatApiController.java
+3
-6
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsMapper.java
+1
-1
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsMapper.xml
+10
-5
src/main/java/com/metro/auth/platform/service/PlatformRoleApplicationAppService.java
+2
-0
src/main/java/com/metro/auth/platform/service/PlatformRoleApplicationAppServiceImpl.java
+48
-2
没有找到文件。
src/main/java/com/metro/auth/platform/controller/WechatApiController.java
View file @
2d2d6363
...
@@ -5,6 +5,7 @@ import com.metro.auth.platform.domain.auth.PlatformApplications;
...
@@ -5,6 +5,7 @@ import com.metro.auth.platform.domain.auth.PlatformApplications;
import
com.metro.auth.platform.domain.auth.PlatformApplicationsGroup
;
import
com.metro.auth.platform.domain.auth.PlatformApplicationsGroup
;
import
com.metro.auth.platform.service.PlatformApplicationsGroupService
;
import
com.metro.auth.platform.service.PlatformApplicationsGroupService
;
import
com.metro.auth.platform.service.PlatformApplicationsService
;
import
com.metro.auth.platform.service.PlatformApplicationsService
;
import
com.metro.auth.platform.service.PlatformRoleApplicationAppService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -27,7 +28,7 @@ public class WechatApiController {
...
@@ -27,7 +28,7 @@ public class WechatApiController {
@Resource
@Resource
private
PlatformApplicationsGroupService
platformApplicationsGroupService
;
private
PlatformApplicationsGroupService
platformApplicationsGroupService
;
@Resource
@Resource
private
Platform
ApplicationsService
platformApplications
Service
;
private
Platform
RoleApplicationAppService
platformRoleApplicationApp
Service
;
@GetMapping
(
"/appGroupPageList"
)
@GetMapping
(
"/appGroupPageList"
)
public
ResultJson
appGroupPageList
(
@RequestParam
String
userId
,
String
appName
)
{
public
ResultJson
appGroupPageList
(
@RequestParam
String
userId
,
String
appName
)
{
...
@@ -36,22 +37,18 @@ public class WechatApiController {
...
@@ -36,22 +37,18 @@ public class WechatApiController {
platformApplicationsGroupService
.
selectList
(
new
PlatformApplicationsGroup
());
platformApplicationsGroupService
.
selectList
(
new
PlatformApplicationsGroup
());
// 应用
// 应用
List
<
PlatformApplications
>
platformApplicationsList
=
List
<
PlatformApplications
>
platformApplicationsList
=
platformApplicationsService
.
getPlatformApplicationsListByUserid
(
userId
);
platformRoleApplicationAppService
.
getPlatformApplicationsAppListByUserid
(
userId
);
if
(!
CollectionUtils
.
isEmpty
(
platformApplicationsList
))
{
if
(!
CollectionUtils
.
isEmpty
(
platformApplicationsList
))
{
//过滤
//过滤
if
(!
StringUtils
.
isEmpty
(
appName
))
{
if
(!
StringUtils
.
isEmpty
(
appName
))
{
platformApplicationsList
=
platformApplicationsList
.
stream
().
filter
(
app
->
app
.
getTitle
().
contains
(
appName
)).
collect
(
Collectors
.
toList
());
platformApplicationsList
=
platformApplicationsList
.
stream
().
filter
(
app
->
app
.
getTitle
().
contains
(
appName
)).
collect
(
Collectors
.
toList
());
}
}
for
(
PlatformApplicationsGroup
applicationsGroup
:
platformApplicationsGroups
)
{
for
(
PlatformApplicationsGroup
applicationsGroup
:
platformApplicationsGroups
)
{
String
groupCode
=
applicationsGroup
.
getGroupCode
();
String
groupCode
=
applicationsGroup
.
getGroupCode
();
List
<
PlatformApplications
>
groupOf
=
platformApplicationsList
.
stream
().
filter
(
item
->
groupCode
.
equals
(
item
.
getGroupCode
())).
collect
(
Collectors
.
toList
());
List
<
PlatformApplications
>
groupOf
=
platformApplicationsList
.
stream
().
filter
(
item
->
groupCode
.
equals
(
item
.
getGroupCode
())).
collect
(
Collectors
.
toList
());
applicationsGroup
.
setApplicationsList
(
groupOf
);
applicationsGroup
.
setApplicationsList
(
groupOf
);
}
}
}
}
// 只要有应用的分组
// 只要有应用的分组
platformApplicationsGroups
=
platformApplicationsGroups
.
stream
()
platformApplicationsGroups
=
platformApplicationsGroups
.
stream
()
.
filter
(
group
->
!
CollectionUtils
.
isEmpty
(
group
.
getApplicationsList
()))
.
filter
(
group
->
!
CollectionUtils
.
isEmpty
(
group
.
getApplicationsList
()))
...
...
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsMapper.java
View file @
2d2d6363
...
@@ -113,5 +113,5 @@ public interface PlatformApplicationsMapper {
...
@@ -113,5 +113,5 @@ public interface PlatformApplicationsMapper {
int
insertRoleApplication
(
PlatformRoleApplication
platformRoleApplication
);
int
insertRoleApplication
(
PlatformRoleApplication
platformRoleApplication
);
List
<
PlatformApplications
>
getPlatformApplicationsListByRoleAppList
(
List
<
String
>
roleid
);
}
}
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsMapper.xml
View file @
2d2d6363
...
@@ -336,6 +336,7 @@
...
@@ -336,6 +336,7 @@
select distinct T.* from platform_applications T left join platform_role_application_app R on T.id=R.applicationid
select distinct T.* from platform_applications T left join platform_role_application_app R on T.id=R.applicationid
where T.qyflag='1' and R.roleid = #{roleid,jdbcType=VARCHAR} order by T.num + 0
where T.qyflag='1' and R.roleid = #{roleid,jdbcType=VARCHAR} order by T.num + 0
</select>
</select>
<select
id=
"getPlatformApplicationsListByRoleList"
resultMap=
"BaseResultMap"
>
<select
id=
"getPlatformApplicationsListByRoleList"
resultMap=
"BaseResultMap"
>
select distinct T.* from platform_applications T left join platform_role_application R on T.id=R.applicationid
select distinct T.* from platform_applications T left join platform_role_application R on T.id=R.applicationid
where T.qyflag='1' and R.roleid in
where T.qyflag='1' and R.roleid in
...
@@ -343,13 +344,17 @@
...
@@ -343,13 +344,17 @@
#{name}
#{name}
</foreach>
</foreach>
</select>
</select>
<select
id=
"getPlatformApplicationsListByRoleAppList"
resultMap=
"BaseResultMap"
>
select distinct T.* from platform_applications T left join platform_role_application_app R on T.id=R.applicationid
where T.qyflag='1' and R.roleid in
<foreach
collection=
"list"
item=
"name"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{name}
</foreach>
</select>
<delete
id=
"deleteByRoleid"
parameterType=
"java.lang.String"
>
<delete
id=
"deleteByRoleid"
parameterType=
"java.lang.String"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from platform_role_application where roleid = #{roleid,jdbcType=VARCHAR}
delete from platform_role_application where roleid = #{roleid,jdbcType=VARCHAR}
</delete>
</delete>
<insert
id=
"insertRoleApplication"
parameterType=
"com.metro.auth.platform.domain.auth.PlatformRoleApplication"
>
<insert
id=
"insertRoleApplication"
parameterType=
"com.metro.auth.platform.domain.auth.PlatformRoleApplication"
>
...
...
src/main/java/com/metro/auth/platform/service/PlatformRoleApplicationAppService.java
View file @
2d2d6363
...
@@ -14,4 +14,6 @@ public interface PlatformRoleApplicationAppService {
...
@@ -14,4 +14,6 @@ public interface PlatformRoleApplicationAppService {
int
deleteByRoleid
(
String
roleid
);
int
deleteByRoleid
(
String
roleid
);
int
insertRoleApplicationApp
(
PlatformRoleApplicationApp
platformRoleApplicationApp
);
int
insertRoleApplicationApp
(
PlatformRoleApplicationApp
platformRoleApplicationApp
);
List
<
PlatformApplications
>
getPlatformApplicationsAppListByUserid
(
String
userid
);
}
}
src/main/java/com/metro/auth/platform/service/PlatformRoleApplicationAppServiceImpl.java
View file @
2d2d6363
...
@@ -3,12 +3,15 @@ package com.metro.auth.platform.service;
...
@@ -3,12 +3,15 @@ package com.metro.auth.platform.service;
import
com.metro.auth.platform.domain.auth.PlatformApplications
;
import
com.metro.auth.platform.domain.auth.PlatformApplications
;
import
com.metro.auth.platform.domain.auth.PlatformApplicationsExample
;
import
com.metro.auth.platform.domain.auth.PlatformApplicationsExample
;
import
com.metro.auth.platform.domain.auth.PlatformRoleApplicationApp
;
import
com.metro.auth.platform.domain.auth.PlatformRoleApplicationApp
;
import
com.metro.auth.platform.domain.auth.PlatformSysRole
;
import
com.metro.auth.platform.mapper.PlatformApplicationsMapper
;
import
com.metro.auth.platform.mapper.PlatformApplicationsMapper
;
import
com.metro.auth.platform.mapper.PlatformRoleApplicationAppMapper
;
import
com.metro.auth.platform.mapper.PlatformRoleApplicationAppMapper
;
import
com.metro.auth.platform.mapper.PlatformSysRoleMapper
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.
List
;
import
java.util.
*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -16,9 +19,10 @@ public class PlatformRoleApplicationAppServiceImpl implements PlatformRoleApplic
...
@@ -16,9 +19,10 @@ public class PlatformRoleApplicationAppServiceImpl implements PlatformRoleApplic
@Resource
@Resource
PlatformApplicationsMapper
platformApplicationsMapper
;
PlatformApplicationsMapper
platformApplicationsMapper
;
@Resource
@Resource
PlatformRoleApplicationAppMapper
platformRoleApplicationAppMapper
;
PlatformRoleApplicationAppMapper
platformRoleApplicationAppMapper
;
@Resource
PlatformSysRoleMapper
platformSysRoleMapper
;
@Override
@Override
public
List
<
PlatformApplications
>
getPlatformApplicationsListApp
()
{
public
List
<
PlatformApplications
>
getPlatformApplicationsListApp
()
{
...
@@ -61,4 +65,46 @@ public class PlatformRoleApplicationAppServiceImpl implements PlatformRoleApplic
...
@@ -61,4 +65,46 @@ public class PlatformRoleApplicationAppServiceImpl implements PlatformRoleApplic
public
int
insertRoleApplicationApp
(
PlatformRoleApplicationApp
platformRoleApplicationApp
)
{
public
int
insertRoleApplicationApp
(
PlatformRoleApplicationApp
platformRoleApplicationApp
)
{
return
platformRoleApplicationAppMapper
.
insertRoleApplicationApp
(
platformRoleApplicationApp
);
return
platformRoleApplicationAppMapper
.
insertRoleApplicationApp
(
platformRoleApplicationApp
);
}
}
@Override
public
List
<
PlatformApplications
>
getPlatformApplicationsAppListByUserid
(
String
userid
)
{
// 1. 查询所有启用的应用
PlatformApplicationsExample
example
=
new
PlatformApplicationsExample
();
example
.
createCriteria
().
andQyflagEqualTo
(
"1"
);
List
<
PlatformApplications
>
allApplications
=
platformApplicationsMapper
.
selectByExample
(
example
);
// 3. 安全地解析userid并查询用户角色
Set
<
String
>
roleIds
=
new
HashSet
<>();
int
userIdInt
=
Integer
.
parseInt
(
userid
);
// 直接查询出角色ID列表,避免在Java代码中循环提取
roleIds
=
platformSysRoleMapper
.
selectByUserId
(
userIdInt
)
.
stream
().
map
(
PlatformSysRole:
:
getId
)
.
collect
(
Collectors
.
toSet
());
// 4. 根据角色ID列表查询可见应用
List
<
PlatformApplications
>
visibleApplications
;
if
(
roleIds
.
isEmpty
())
{
visibleApplications
=
Collections
.
emptyList
();
// 如果没有角色,则可见应用列表为空
}
else
{
visibleApplications
=
platformApplicationsMapper
.
getPlatformApplicationsListByRoleAppList
(
new
ArrayList
<>(
roleIds
));
}
// 提取可见应用的ID集合,用于快速判断
Set
<
Integer
>
visibleAppIds
=
visibleApplications
.
stream
()
.
map
(
PlatformApplications:
:
getId
)
.
collect
(
Collectors
.
toSet
());
// 遍历所有应用,根据其ID是否在可见应用ID集合中来更新状态
allApplications
.
forEach
(
app
->
{
if
(
visibleAppIds
.
contains
(
app
.
getId
()))
{
app
.
setRoleUseStatue
(
app
.
getId
());
// 可见
}
else
{
app
.
setRoleUseStatue
(
0
);
// 不可见
}
});
return
allApplications
.
stream
()
.
sorted
(
Comparator
.
comparing
(
app
->
StringUtils
.
isEmpty
(
app
.
getNum
())
?
0
:
Integer
.
parseInt
(
app
.
getNum
())))
.
collect
(
Collectors
.
toList
());
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论