|
@@ -338,6 +338,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
List<Long> uidList = new ArrayList<>();
|
|
|
List<SysRole> userRoles = UserUtil.getUserRoles(userId);
|
|
|
+ List<String> myRoleKeys = userRoles.stream().map(SysRole::getRoleKey).distinct().collect(Collectors.toList());
|
|
|
// 1、如果登陆账号的上级角色包括【顶级】,则:看自己公司所有数据 (不进入if)
|
|
|
if (userRoles.stream().filter(item -> ObjectUtil.equals(0L, item.getParentId())).count() == 0) {
|
|
|
// 2、如果登录账号不存在下级角色:只看自己的数据
|
|
@@ -345,6 +346,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
// 3、如果登录账号存在下级角色:看看自己公司 & 创建人包含所有子集角色用户 的数据
|
|
|
List<SysRole> userRoleAndChildRole = UserUtil.getUserRoleAndChildRole(userId);
|
|
|
List<String> roleKeys = userRoleAndChildRole.stream().map(SysRole::getRoleKey).distinct().collect(Collectors.toList());
|
|
|
+ //删除自己的角色
|
|
|
+ roleKeys.removeAll(myRoleKeys);
|
|
|
+
|
|
|
uidList.addAll(UserUtil.getUserIdsByRoleKeys(roleKeys, SecurityUtils.getCompanyId()));
|
|
|
|
|
|
wrapper.in("t1", Contract::getCreateUser, uidList);
|