package com.engine.organization.util.detach; import com.engine.organization.entity.company.po.CompPO; import com.engine.organization.entity.department.po.DepartmentPO; import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.service.impl.ManagerDetachServiceImpl; import org.apache.commons.collections.CollectionUtils; import java.util.List; /** * @author:dxfeng * @createTime: 2022/10/28 * @version: 1.0 */ public class DetachUtil { // private static final boolean IS_DETACH = "true".equals(new BaseBean().getPropValue("", "")); private boolean IS_DETACH = true; private static List ecRoleLevels = null; public DetachUtil(Integer uId) { ecRoleLevels = ManagerDetachServiceImpl.getJclRoleLevels(uId); } /** * 根据分权配置过滤分部 */ public void filterCompanyList(List companyList) { if (IS_DETACH && CollectionUtils.isNotEmpty(companyList)) { companyList.removeIf(item -> !ecRoleLevels.contains(item.getId())); } } /** * 根据分权配置过滤分部 */ public void filterDepartmentList(List departmentList) { if (IS_DETACH && CollectionUtils.isNotEmpty(departmentList)) { departmentList.removeIf(item -> !ecRoleLevels.contains(item.getParentComp())); } } /** * 根据分权配置过滤分部 */ public void filterJobList(List jobList) { if (IS_DETACH && CollectionUtils.isNotEmpty(jobList)) { jobList.removeIf(item -> !ecRoleLevels.contains(item.getParentComp())); } } }