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
dce43812
Commit
dce43812
authored
Dec 25, 2025
by
周海峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
56654bbe
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
230 行增加
和
11 行删除
+230
-11
doc/sql/update.sql
+10
-0
src/main/java/com/metro/auth/platform/controller/PlatformRoleApplicationAppController.java
+32
-0
src/main/java/com/metro/auth/platform/domain/auth/PlatformRoleApplicationApp.java
+38
-0
src/main/java/com/metro/auth/platform/domain/auth/PlatformSysRole.java
+3
-0
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsMapper.java
+4
-0
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsMapper.xml
+8
-7
src/main/java/com/metro/auth/platform/mapper/PlatformRoleApplicationAppMapper.java
+10
-0
src/main/java/com/metro/auth/platform/mapper/PlatformRoleApplicationAppMapper.xml
+13
-0
src/main/java/com/metro/auth/platform/service/PlatformApplicationsServiceImpl.java
+7
-4
src/main/java/com/metro/auth/platform/service/PlatformRoleApplicationAppService.java
+17
-0
src/main/java/com/metro/auth/platform/service/PlatformRoleApplicationAppServiceImpl.java
+64
-0
src/main/java/com/metro/auth/platform/service/PlatformRoleServiceImpl.java
+24
-0
没有找到文件。
doc/sql/update.sql
View file @
dce43812
...
...
@@ -9,3 +9,12 @@ ALTER TABLE `platform_auth`.`platform_applications`
ALTER
TABLE
`platform_auth`
.
`platform_applications`
ADD
COLUMN
`wechat_url`
varchar
(
255
)
NULL
COMMENT
'企业微信入口'
AFTER
`group_code`
;
CREATE
TABLE
`platform_role_application_app`
(
`id`
varchar
(
32
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
NOT
NULL
,
`roleid`
varchar
(
32
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
DEFAULT
NULL
,
`applicationid`
varchar
(
32
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_general_ci
COMMENT
=
'角色的三方应用app权限'
;
\ No newline at end of file
src/main/java/com/metro/auth/platform/controller/PlatformRoleApplicationAppController.java
0 → 100644
View file @
dce43812
package
com
.
metro
.
auth
.
platform
.
controller
;
import
com.metro.auth.platform.domain.ResultJson
;
import
com.metro.auth.platform.domain.auth.PlatformApplications
;
import
com.metro.auth.platform.service.PlatformRoleApplicationAppService
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/PlatformRoleApplicationAppController"
)
public
class
PlatformRoleApplicationAppController
{
@Resource
PlatformRoleApplicationAppService
platformRoleApplicationAppService
;
@GetMapping
(
"/platformapplications/listallApp"
)
public
ResultJson
listallApp
(){
List
<
PlatformApplications
>
list
=
platformRoleApplicationAppService
.
getPlatformApplicationsListApp
();
return
ResultJson
.
ok
(
list
);
}
@GetMapping
(
"/platformapplications/listbyroleApp/{roleid}"
)
public
ResultJson
listbyroleApp
(
@PathVariable
String
roleid
){
List
<
PlatformApplications
>
list
=
platformRoleApplicationAppService
.
getPlatformApplicationsListByRoleApp
(
roleid
);
return
ResultJson
.
ok
(
list
);
}
}
src/main/java/com/metro/auth/platform/domain/auth/PlatformRoleApplicationApp.java
0 → 100644
View file @
dce43812
package
com
.
metro
.
auth
.
platform
.
domain
.
auth
;
import
java.io.Serializable
;
public
class
PlatformRoleApplicationApp
implements
Serializable
{
private
String
id
;
private
String
roleid
;
private
String
applicationid
;
private
static
final
long
serialVersionUID
=
1L
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getRoleid
()
{
return
roleid
;
}
public
void
setRoleid
(
String
roleid
)
{
this
.
roleid
=
roleid
;
}
public
String
getApplicationid
()
{
return
applicationid
;
}
public
void
setApplicationid
(
String
applicationid
)
{
this
.
applicationid
=
applicationid
;
}
}
src/main/java/com/metro/auth/platform/domain/auth/PlatformSysRole.java
View file @
dce43812
...
...
@@ -65,6 +65,9 @@ public class PlatformSysRole implements Serializable {
@Transient
private
String
group
;
@Transient
private
String
groupApp
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table platform_sys_role
...
...
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsMapper.java
View file @
dce43812
...
...
@@ -105,9 +105,13 @@ public interface PlatformApplicationsMapper {
List
<
PlatformApplications
>
getPlatformApplicationsListByRole
(
String
roleid
);
List
<
PlatformApplications
>
getPlatformApplicationsListByRoleApp
(
String
roleid
);
List
<
PlatformApplications
>
selectByExample
(
String
userid
);
int
deleteByRoleid
(
String
roleid
);
int
insertRoleApplication
(
PlatformRoleApplication
platformRoleApplication
);
}
src/main/java/com/metro/auth/platform/mapper/PlatformApplicationsMapper.xml
View file @
dce43812
...
...
@@ -111,9 +111,9 @@
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<!-- <if test="orderByClause != null">-->
<!-- order by ${orderByClause}-->
<!-- </if>-->
<!-- <if test="orderByClause != null">-->
<!-- order by ${orderByClause}-->
<!-- </if>-->
order by num + 0
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
...
...
@@ -331,6 +331,11 @@
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 = #{roleid,jdbcType=VARCHAR} order by T.num + 0
</select>
<select
id=
"getPlatformApplicationsListByRoleApp"
parameterType=
"java.lang.String"
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 = #{roleid,jdbcType=VARCHAR} order by T.num + 0
</select>
<select
id=
"getPlatformApplicationsListByRoleList"
resultMap=
"BaseResultMap"
>
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
...
...
@@ -348,10 +353,6 @@
</delete>
<insert
id=
"insertRoleApplication"
parameterType=
"com.metro.auth.platform.domain.auth.PlatformRoleApplication"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into platform_role_application (id, roleid, applicationid)
values (#{id,jdbcType=VARCHAR}, #{roleid,jdbcType=VARCHAR}, #{applicationid,jdbcType=VARCHAR})
</insert>
...
...
src/main/java/com/metro/auth/platform/mapper/PlatformRoleApplicationAppMapper.java
0 → 100644
View file @
dce43812
package
com
.
metro
.
auth
.
platform
.
mapper
;
import
com.metro.auth.platform.domain.auth.PlatformRoleApplicationApp
;
public
interface
PlatformRoleApplicationAppMapper
{
int
deleteByRoleid
(
String
roleid
);
int
insertRoleApplicationApp
(
PlatformRoleApplicationApp
platformRoleApplicationApp
);
}
src/main/java/com/metro/auth/platform/mapper/PlatformRoleApplicationAppMapper.xml
0 → 100644
View file @
dce43812
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.metro.auth.platform.mapper.PlatformRoleApplicationAppMapper"
>
<delete
id=
"deleteByRoleid"
parameterType=
"java.lang.String"
>
delete from platform_role_application_app where roleid = #{roleid,jdbcType=VARCHAR}
</delete>
<insert
id=
"insertRoleApplicationApp"
parameterType=
"com.metro.auth.platform.domain.auth.PlatformRoleApplicationApp"
>
insert into platform_role_application_app (id, roleid, applicationid)
values (#{id,jdbcType=VARCHAR}, #{roleid,jdbcType=VARCHAR}, #{applicationid,jdbcType=VARCHAR})
</insert>
</mapper>
src/main/java/com/metro/auth/platform/service/PlatformApplicationsServiceImpl.java
View file @
dce43812
...
...
@@ -154,6 +154,13 @@ public class PlatformApplicationsServiceImpl implements PlatformApplicationsServ
List
<
PlatformApplications
>
alllist
=
platformApplicationsMapper
.
selectByExample
(
platformApplicationsExample
);
//当前角色可见应用
List
<
PlatformApplications
>
rolelist
=
platformApplicationsMapper
.
getPlatformApplicationsListByRole
(
roleid
);
// 首先将所有应用的 roleUseStatue 设置为 0(不可见)
alllist
.
stream
().
forEach
(
t
->
{
t
.
setRoleUseStatue
(
0
);
});
// 然后将可见应用的 roleUseStatue 设置为该应用的ID
if
(
rolelist
!=
null
&&
rolelist
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
rolelist
.
size
();
i
++)
{
int
finalI
=
i
;
...
...
@@ -163,10 +170,6 @@ public class PlatformApplicationsServiceImpl implements PlatformApplicationsServ
}
});
}
}
else
{
alllist
.
stream
().
forEach
(
t
->
{
t
.
setRoleUseStatue
(
0
);
});
}
return
alllist
;
}
...
...
src/main/java/com/metro/auth/platform/service/PlatformRoleApplicationAppService.java
0 → 100644
View file @
dce43812
package
com
.
metro
.
auth
.
platform
.
service
;
import
com.metro.auth.platform.domain.auth.PlatformApplications
;
import
com.metro.auth.platform.domain.auth.PlatformRoleApplicationApp
;
import
java.util.List
;
public
interface
PlatformRoleApplicationAppService
{
List
<
PlatformApplications
>
getPlatformApplicationsListApp
();
List
<
PlatformApplications
>
getPlatformApplicationsListByRoleApp
(
String
roleid
);
int
deleteByRoleid
(
String
roleid
);
int
insertRoleApplicationApp
(
PlatformRoleApplicationApp
platformRoleApplicationApp
);
}
src/main/java/com/metro/auth/platform/service/PlatformRoleApplicationAppServiceImpl.java
0 → 100644
View file @
dce43812
package
com
.
metro
.
auth
.
platform
.
service
;
import
com.metro.auth.platform.domain.auth.PlatformApplications
;
import
com.metro.auth.platform.domain.auth.PlatformApplicationsExample
;
import
com.metro.auth.platform.domain.auth.PlatformRoleApplicationApp
;
import
com.metro.auth.platform.mapper.PlatformApplicationsMapper
;
import
com.metro.auth.platform.mapper.PlatformRoleApplicationAppMapper
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
PlatformRoleApplicationAppServiceImpl
implements
PlatformRoleApplicationAppService
{
@Resource
PlatformApplicationsMapper
platformApplicationsMapper
;
@Resource
PlatformRoleApplicationAppMapper
platformRoleApplicationAppMapper
;
@Override
public
List
<
PlatformApplications
>
getPlatformApplicationsListApp
()
{
return
platformApplicationsMapper
.
getPlatformApplicationsList
();
}
@Override
public
List
<
PlatformApplications
>
getPlatformApplicationsListByRoleApp
(
String
roleid
)
{
PlatformApplicationsExample
platformApplicationsExample
=
new
PlatformApplicationsExample
();
//所有应用
List
<
PlatformApplications
>
alllist
=
platformApplicationsMapper
.
selectByExample
(
platformApplicationsExample
);
// 查询当前角色的 App 应用权限关联
List
<
PlatformApplications
>
roleApps
=
platformApplicationsMapper
.
getPlatformApplicationsListByRoleApp
(
roleid
);
// 首先将所有应用的 roleUseStatue 设置为 0(不可见)
alllist
.
stream
().
forEach
(
t
->
{
t
.
setRoleUseStatue
(
0
);
});
// 然后将可见应用的 roleUseStatue 设置为该应用的ID
if
(
roleApps
!=
null
&&
roleApps
.
size
()
>
0
)
{
for
(
PlatformApplications
roleApp
:
roleApps
)
{
alllist
.
stream
().
forEach
(
t
->
{
if
(
t
.
getId
().
equals
(
roleApp
.
getId
()))
{
t
.
setRoleUseStatue
(
t
.
getId
());
}
});
}
}
return
alllist
;
}
@Override
public
int
deleteByRoleid
(
String
roleid
)
{
return
platformRoleApplicationAppMapper
.
deleteByRoleid
(
roleid
);
}
@Override
public
int
insertRoleApplicationApp
(
PlatformRoleApplicationApp
platformRoleApplicationApp
)
{
return
platformRoleApplicationAppMapper
.
insertRoleApplicationApp
(
platformRoleApplicationApp
);
}
}
src/main/java/com/metro/auth/platform/service/PlatformRoleServiceImpl.java
View file @
dce43812
...
...
@@ -28,6 +28,7 @@ import com.metro.auth.platform.domain.dto.RoleFunctionDTO;
import
com.metro.auth.platform.mapper.PlatformApplicationsMapper
;
import
com.metro.auth.platform.mapper.PlatformRoleMenuMapper
;
import
com.metro.auth.platform.mapper.PlatformSysRoleMapper
;
import
com.metro.auth.platform.service.PlatformRoleApplicationAppService
;
import
com.metro.auth.platform.utils.EmptyUtilHelper
;
import
com.metro.auth.platform.utils.StrUtil
;
import
org.springframework.stereotype.Service
;
...
...
@@ -55,6 +56,9 @@ public class PlatformRoleServiceImpl implements PlatformRoleService{
@Resource
PlatformApplicationsMapper
platformApplicationsMapper
;
@Resource
PlatformRoleApplicationAppService
platformRoleApplicationAppService
;
/**
* 功能描述: <br>查询权限列表
* 〈〉
...
...
@@ -103,6 +107,7 @@ public class PlatformRoleServiceImpl implements PlatformRoleService{
if
(
platformSysRole
!=
null
&&
!
EmptyUtilHelper
.
isEmpty
(
platformSysRole
.
getId
())){
//更新
platformApplicationsMapper
.
deleteByRoleid
(
platformSysRole
.
getId
());
platformRoleApplicationAppService
.
deleteByRoleid
(
platformSysRole
.
getId
());
PlatformSysRoleExample
platformSysRoleExample
=
new
PlatformSysRoleExample
();
platformSysRoleExample
.
createCriteria
().
andIdEqualTo
(
platformSysRole
.
getId
());
count
=
platformSysRoleMapper
.
updateByExample
(
platformSysRole
,
platformSysRoleExample
);
...
...
@@ -111,6 +116,8 @@ public class PlatformRoleServiceImpl implements PlatformRoleService{
platformSysRole
.
setId
(
StrUtil
.
makePramykey
());
count
=
platformSysRoleMapper
.
insert
(
platformSysRole
);
}
// 处理PC端应用权限
if
(
platformSysRole
.
getGroup
()
!=
null
&&
!
platformSysRole
.
getGroup
().
isEmpty
())
{
String
[]
appid
=
platformSysRole
.
getGroup
().
split
(
","
);
//不选者可见菜单权限时的处理
if
(
appid
!=
null
&&
appid
.
length
>
0
){
...
...
@@ -122,12 +129,28 @@ public class PlatformRoleServiceImpl implements PlatformRoleService{
platformApplicationsMapper
.
insertRoleApplication
(
platformRoleApplication
);
});
}
}
// 处理App端应用权限
if
(
platformSysRole
.
getGroupApp
()
!=
null
&&
!
platformSysRole
.
getGroupApp
().
isEmpty
())
{
String
[]
appidApp
=
platformSysRole
.
getGroupApp
().
split
(
","
);
if
(
appidApp
!=
null
&&
appidApp
.
length
>
0
){
Arrays
.
stream
(
appidApp
).
forEach
(
t
->{
com
.
metro
.
auth
.
platform
.
domain
.
auth
.
PlatformRoleApplicationApp
platformRoleApplicationApp
=
new
com
.
metro
.
auth
.
platform
.
domain
.
auth
.
PlatformRoleApplicationApp
();
platformRoleApplicationApp
.
setId
(
StrUtil
.
makePramykey
());
platformRoleApplicationApp
.
setRoleid
(
platformSysRole
.
getId
());
platformRoleApplicationApp
.
setApplicationid
(
t
);
platformRoleApplicationAppService
.
insertRoleApplicationApp
(
platformRoleApplicationApp
);
});
}
}
return
count
;
}
@Override
public
int
deleRole
(
String
id
)
{
platformApplicationsMapper
.
deleteByRoleid
(
id
);
platformRoleApplicationAppService
.
deleteByRoleid
(
id
);
int
count
=
platformSysRoleMapper
.
deleteByPrimaryKey
(
id
);
return
count
;
}
...
...
@@ -137,6 +160,7 @@ public class PlatformRoleServiceImpl implements PlatformRoleService{
String
[]
id
=
ids
.
split
(
","
);
Arrays
.
stream
(
id
).
forEach
(
t
->{
platformApplicationsMapper
.
deleteByRoleid
(
t
);
platformRoleApplicationAppService
.
deleteByRoleid
(
t
);
platformSysRoleMapper
.
deleteByPrimaryKey
(
t
);
});
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论