From 4d88d2f063a8af474621704e2c392d28517b3210 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Wed, 3 Jul 2024 17:04:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=B6=E6=9E=84=E5=9B=BEBUG=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChartServiceImpl.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index 19194ee7..acd8bc93 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -1418,17 +1418,21 @@ public class ChartServiceImpl extends Service implements ChartService { * @return 查询SQL */ private String getLastTimeChildSql(String sql, String fType, String fObjId, String versionId) { + String numSql = ",a.job_num,a.staff_num"; + if (!isRealDimension) { + numSql = ""; + } if (StringUtils.isNotBlank(fType)) { switch (fType) { case "0": if (hasVirtualFields) { if (showVirtual) { - sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = " + versionId; + sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual" + numSql + " from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = " + versionId; } else { - sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and (isvirtual is null or isvirtual != '1') and versionid = " + versionId; + sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual" + numSql + " from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and (isvirtual is null or isvirtual != '1') and versionid = " + versionId; } } else { - sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = " + versionId; + sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type" + numSql + " from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = " + versionId; } if (!isRealDimension) { sql += " and companyid = " + fObjId; @@ -1437,26 +1441,26 @@ public class ChartServiceImpl extends Service implements ChartService { case "1": if (hasVirtualFields) { if (showVirtual) { - sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId + - " union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId; + sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual" + numSql + " from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId + + " union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual" + numSql + " from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId; } else { - sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId + - " union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and (isvirtual is null or isvirtual != '1') and subcompanyid = '" + fObjId + "' and versionid = " + versionId; + sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual" + numSql + " from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId + + " union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual" + numSql + " from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and (isvirtual is null or isvirtual != '1') and subcompanyid = '" + fObjId + "' and versionid = " + versionId; } } else { - sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcompanyid = '" + fObjId + "' and versionid = " + versionId + - " union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId; + sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type" + numSql + " from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcompanyid = '" + fObjId + "' and versionid = " + versionId + + " union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type" + numSql + " from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId; } break; case "2": if (hasVirtualFields) { if (showVirtual) { - sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = " + versionId; + sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual" + numSql + " from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = " + versionId; } else { - sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supdepartmentid = '" + fObjId + "' and versionid = " + versionId; + sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual" + numSql + " from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supdepartmentid = '" + fObjId + "' and versionid = " + versionId; } } else { - sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "' and versionid = " + versionId; + sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type" + numSql + " from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "' and versionid = " + versionId; } break; default: -- 2.40.0.windows.1