Commit 23922fc2 authored by chenyuxi's avatar chenyuxi

feat: 指定部门获取权限时过滤删除的部门

parent a9699563
...@@ -51,6 +51,8 @@ public interface SysDeptMapper extends BaseMapper<SysDept> { ...@@ -51,6 +51,8 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
List<SysDept> getDeptListByDeptId(@Param("deptIdSplit") String deptIdSplit, @Param("deptId") Long deptId); List<SysDept> getDeptListByDeptId(@Param("deptIdSplit") String deptIdSplit, @Param("deptId") Long deptId);
List<SysDept> getDeptListByDeptIdSet(@Param("departIdSet") Set<String> departIdSet);
/** /**
* 客户服务平台——查询部门管理数据 * 客户服务平台——查询部门管理数据
* *
......
...@@ -629,7 +629,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -629,7 +629,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
List<DeptSortVo> moveVos = dept.getDeptSortList(); List<DeptSortVo> moveVos = dept.getDeptSortList();
baseMapper.batchUpdateSort(moveVos); baseMapper.batchUpdateSort(moveVos);
// 清理用户权限 // 清理用户权限
// List<String> userNames = sysUserMapper.getCspUserByDeptId(dept.getDeptId());
List<String> userNames = sysUserMapper.getCspUserByProjectNo(updateEntity.getProjectNo()); List<String> userNames = sysUserMapper.getCspUserByProjectNo(updateEntity.getProjectNo());
if (Common.isNotNull(userNames)){ if (Common.isNotNull(userNames)){
for (String us:userNames){ for (String us:userNames){
......
...@@ -218,16 +218,22 @@ public class SysUserDeptPermissionServiceImpl extends ServiceImpl<SysUserDeptPer ...@@ -218,16 +218,22 @@ public class SysUserDeptPermissionServiceImpl extends ServiceImpl<SysUserDeptPer
if (CommonConstants.ZERO_STRING.equals(tPermissionInfo.getPermissionsType())) { if (CommonConstants.ZERO_STRING.equals(tPermissionInfo.getPermissionsType())) {
// 全部数据 // 全部数据
authority.setHaveAll(true); authority.setHaveAll(true);
// redisUtil.set(CacheConstants.PROJECT_USER_PERMISSION + projectNoStr +"_"+ userId, authority);
} else if (CommonConstants.THREE_STRING.equals(tPermissionInfo.getPermissionsType())) { } else if (CommonConstants.THREE_STRING.equals(tPermissionInfo.getPermissionsType())) {
// 指定部门权限 // 指定部门权限
if (Common.isNotKong(tPermissionInfo.getAppointDeptScope())) { if (Common.isNotKong(tPermissionInfo.getAppointDeptScope())) {
authority.setHaveAll(false); authority.setHaveAll(false);
String[] appointDeptIdArr = tPermissionInfo.getAppointDeptScope().split(CommonConstants.COMMA_STRING); String[] appointDeptIdArr = tPermissionInfo.getAppointDeptScope().split(CommonConstants.COMMA_STRING);
Set<String> appointDeptIdSet = Arrays.stream(appointDeptIdArr).collect(Collectors.toSet()); Set<String> appointDeptIdSet = Arrays.stream(appointDeptIdArr).collect(Collectors.toSet());
authority.setDepartIdSet(appointDeptIdSet); // 过滤被删除的数据
sysDeptList = sysDeptMapper.getDeptListByDeptIdSet(appointDeptIdSet);
Set<String> normalDeptIdSet = new HashSet<>();
if(Common.isNotNull(sysDeptList)){
for(SysDept dept : sysDeptList){
normalDeptIdSet.add(dept.getDeptId().toString());
}
}
authority.setDepartIdSet(normalDeptIdSet);
authority.setUserId(userId); authority.setUserId(userId);
// redisUtil.set(CacheConstants.PROJECT_USER_PERMISSION + projectNoStr +"_"+ userId, authority);
} else { } else {
log.error("获取用户权限失败,该用户指定部门权限为空{}", userId); log.error("获取用户权限失败,该用户指定部门权限为空{}", userId);
authority.setHaveAll(false); authority.setHaveAll(false);
......
...@@ -63,6 +63,23 @@ ...@@ -63,6 +63,23 @@
and (dept_id = #{deptId} or ancestors like concat(#{deptIdSplit}, '%')) and (dept_id = #{deptId} or ancestors like concat(#{deptIdSplit}, '%'))
</select> </select>
<select id="getDeptListByDeptIdSet" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept">
select
dept_id as deptId,
name as deptName
from
sys_dept
where
del_flag = '0'
<if test="departIdSet != null and departIdSet.size > 0">
AND dept_id in
<foreach item="idStr" index="index" collection="departIdSet" open="(" separator=","
close=")">
#{idStr}
</foreach>
</if>
</select>
<select id="cspDeptList" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptVo"> <select id="cspDeptList" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptVo">
select d.dept_id, d.name, d.parent_id,d.ancestors,sort_order select d.dept_id, d.name, d.parent_id,d.ancestors,sort_order
from sys_dept d from sys_dept d
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment