diff --git a/src/com/api/browser/service/impl/JobBrowserService.java b/src/com/api/browser/service/impl/JobBrowserService.java index e778f88e..7a598cbd 100644 --- a/src/com/api/browser/service/impl/JobBrowserService.java +++ b/src/com/api/browser/service/impl/JobBrowserService.java @@ -21,6 +21,7 @@ import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.detach.DetachUtil; import com.engine.organization.util.tree.SearchTreeUtil; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import weaver.conn.RecordSet; import weaver.general.Util; @@ -143,18 +144,31 @@ public class JobBrowserService extends BrowserService { private List getCurrentTreeNode(SearchTreeParams params) { // 分权 DetachUtil detachUtil = new DetachUtil(user.getUID()); - List jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList()); + List jclRoleLevelList; + if (StringUtils.isNotBlank(detachUtil.getJclRoleLevels())) { + jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList()); + }else{ + jclRoleLevelList = new ArrayList<>(); + } List treeNodes = new ArrayList<>(); if (StringUtils.isBlank(params.getId())) { // 集团总部 SearchTree topGroup = SearchTreeUtil.getTopGroup(); - topGroup.setIsParent(true); + if(detachUtil.isDETACH()&& StringUtils.isNotBlank(detachUtil.getJclRoleLevels())) { + topGroup.setIsParent(true); + }else{ + topGroup.setIsParent(false); + } treeNodes.add(topGroup); } else { // 分部存在下级的ID List compHasSubs; if (detachUtil.isDETACH()) { - compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasDetachSubs(jclRoleLevelList); + if(CollectionUtils.isNotEmpty(jclRoleLevelList)) { + compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasDetachSubs(jclRoleLevelList); + }else{ + compHasSubs = new ArrayList<>(); + } } else { compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs(); } @@ -164,8 +178,12 @@ public class JobBrowserService extends BrowserService { if ("0".equals(params.getId())) { List compList; if (detachUtil.isDETACH()) { - compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList); - detachUtil.filterCompanyList(compList); + if(CollectionUtils.isNotEmpty(jclRoleLevelList)) { + compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList); + detachUtil.filterCompanyList(compList); + }else{ + compList = new ArrayList<>(); + } }else{ compList = MapperProxyFactory.getProxy(CompMapper.class).listParent(); } diff --git a/src/com/engine/organization/mapper/detach/ManagerDetachMapper.xml b/src/com/engine/organization/mapper/detach/ManagerDetachMapper.xml index 15831b35..b4961070 100644 --- a/src/com/engine/organization/mapper/detach/ManagerDetachMapper.xml +++ b/src/com/engine/organization/mapper/detach/ManagerDetachMapper.xml @@ -11,8 +11,6 @@ - - @@ -27,8 +25,6 @@ , t.manage_module , t.creator , t.delete_type - , t.create_time - , t.update_time diff --git a/src/com/engine/organization/service/impl/ExportCommonServiceImpl.java b/src/com/engine/organization/service/impl/ExportCommonServiceImpl.java index e9826054..02b959f3 100644 --- a/src/com/engine/organization/service/impl/ExportCommonServiceImpl.java +++ b/src/com/engine/organization/service/impl/ExportCommonServiceImpl.java @@ -8,6 +8,7 @@ import com.engine.organization.util.HrmI18nUtil; import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.detach.DetachUtil; import com.engine.organization.util.excel.ExcelUtil; +import org.apache.commons.lang.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.util.ArrayList; @@ -30,8 +31,12 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ List hrmResourceVOS ; DetachUtil detachUtil = new DetachUtil(user.getUID()); if (detachUtil.isDETACH()) { - List jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList()); - hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listDetachAll(ids, jclRoleLevelList); + if (StringUtils.isBlank(detachUtil.getJclRoleLevels())) { + hrmResourceVOS = new ArrayList<>(); + } else { + List jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList()); + hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listDetachAll(ids, jclRoleLevelList); + } } else { hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listAll(ids); } diff --git a/src/com/engine/organization/service/impl/OrgChartServiceImpl.java b/src/com/engine/organization/service/impl/OrgChartServiceImpl.java index 22c644f1..7e43d71b 100644 --- a/src/com/engine/organization/service/impl/OrgChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/OrgChartServiceImpl.java @@ -55,7 +55,12 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { // 分部分权过滤 DetachUtil detachUtil = new DetachUtil(user.getUID()); if (detachUtil.isDETACH()) { - sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + "))) order by ftype , id"; + String jclRoleLevels = detachUtil.getJclRoleLevels(); + if (StringUtils.isNotBlank(jclRoleLevels)) { + sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + jclRoleLevels + "))) order by ftype , id"; + } else { + sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where ftype = 0 order by ftype , id"; + } } rs.executeQuery(sql); List> companylist = new ArrayList<>();