组织架构图:在编数

pull/218/head
Mlin 2 years ago
parent 29bfc3002e
commit 57b6542a34

@ -47,6 +47,11 @@ public class ChartPO {
// 部门层级
private int departmentDepth;
// 在编数
private int onJobNum;
// 编制数
private int staffNum;
public String getId() {
if (StringUtils.isNotBlank(ftype)) {
switch (ftype) {

@ -119,6 +119,8 @@ public class ChartServiceImpl extends Service implements ChartService {
topChartPO.setFtype(rs.getString("type"));
topChartPO.setFobjid(rs.getString("id"));
topChartPO.setFname(rs.getString("name"));
topChartPO.setOnJobNum(Util.getIntValue(rs.getString("on_job_num"),0));
topChartPO.setStaffNum(Util.getIntValue(rs.getString("on_job_num"),0));
topChartPO.setParentId(null);
topChartPO.setExpand("1");
topChartPO.setFisvitual(rs.getString("isvitual"));
@ -395,12 +397,12 @@ public class ChartServiceImpl extends Service implements ChartService {
} else {
if (hasVirtualFields) {
if (showVirtual) {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root;
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.subcompanyid=b.data_id where b.type=1 and versionid = " + versionId + " and subcompanyid = " + root;
} else {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root + " and (isvirtual is null or isvirtual != '1')";
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.subcompanyid=b.data_id where b.type=1 and versionid = " + versionId + " and subcompanyid = " + root + " and (isvirtual is null or isvirtual != '1')";
}
} else {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " where versionid = " + versionId + " and subcompanyid = " + root;
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.subcompanyid=b.data_id where b.type=1 and versionid = " + versionId + " and subcompanyid = " + root;
}
}
}
@ -1026,13 +1028,13 @@ public class ChartServiceImpl extends Service implements ChartService {
} 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 + "' order by showorder,id";
return "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual,c.on_job_num,c.staff_num from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid left join jcl_org_onjob c on a.id=c.data_id where a.id = '" + root + "' and c.type=1 order by showorder,id";
} 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') order by showorder,id";
return "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual,c.on_job_num,c.staff_num from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid left join jcl_org_onjob c on a.id=c.data_id where a.id = '" + root + "' and c.type=1 and (b.fblx is null or b.fblx!='1') order by showorder,id";
}
} else {
return "select id,subcompanyname as name,'1' as type from " + SUB_COMPANY_TABLE + " where id = '" + root + "' order by showorder,id";
return "select a.id,a.subcompanyname as name,'1' as type,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id where a.id = '" + root + "' and b.type=1 order by a.showorder,a.id";
}
}
}
@ -1062,26 +1064,26 @@ public class ChartServiceImpl extends Service implements ChartService {
case "1":
if (hasVirtualFields) {
if (showVirtual) {
sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual,showorder 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,showorder 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,showorder,c.on_job_num,c.staff_num from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid left join jcl_org_onjob c on a.id=c.data_id where (a.canceled is null or a.canceled != '1') and a.supsubcomid = '" + fObjId + "' and c.type=1" +
" union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,showorder,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id where (a.canceled is null or a.canceled != '1') and (a.supdepid is null or a.supdepid = '0') and subcompanyid1 = '" + fObjId + "' and c.type=2";
} else {
sql = "select a.id,a.subcompanyname as name,'1' as type ,b.fblx as isvitual,showorder 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,showorder 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,showorder,c.on_job_num,c.staff_num from " + SUB_COMPANY_TABLE + " a left join " + SUB_COMPANY_DEFINED_TABLE + " b on a.id = b.subcomid left join jcl_org_onjob c on a.id=c.data_id where (a.canceled is null or a.canceled != '1') and (b.fblx is null or b.fblx != '1') and a.supsubcomid = '" + fObjId + "' and c.type=1" +
" union select a.id,a.departmentname as name,'2' as type ,b.bmlx as isvitual,showorder,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id 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 + "' and c.type=2";
}
} else {
sql = "select a.id,a.subcompanyname as name,'1' as type,showorder 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,showorder 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,showorder,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "' and b.type=1" +
" union select a.id,a.departmentname as name,'2' as type,showorder,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "' and b.type=2";
}
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,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join " + DEPARTMENT_DEFINED_TABLE + " b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id where (a.canceled is null or a.canceled != '1') and supdepid = '" + fObjId + "' and c.type=2";
} 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,c.on_job_num,c.staff_num from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid left join jcl_org_onjob c on a.id=c.data_id where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and a.supdepid = '" + fObjId + "' and c.type=2";
}
} 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,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a.id=b.data_id where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "' and b.type=2";
}
break;
default:
@ -1106,12 +1108,12 @@ public class ChartServiceImpl extends Service implements ChartService {
case "0":
if (hasVirtualFields) {
if (showVirtual) {
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual 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,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id where b.type=1 and (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 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,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id where b.type=1 and (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 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,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id where b.type=1 and (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;
@ -1120,26 +1122,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 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 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,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id where b.type=1 and (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,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id where b.type=2 and (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 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 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,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id where b.type=1 and (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,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ DEPARTMENT_ID + "=b.data_id where b.type=2 and (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 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 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,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id where b.type=1 and (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,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ DEPARTMENT_ID + "=b.data_id where b.type=2 and (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 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,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ DEPARTMENT_ID + "=b.data_id where b.type=2 and (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 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,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ DEPARTMENT_ID + "=b.data_id where b.type=2 and (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 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,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ DEPARTMENT_ID + "=b.data_id where b.type=2 and (canceled is null or canceled != '1') and supdepid = '" + fObjId + "' and versionid = " + versionId;
}
break;
default:
@ -1176,6 +1178,8 @@ public class ChartServiceImpl extends Service implements ChartService {
chartPO.setFtype(recordSet.getString("type"));
chartPO.setFobjid(recordSet.getString("id"));
chartPO.setFname(recordSet.getString("name"));
chartPO.setOnJobNum(Util.getIntValue(recordSet.getString("on_job_num"),0));
chartPO.setStaffNum(Util.getIntValue(recordSet.getString("staff_num"),0));
chartPO.setParentId(topChartPO.getId());
chartPO.setFisvitual(recordSet.getString("isvitual"));
chartPO.setHasChildren(getHasChildren(chartPO.getFtype(), chartPO.getFobjid()).toString());

Loading…
Cancel
Save