Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cmeeting
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
翟斌
cmeeting
Commits
e9c7c468
提交
e9c7c468
authored
7月 19, 2025
作者:
洪东保
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
权限校验
父级
8572e4a0
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
33 行增加
和
19 行删除
+33
-19
src/main/java/com/cmeeting/service/ModulePermissionService.java
+2
-5
src/main/java/com/cmeeting/service/impl/ModulePermissionServiceImpl.java
+31
-14
没有找到文件。
src/main/java/com/cmeeting/service/ModulePermissionService.java
浏览文件 @
e9c7c468
...
...
@@ -28,11 +28,8 @@ public interface ModulePermissionService extends IService<ModulePermission> {
/**
* 校验权限
* @param deptIds
* @param userId
* @param purpose
* @return 权限集合
*/
List
<
ModulePermission
>
checkPermission
(
List
<
String
>
deptIds
,
String
userId
);
List
<
Long
>
checkPermission
(
List
<
String
>
deptIds
,
String
userId
,
Integer
purpose
);
Boolean
checkPermission
(
List
<
String
>
deptIds
,
String
userId
,
Integer
purpose
,
Stri
ng
targetId
);
Boolean
checkPermission
(
List
<
String
>
deptIds
,
String
userId
,
Integer
purpose
,
Lo
ng
targetId
);
}
src/main/java/com/cmeeting/service/impl/ModulePermissionServiceImpl.java
浏览文件 @
e9c7c468
...
...
@@ -2,6 +2,7 @@ package com.cmeeting.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.cmeeting.ad.entity.RobotSecurityUser
;
...
...
@@ -11,6 +12,7 @@ import com.cmeeting.constant.PermissionPruposeType;
import
com.cmeeting.constant.RecordTemplateConstant
;
import
com.cmeeting.constant.UserTypeConstant
;
import
com.cmeeting.dto.PermissionCheckedDTO
;
import
com.cmeeting.exception.RobotBaseException
;
import
com.cmeeting.pojo.ModulePermission
;
import
com.cmeeting.service.IShareUserService
;
import
com.cmeeting.service.ModulePermissionService
;
...
...
@@ -28,13 +30,13 @@ import java.util.stream.Collectors;
import
java.util.stream.Stream
;
/**
* @author Administrator
* @description 针对表【module_permission(权限表)】的数据库操作Service实现
* @createDate 2025-07-17 10:55:32
*/
* @author Administrator
* @description 针对表【module_permission(权限表)】的数据库操作Service实现
* @createDate 2025-07-17 10:55:32
*/
@Service
public
class
ModulePermissionServiceImpl
extends
ServiceImpl
<
ModulePermissionMapper
,
ModulePermission
>
implements
ModulePermissionService
{
implements
ModulePermissionService
{
@Resource
private
SysUserSyncService
iSysUserSyncService
;
...
...
@@ -200,24 +202,39 @@ public class ModulePermissionServiceImpl extends ServiceImpl<ModulePermissionMap
}
@Override
public
List
<
ModulePermission
>
checkPermission
(
List
<
String
>
deptIds
,
String
userId
)
{
return
this
.
list
(
new
LambdaQueryWrapper
<
ModulePermission
>()
.
and
(
e
->
e
.
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_DEPT
).
in
(
ModulePermission:
:
getRelId
,
deptIds
)
.
or
().
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_USER
).
eq
(
ModulePermission:
:
getRelId
,
userId
))
.
select
(
ModulePermission:
:
getTargetId
)
);
}
@Override
public
List
<
Long
>
checkPermission
(
List
<
String
>
deptIds
,
String
userId
,
Integer
purpose
)
{
List
<
ModulePermission
>
list
=
this
.
list
(
new
LambdaQueryWrapper
<
ModulePermission
>()
.
eq
(
ModulePermission:
:
getPurpose
,
purpose
)
.
and
(
e
->
e
.
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_DEPT
).
in
(
ModulePermission:
:
getRelId
,
deptIds
)
.
or
().
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_USER
).
eq
(
ModulePermission:
:
getRelId
,
userId
))
.
select
(
ModulePermission:
:
getTargetId
)
.
and
(
e
->
e
.
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_DEPT
).
in
(
ModulePermission:
:
getRelId
,
deptIds
)
.
or
().
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_USER
).
eq
(
ModulePermission:
:
getRelId
,
userId
)
.
or
().
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_USER
).
eq
(
ModulePermission:
:
getRelId
,
CategoryConstant
.
ALL_EN
)
).
select
(
ModulePermission:
:
getTargetId
)
);
return
list
.
stream
().
map
(
ModulePermission:
:
getTargetId
).
collect
(
Collectors
.
toList
());
}
@Override
public
Boolean
checkPermission
(
List
<
String
>
deptIds
,
String
userId
,
Integer
purpose
,
String
targetId
)
{
return
baseMapper
.
selectCount
(
new
LambdaQueryWrapper
<
ModulePermission
>()
public
Boolean
checkPermission
(
List
<
String
>
deptIds
,
String
userId
,
Integer
purpose
,
Long
targetId
)
{
boolean
flag
=
purpose
.
equals
(
PermissionPruposeType
.
TEMPLATE_TYPE_PERMISSION
)
||
purpose
.
equals
(
PermissionPruposeType
.
TEMPLATE_PERMISSION
);
if
(
flag
&&
targetId
!=
null
)
{
throw
new
RobotBaseException
(
"param error!"
);
}
return
baseMapper
.
selectCount
(
new
LambdaQueryWrapper
<
ModulePermission
>()
.
eq
(
ModulePermission:
:
getPurpose
,
purpose
)
.
eq
(
ModulePermission:
:
getTargetId
,
targetId
)
.
and
(
e
->
e
.
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_DEPT
).
in
(
ModulePermission:
:
getRelId
,
deptIds
)
.
or
().
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_USER
).
eq
(
ModulePermission:
:
getRelId
,
userId
))
.
select
(
ModulePermission:
:
getTargetId
))
>
0
;
.
eq
(
targetId
!=
null
,
ModulePermission:
:
getTargetId
,
targetId
)
.
and
(
e
->
e
.
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_DEPT
).
in
(
ModulePermission:
:
getRelId
,
deptIds
)
.
or
().
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_USER
).
eq
(
ModulePermission:
:
getRelId
,
userId
)
.
or
().
eq
(
ModulePermission:
:
getType
,
RecordTemplateConstant
.
REL_TYPE_USER
).
eq
(
ModulePermission:
:
getRelId
,
CategoryConstant
.
ALL_EN
)
).
select
(
ModulePermission:
:
getTargetId
))
>
0
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论