From 02186c67bbac3f4b1d08a4d514c91b0d08a9e933 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Thu, 18 May 2023 09:03:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=8F=E8=A7=86=E5=9B=BE=E5=88=86=E6=9D=83?= =?UTF-8?q?=E3=80=81=E9=83=A8=E9=97=A8=E8=B4=9F=E8=B4=A3=E4=BA=BA=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/junchuang/service/OrgChartServiceImpl.java | 10 ++++++---- src/com/engine/junchuang/util/detach/DetachUtil.java | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/com/engine/junchuang/service/OrgChartServiceImpl.java b/src/com/engine/junchuang/service/OrgChartServiceImpl.java index 575b24b..2264435 100644 --- a/src/com/engine/junchuang/service/OrgChartServiceImpl.java +++ b/src/com/engine/junchuang/service/OrgChartServiceImpl.java @@ -158,7 +158,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { whereSql += " and t.ftype = 3 and fobjid = '" + bmfzr + "' "; bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr)); } else { - whereSql += " and t.fparentid = " + id.split("_")[0] + " and ((t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))"; + whereSql += " and t.fparentid = " + id.split("_")[0] + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")) or (t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))"; } } } else { @@ -440,14 +440,16 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { manageDeptId = id; id = id.split("_")[0]; //sql += " and ftype = 3 "; - sql += " and t.id != '" + id.split("_")[1] + "'"; + if (manageDeptId.contains("_")) { + sql += " and t.id != '" + manageDeptId.split("_")[1] + "'"; + } } DetachUtil detachUtil = new DetachUtil(user); if (detachUtil.isDetach()) { if ("0".equals(id)) { - sql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")"; + sql += " and t.ftype = 1 and t.fparentid = " + id + " and t.fobjid in(" + detachUtil.getCompanyIds() + ")"; } else { if (StringUtils.isNotBlank(bmfzr)) { bmfzr = bmfzr.split(",")[0]; @@ -455,7 +457,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { sql += " and t.ftype = 3 and fobjid = '" + bmfzr + "' "; bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr)); } else { - sql += " and t.fparentid = " + id + " and ((t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))"; + sql += " and t.fparentid = " + id + " and ((t.ftype =1 and t.fobjid in(" + detachUtil.getCompanyIds() + ")) or (t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))"; } } } else { diff --git a/src/com/engine/junchuang/util/detach/DetachUtil.java b/src/com/engine/junchuang/util/detach/DetachUtil.java index f4614cf..c2994b2 100644 --- a/src/com/engine/junchuang/util/detach/DetachUtil.java +++ b/src/com/engine/junchuang/util/detach/DetachUtil.java @@ -101,6 +101,9 @@ public class DetachUtil { List ids = Arrays.asList(allSupCompany.split(",")); companyIds.addAll(ids); } + ArrayList childCompIds = new ArrayList<>(); + new SubCompanyComInfo().getSubCompanyLists(companyId, childCompIds); + companyIds.addAll(childCompIds); companyIds.add(companyId); } }