分权开发
parent
40f1f097e6
commit
0b3cd0641b
@ -0,0 +1,52 @@
|
||||
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<Long> ecRoleLevels = null;
|
||||
|
||||
public DetachUtil(Integer uId) {
|
||||
ecRoleLevels = ManagerDetachServiceImpl.getJclRoleLevels(uId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterCompanyList(List<CompPO> companyList) {
|
||||
if (IS_DETACH && CollectionUtils.isNotEmpty(companyList)) {
|
||||
companyList.removeIf(item -> !ecRoleLevels.contains(item.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterDepartmentList(List<DepartmentPO> departmentList) {
|
||||
if (IS_DETACH && CollectionUtils.isNotEmpty(departmentList)) {
|
||||
departmentList.removeIf(item -> !ecRoleLevels.contains(item.getParentComp()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterJobList(List<JobPO> jobList) {
|
||||
if (IS_DETACH && CollectionUtils.isNotEmpty(jobList)) {
|
||||
jobList.removeIf(item -> !ecRoleLevels.contains(item.getParentComp()));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue