diff --git a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/factoryinfo/FactoryInfoServiceImpl.java b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/factoryinfo/FactoryInfoServiceImpl.java index c9275e89..f7a92819 100644 --- a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/factoryinfo/FactoryInfoServiceImpl.java +++ b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/factoryinfo/FactoryInfoServiceImpl.java @@ -233,20 +233,23 @@ public class FactoryInfoServiceImpl implements FactoryInfoService { @Override public List getFactoryListByAuthority() { - List factoryIds = null; + List factoryIds = new ArrayList<>(); DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(getLoginUserId()).getCheckedData(); // 如果当前登录用户数据权限 不是查看全部数据 if (!deptDataPermission.getAll()) { + // 获取自己所在工厂 + DeptRespDTO respDTO = deptApi.getDept(userApi.getUser(getLoginUserId()).getCheckedData().getDeptId()).getCheckedData(); + if (respDTO != null && respDTO.getFactoryId() != null) { + factoryIds.add(respDTO.getFactoryId()); + } + + // 查找担任负责人的工厂信息 List deptRespDTO = deptApi.getDeptByLeaderId(getLoginUserId()).getCheckedData(); if (deptRespDTO != null) { - factoryIds = convertList(deptRespDTO, DeptRespDTO::getFactoryId); - } else { - - DeptRespDTO respDTO = deptApi.getDept(userApi.getUser(getLoginUserId()).getCheckedData().getDeptId()).getCheckedData(); - factoryIds = Collections.singletonList(respDTO.getFactoryId()); + factoryIds.addAll(convertList(deptRespDTO, DeptRespDTO::getFactoryId)); } }