From c023822ca5ebb3ada929224262d4b81458bb351b Mon Sep 17 00:00:00 2001 From: dxfeng Date: Tue, 11 Jul 2023 11:19:19 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E5=9B=BE=EF=BC=8C=E5=85=BC=E5=AE=B9PG=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChartServiceImpl.java | 64 +++++++++---------- .../service/impl/OrgChartServiceImpl.java | 7 +- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index fa278324..cf821805 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -125,26 +125,26 @@ public class ChartServiceImpl extends Service implements ChartService { if (s.startsWith("s")) { if (hasVirtualFields) { if (showVirtual) { - rs.executeQuery("select a.id,a.subcompanyname as 'name','1' as 'type' ,b.fblx as 'isvitual' from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and a.supsubcomid = '" + fObjId + "'" + - " union select a.id,a.departmentname as 'name','2' as 'type' ,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and subcompanyid1 = '" + fObjId + "'"); + rs.executeQuery("select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and a.supsubcomid = '" + fObjId + "'" + + " union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and subcompanyid1 = '" + fObjId + "'"); } else { - rs.executeQuery("select a.id,a.subcompanyname as 'name','1' as 'type' ,b.fblx as 'isvitual' from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "'" + - " union select a.id,a.departmentname as 'name','2' as 'type' ,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and subcompanyid1 = '" + fObjId + "'"); + rs.executeQuery("select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "'" + + " union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and subcompanyid1 = '" + fObjId + "'"); } } else { - rs.executeQuery("select a.id,a.subcompanyname as 'name','1' as 'type' from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "'" + - " union select a.id,a.departmentname as 'name','2' as 'type' from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'"); + rs.executeQuery("select a.id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "'" + + " union select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'"); } } else if (s.startsWith("d")) { if (hasVirtualFields) { if (showVirtual) { - rs.executeQuery( "select a.id,a.departmentname as 'name','2' as 'type' ,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'"); + rs.executeQuery( "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'"); } else { - rs.executeQuery( "select a.id,a.departmentname as 'name','2' as 'type' ,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'"); + rs.executeQuery( "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'"); } } else { - rs.executeQuery( "select a.id,a.departmentname as 'name','2' as 'type' from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'"); + rs.executeQuery( "select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'"); } } while (rs.next()){ @@ -200,9 +200,9 @@ public class ChartServiceImpl extends Service implements ChartService { String sql; // 查询部门本身 if(hasVirtualFields){ - sql = "select a.id,a.departmentname as 'name',b.bmfzr,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where a.id = '" + departmentId + "'"; + sql = "select a.id,a.departmentname as name,b.bmfzr,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where a.id = '" + departmentId + "'"; }else { - sql = "select a.id,a.departmentname as 'name',b.bmfzr from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where a.id = '" + departmentId + "'"; + sql = "select a.id,a.departmentname as name,b.bmfzr from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where a.id = '" + departmentId + "'"; } rs.executeQuery(sql); ChartPO departmentChartPO = new ChartPO(); @@ -223,7 +223,7 @@ public class ChartServiceImpl extends Service implements ChartService { if (showJob) { // 查询部门下的岗位 - sql = "select a.id,a.jobtitlename as 'name' from hrmjobtitles a inner join jcl_org_job b on a.id = b.ec_jobtitle where b.ec_department = '" + departmentId + "'"; + sql = "select a.id,a.jobtitlename as name from hrmjobtitles a inner join jcl_org_job b on a.id = b.ec_jobtitle where b.ec_department = '" + departmentId + "'"; rs.executeQuery(sql); while (rs.next()) { ChartPO chartPO = new ChartPO(); @@ -239,9 +239,9 @@ public class ChartServiceImpl extends Service implements ChartService { } if ("0".equals(dimension)) { - sql = "select a.id,a.lastname as 'name' ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? and a.jobtitle = ?"; + sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? and a.jobtitle = ?"; } else { - sql = "select a.id,a.lastname as 'name' ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? and a.jobtitle = ?"; + sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? and a.jobtitle = ?"; } // 遍历岗位、查询对应岗位下的人员 for (ChartPO jobTitlePO : jobTitleList) { @@ -275,7 +275,7 @@ public class ChartServiceImpl extends Service implements ChartService { departmentChartPO.setHasChildren(CollectionUtils.isNotEmpty(jobTitleList) ? "1" : "0"); }else { // 直接查询岗位下的人员 - sql = "select a.id,a.lastname as 'name' ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? "; + sql = "select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? "; rs.executeQuery(sql, departmentId); while (rs.next()) { ChartPO chartPO = new ChartPO(); @@ -319,21 +319,21 @@ public class ChartServiceImpl extends Service implements ChartService { // 查询集团数据 if ("0".equals(dimension)) { // 查询实际集团表 - return "select id,companyname as 'name','0' as 'type' from " + COMPANY_TABLE; + return "select id,companyname as name,'0' as type from " + COMPANY_TABLE; } else { // 查询其他维度集团信息 - return "select id,companyname as 'name','0' as 'type' from " + COMPANY_TABLE + " where id = '" + dimension + "'"; + return "select id,companyname as name,'0' as type from " + COMPANY_TABLE + " where id = '" + dimension + "'"; } } else { if (hasVirtualFields) { if (showVirtual) { - return "select a.id,a.subcompanyname as 'name','1' as 'type' ,b.fblx as 'isvitual' from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where a.id = '" + root + "'"; + return "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where a.id = '" + root + "'"; } else { - return "select a.id,a.subcompanyname as 'name','1' as 'type' ,b.fblx as 'isvitual' from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where a.id = '" + root + "' and (b.fblx is null or b.fblx!='1')"; + return "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where a.id = '" + root + "' and (b.fblx is null or b.fblx!='1')"; } } else { - return "select id,subcompanyname as 'name','1' as 'type' from " + SUB_COMPANY_TABLE + " where id = '" + root + "'"; + return "select id,subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " where id = '" + root + "'"; } } } @@ -354,37 +354,37 @@ public class ChartServiceImpl extends Service implements ChartService { case "0": if (hasVirtualFields) { if (showVirtual) { - sql = "select a.id,a.subcompanyname as 'name','1' as 'type' ,b.fblx as 'isvitual' from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and a.companyid = '" + fObjId + "'"; + sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and a.companyid = '" + fObjId + "'"; } else { - sql = "select a.id,a.subcompanyname as 'name','1' as 'type' ,b.fblx as 'isvitual' from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and (b.fblx is null or b.fblx != '1') and a.companyid = '" + fObjId + "'"; + sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and (b.fblx is null or b.fblx != '1') and a.companyid = '" + fObjId + "'"; } } else { - sql = "select a.id,a.subcompanyname as 'name','1' as 'type' from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and a.companyid = '" + fObjId + "'"; + sql = "select a.id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and a.companyid = '" + fObjId + "'"; } break; case "1": if (hasVirtualFields) { if (showVirtual) { - sql = "select a.id,a.subcompanyname as 'name','1' as 'type' ,b.fblx as 'isvitual' from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and a.supsubcomid = '" + fObjId + "'" + - " union select a.id,a.departmentname as 'name','2' as 'type' ,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and subcompanyid1 = '" + fObjId + "'"; + sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and a.supsubcomid = '" + fObjId + "'" + + " union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and subcompanyid1 = '" + fObjId + "'"; } else { - sql = "select a.id,a.subcompanyname as 'name','1' as 'type' ,b.fblx as 'isvitual' from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "'" + - " union select a.id,a.departmentname as 'name','2' as 'type' ,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and subcompanyid1 = '" + fObjId + "'"; + sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "'" + + " union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and (b.bmlx is null or b.bmlx != '1') and subcompanyid1 = '" + fObjId + "'"; } } else { - sql = "select a.id,a.subcompanyname as 'name','1' as 'type' from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "'" + - " union select a.id,a.departmentname as 'name','2' as 'type' from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'"; + sql = "select a.id,a.subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "'" + + " union select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'"; } break; case "2": if (hasVirtualFields) { if (showVirtual) { - sql = "select a.id,a.departmentname as 'name','2' as 'type' ,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'"; + sql = "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "'"; } else { - sql = "select a.id,a.departmentname as 'name','2' as 'type' ,b.bmlx as 'isvitual' from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'"; + sql = "select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "'"; } } else { - sql = "select a.id,a.departmentname as 'name','2' as 'type' from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'"; + sql = "select a.id,a.departmentname as name,'2' as type from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'"; } break; default: diff --git a/src/com/engine/organization/service/impl/OrgChartServiceImpl.java b/src/com/engine/organization/service/impl/OrgChartServiceImpl.java index 720a5e62..638c45d1 100644 --- a/src/com/engine/organization/service/impl/OrgChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/OrgChartServiceImpl.java @@ -18,7 +18,6 @@ import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.detach.DetachUtil; import org.apache.commons.lang3.StringUtils; -import tebie.applib.api.O; import weaver.conn.RecordSet; import weaver.general.Util; import weaver.hrm.User; @@ -84,7 +83,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { } List companyTree = new ArrayList<>(); - sql = "select id as 'id', id as 'value', subcompanyname as 'title', supsubcomid as 'pId' from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '0'"; + sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '0'"; rs.executeQuery(sql); while (rs.next()) { companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).build()); @@ -107,9 +106,9 @@ public class OrgChartServiceImpl extends Service implements OrgChartService { subcompany = "0"; } String fclass = Util.null2String(params.get("fclass")); - String sql = "select id as 'id', id as 'value', subcompanyname as 'title', supsubcomid as 'pId' from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "'"; + String sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "'"; if (StringUtils.isNotBlank(fclass) && !"0".equals(fclass)) { - sql = "select id as 'id', id as 'value', subcompanyname as 'title', supsubcomid as 'pId' from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "' and companyid = '" + fclass + "'"; + sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "' and companyid = '" + fclass + "'"; } rs.executeQuery(sql); while (rs.next()) { From 688eeb125c54a1a30cccbff8de8969d5421d8b0b Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 11 Jul 2023 15:17:56 +0800 Subject: [PATCH 2/4] v3 --- .../organization/service/ChartService.java | 10 +++++ .../service/impl/ChartServiceImpl.java | 37 ++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/com/engine/organization/service/ChartService.java b/src/com/engine/organization/service/ChartService.java index 20710587..5d789c64 100644 --- a/src/com/engine/organization/service/ChartService.java +++ b/src/com/engine/organization/service/ChartService.java @@ -29,4 +29,14 @@ public interface ChartService { Map getDepartmentDetail(Map params); + /** + * @Description: 根据Id获取版本日期 + * @Author: liang.cheng + * @Date: 2023/7/11 2:53 PM + * @param: [id] + * @return: java.lang.String + */ + String selectVersionDate(String id); + + } diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index fa278324..79bdddfc 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -63,6 +63,9 @@ public class ChartServiceImpl extends Service implements ChartService { String depth = Util.null2String(params.get("level")); + //版本id + String id = Util.null2String(params.get("id")); + // 初始化表名 initTableNameByClass(dimension); @@ -71,8 +74,13 @@ public class ChartServiceImpl extends Service implements ChartService { String sql = ""; ChartPO topChartPO = null; - //TODO 查询当前实际数据 - sql = getRealTimeTopSql(root, dimension); + //查询当前实际数据 + if("0".equals(id)){ + sql = getRealTimeTopSql(root, dimension); + }else { + sql = getLastTimeTopSql(root,dimension,id); + } + rs.executeQuery(sql); // 封装顶部节点 @@ -99,6 +107,8 @@ public class ChartServiceImpl extends Service implements ChartService { return result; } + + @Override public Map asyncCompanyData(Map params) { @@ -307,6 +317,29 @@ public class ChartServiceImpl extends Service implements ChartService { return result; } + @Override + public String selectVersionDate(String id) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select recorddate from jcl_org_chartversion where id = ?",id); + rs.next(); + return rs.getString("recorddate"); + } + + /** + * 获取历史顶部元素sql + * @param root + * @param dimension 维度ID + * @param id + * @return + */ + private String getLastTimeTopSql(String root, String dimension, String id) { + if ("0".equals(root)) { + //查询集团维度历史数据 + + } + return null; + } + /** * 查询实时数据,顶级元素SQL * From 54abf562a474a3be9d840a21ca47f32344724bee Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 11 Jul 2023 16:06:23 +0800 Subject: [PATCH 3/4] v3 --- .../service/impl/ChartServiceImpl.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index af1d6c63..28207e6c 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -329,15 +329,24 @@ public class ChartServiceImpl extends Service implements ChartService { * 获取历史顶部元素sql * @param root * @param dimension 维度ID - * @param id + * @param vesionId * @return */ - private String getLastTimeTopSql(String root, String dimension, String id) { + private String getLastTimeTopSql(String root, String dimension, String vesionId) { if ("0".equals(root)) { - //查询集团维度历史数据 - + //查询集团维度历史版本 + if ("0".equals(dimension)) { + //组织维度 + return "select id,companyname as name,'0' as type from hrmcompany"; + } else { + //查询其他维度集团版本信息 + return "select id,companyname as name,'0' as type from jcl_chart_companyvirtual where " + + " versionid = "+vesionId+" and companyvirtualid = "+dimension; + } + }else { + return "select id,subcompanyname as name,'1' as type from jcl_chart_subcompanyvirtual where " + + " versionid= "+vesionId+" and subcompanyvirtualid"+root; } - return null; } /** From 1a188a197547958c1e240b71077227b49b7bfb1c Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 11 Jul 2023 18:04:08 +0800 Subject: [PATCH 4/4] v3 --- .../chart/history/CompanyVirtualHistory.java | 46 +++++++++ .../chart/history/DepartmentHistory.java | 56 +++++++++++ .../history/DepartmentVirtualHistory.java | 56 +++++++++++ .../entity/chart/history/JobHistory.java | 51 ++++++++++ .../entity/chart/history/ResourceHistory.java | 94 +++++++++++++++++++ .../chart/history/ResourceVirtualHistory.java | 42 +++++++++ .../history/SubCompanyVirtualHistory.java | 54 +++++++++++ .../chart/history/SubcompanyHistory.java | 56 +++++++++++ 8 files changed, 455 insertions(+) create mode 100644 src/com/engine/organization/entity/chart/history/CompanyVirtualHistory.java create mode 100644 src/com/engine/organization/entity/chart/history/DepartmentHistory.java create mode 100644 src/com/engine/organization/entity/chart/history/DepartmentVirtualHistory.java create mode 100644 src/com/engine/organization/entity/chart/history/JobHistory.java create mode 100644 src/com/engine/organization/entity/chart/history/ResourceHistory.java create mode 100644 src/com/engine/organization/entity/chart/history/ResourceVirtualHistory.java create mode 100644 src/com/engine/organization/entity/chart/history/SubCompanyVirtualHistory.java create mode 100644 src/com/engine/organization/entity/chart/history/SubcompanyHistory.java diff --git a/src/com/engine/organization/entity/chart/history/CompanyVirtualHistory.java b/src/com/engine/organization/entity/chart/history/CompanyVirtualHistory.java new file mode 100644 index 00000000..f780c537 --- /dev/null +++ b/src/com/engine/organization/entity/chart/history/CompanyVirtualHistory.java @@ -0,0 +1,46 @@ +package com.engine.organization.entity.chart.history; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author liang.cheng + * @Date 2023/7/11 4:36 PM + * @Description: 虚拟维度历史表 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class CompanyVirtualHistory { + + private Integer id; + + private Integer companyVirtualId; + + private String creater; + + private String companyName; + + private String companyCode; + + private String companyDesc; + + private Integer showOrder; + + private Integer canceled; + + private String virtualType; + + private String virtualTypeDesc; + + private String versionDate; + + private Integer versionId; + + private Integer fonJob; + +} diff --git a/src/com/engine/organization/entity/chart/history/DepartmentHistory.java b/src/com/engine/organization/entity/chart/history/DepartmentHistory.java new file mode 100644 index 00000000..53cb1b7e --- /dev/null +++ b/src/com/engine/organization/entity/chart/history/DepartmentHistory.java @@ -0,0 +1,56 @@ +package com.engine.organization.entity.chart.history; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author liang.cheng + * @Date 2023/7/11 4:36 PM + * @Description: 部门历史表 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class DepartmentHistory { + + private Integer id; + + private String creater; + + private Integer departmentId; + + private String departmentMark; + + private String departmentName; + + private String subcompanyId; + + private String subcompany; + + private Integer supDepartmentId; + + private String supDepartment; + + private Integer canceled; + + private String departmentCode; + + private String coadJutant; + + private Integer tlevel; + + private String versionDate; + + private Integer versionId; + + private Integer fonjob; + + private Integer isVirtual; + + private String fLeader; + +} diff --git a/src/com/engine/organization/entity/chart/history/DepartmentVirtualHistory.java b/src/com/engine/organization/entity/chart/history/DepartmentVirtualHistory.java new file mode 100644 index 00000000..5c19d075 --- /dev/null +++ b/src/com/engine/organization/entity/chart/history/DepartmentVirtualHistory.java @@ -0,0 +1,56 @@ +package com.engine.organization.entity.chart.history; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author liang.cheng + * @Date 2023/7/11 4:36 PM + * @Description: 虚拟维度部门历史表 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class DepartmentVirtualHistory { + + private Integer id; + + private Integer departmentVirtualId; + + private String creater; + + private String departmentName; + + private String departmentCode; + + private String departmentMark; + + private String supDepartment; + + private Integer supDepId; + + private String allSupDepId; + + private String subCompany; + + private String subCompanyId; + + private Integer canceled; + + private String virtualType; + + private String tLevel; + + private String showOrder; + + private String versionDate; + + private Integer versionId; + + private Integer fonJob; + +} diff --git a/src/com/engine/organization/entity/chart/history/JobHistory.java b/src/com/engine/organization/entity/chart/history/JobHistory.java new file mode 100644 index 00000000..ce1052f9 --- /dev/null +++ b/src/com/engine/organization/entity/chart/history/JobHistory.java @@ -0,0 +1,51 @@ +package com.engine.organization.entity.chart.history; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author liang.cheng + * @Date 2023/7/11 4:59 PM + * @Description: 岗位历史表 + * @Version 1.0 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class JobHistory { + + private Integer id; + + private String creater; + + private Integer jobId; + + private String jobName; + + private Integer departmentId; + + private String department; + + private Integer subCompanyId; + + private String subCompany; + + private String jobResponsibility; + + private Integer canceled; + + private String jobCode; + + private String description; + + private String versionDate; + + private Integer versionId; + + private Integer fonJob; + +} diff --git a/src/com/engine/organization/entity/chart/history/ResourceHistory.java b/src/com/engine/organization/entity/chart/history/ResourceHistory.java new file mode 100644 index 00000000..dc642ef0 --- /dev/null +++ b/src/com/engine/organization/entity/chart/history/ResourceHistory.java @@ -0,0 +1,94 @@ +package com.engine.organization.entity.chart.history; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author liang.cheng + * @Date 2023/7/11 4:36 PM + * @Description: 人员历史表(增量) + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ResourceHistory { + + private Integer id; + + private Integer resourceId; + + private String creater; + + private Integer workyear; + + private String usekind; + + private String managerStr; + + private Integer status; + + private String sex; + + private Integer accountType; + + private Integer belongTo; + + private String loginId; + + private String maritalStatus; + + private String telephone; + + private String mobile; + + private String mobileCall; + + private String email; + + private String locationName; + + private String resourceType; + + private String startDate; + + private String endDate; + + private Integer jobTitleId; + + private String jobTitle; + + private Integer jobLevel; + + private Integer secLevel; + + private Integer departmentId; + + private String department; + + private String subcompanyId; + + private String subcompany; + + private String costCenter; + + private Integer manager; + + private Integer assistant; + + private String workcode; + + private String classification; + + private String versionDate; + + private Integer versionId; + + private Integer policy; + + private String degree; + +} diff --git a/src/com/engine/organization/entity/chart/history/ResourceVirtualHistory.java b/src/com/engine/organization/entity/chart/history/ResourceVirtualHistory.java new file mode 100644 index 00000000..3ae6c245 --- /dev/null +++ b/src/com/engine/organization/entity/chart/history/ResourceVirtualHistory.java @@ -0,0 +1,42 @@ +package com.engine.organization.entity.chart.history; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author liang.cheng + * @Date 2023/7/11 4:59 PM + * @Description: 虚拟人员历史表 + * @Version 1.0 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ResourceVirtualHistory { + + private Integer id; + + private Integer resourceId; + + private Integer managerId; + + private Integer subCompanyId; + + private String departmentId; + + private String managerStr; + + private Integer virtualType; + + private String description; + + private String versionDate; + + private Integer versionId; + + +} diff --git a/src/com/engine/organization/entity/chart/history/SubCompanyVirtualHistory.java b/src/com/engine/organization/entity/chart/history/SubCompanyVirtualHistory.java new file mode 100644 index 00000000..c4dbb0b5 --- /dev/null +++ b/src/com/engine/organization/entity/chart/history/SubCompanyVirtualHistory.java @@ -0,0 +1,54 @@ +package com.engine.organization.entity.chart.history; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author liang.cheng + * @Date 2023/7/11 4:36 PM + * @Description: 虚拟维度分部历史表 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SubCompanyVirtualHistory { + + private Integer id; + + private Integer subCompanyVirtualId; + + private String creater; + + private String subCompanyName; + + private String subCompanyCode; + + private String subCompanyDesc; + + private String supSubCompany; + + private Integer supSubCompId; + + private String company; + + private String companyId; + + private Integer canceled; + + private String virtualType; + + private String tLevel; + + private String showOrder; + + private String versionDate; + + private Integer versionId; + + private Integer fonJob; + +} diff --git a/src/com/engine/organization/entity/chart/history/SubcompanyHistory.java b/src/com/engine/organization/entity/chart/history/SubcompanyHistory.java new file mode 100644 index 00000000..704da6b2 --- /dev/null +++ b/src/com/engine/organization/entity/chart/history/SubcompanyHistory.java @@ -0,0 +1,56 @@ +package com.engine.organization.entity.chart.history; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author liang.cheng + * @Date 2023/7/11 4:36 PM + * @Description: 分部历史表 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SubcompanyHistory { + + private Integer id; + + private String creater; + + private Integer subcompanyId; + + private String subcompanyName; + + private String subcompanyDesc; + + private String company; + + private String supSubcompanyId; + + private String supSubcompany; + + private Integer canceled; + + private String subcompanyCode; + + private Integer limitUsers; + + private Integer tlevel; + + private String versionDate; + + private Integer versionId; + + private Integer fonJob; + + private Integer isVirtual; + + + + + +}