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; + + + + + +} diff --git a/src/com/engine/organization/service/ChartService.java b/src/com/engine/organization/service/ChartService.java index 3b32cee4..783040d6 100644 --- a/src/com/engine/organization/service/ChartService.java +++ b/src/com/engine/organization/service/ChartService.java @@ -30,6 +30,17 @@ 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); + + /** * 组织架构图,版本记录 * @param params 请求参数 diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index 82881f4e..033cb134 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -78,6 +78,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); @@ -86,8 +89,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); // 封装顶部节点 @@ -114,6 +122,8 @@ public class ChartServiceImpl extends Service implements ChartService { return result; } + + @Override public Map asyncCompanyData(Map params) { @@ -140,26 +150,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()){ @@ -215,9 +225,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(); @@ -238,7 +248,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(); @@ -254,9 +264,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) { @@ -290,7 +300,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(); @@ -322,6 +332,38 @@ 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 vesionId + * @return + */ + 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; + } + } + @Override public Map versionRecord(Map params, User user) { RecordSetTrans recordSetTrans = new RecordSetTrans(); @@ -528,21 +570,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 + "'"; } } } @@ -563,37 +605,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()) {