Stringsql="select id as id, id as value, departmentname as title, subcompanyid1 as pId from hrmdepartment where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and"+dbType.ifNull("subcompanyid1","0")+" = "+subCompany;
// if (CollectionUtils.isNotEmpty(topDepartmentTree)) {
// sql = "select id as id, id as value, departmentname as title, supdepid as pId from hrmdepartment where (canceled is null or canceled != '1') and " + dbType.ifNull("supdepid", "0") + " = ?";
// for (CompanyTreePO department : topDepartmentTree) {
StringinsertResourceSql="insert into jcl_chart_resource(workcode, lastname,sex,subcompany,departmentid,department,jobtitle,mobile,usekind,status,versionid) "+
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+"'";
}
// 查询集团数据
if(isRealDimension){
// 查询实际集团表
return"select id,companyname as name,'0' as type from "+COMPANY_TABLE;
}else{
if(hasVirtualFields){
if(showVirtual){
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 and c.type=1 where a.id = '"+root+"' order by showorder,id";
}else{
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 and c.type=1 where a.id = '"+root+"' and (b.fblx is null or b.fblx!='1') order by showorder,id";
}
}else{
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 and b.type=1 where a.id = '"+root+"' order by a.showorder,a.id";
}
// 查询其他维度集团信息
return"select id,companyname as name,'0' as type from "+COMPANY_TABLE+" where id = '"+dimension+"'";
}
}
@ -1293,7 +1362,7 @@ public class ChartServiceImpl extends Service implements ChartService {
@ -1307,6 +1376,10 @@ public class ChartServiceImpl extends Service implements ChartService {
sql="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 and b.type=1 where (a.canceled is null or a.canceled != '1') and (a.supsubcomid is null or a.supsubcomid = '0') and a.companyid = '"+fObjId+"'";
@ -1315,6 +1388,7 @@ public class ChartServiceImpl extends Service implements ChartService {
sql=sql+" and a.id in ("+ids+")";
}
}
break;
case"1":
if(hasVirtualFields){
@ -1322,24 +1396,36 @@ public class ChartServiceImpl extends Service implements ChartService {
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 and c.type=1 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,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 and c.type=2 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,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 and c.type=1 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,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 and c.type=2 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,0,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 and c.type=1 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,b.bmcj,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 and c.type=2 left join uf_shzg_zzjgkz d on a.id = d.bmbz 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 (d.sfxs != 1 and d.sfxs is not null) and subcompanyid1 = '" +fObjId+"'";
}
}else{
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 and b.type=1 where (canceled is null or canceled != '1') and supsubcomid = '"+fObjId+"'"+
" 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 and b.type=2 where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '"+fObjId+"'";
}
break;
//指定筛选一级部门节点数据
if(StringUtils.isNotEmpty(department)){
sql+=" and a.id = "+department;
}
break;
case"2":
if(hasVirtualFields){
if(showVirtual){
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 and c.type=2 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,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 and c.type=2 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,b.bmcj,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 and c.type=2 left join uf_shzg_zzjgkz d on a.id = d.bmbz where (canceled is null or canceled != '1') and (b.bmlx is null or b.bmlx != '1') and (d.sfxs != 1 and d.sfxs is not null) and a.supdepid = '" +fObjId+"'";
}
}else{
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 and b.type=2 where (canceled is null or canceled != '1') and supdepid = '"+fObjId+"'";
}
//隐藏班组数据
if(!showClass){
sql+=" and (b.sfbz is null or b.sfbz != '1')";
}
break;
default:
break;
@ -1353,8 +1439,9 @@ public class ChartServiceImpl extends Service implements ChartService {
@ -1381,7 +1468,7 @@ public class ChartServiceImpl extends Service implements ChartService {
" 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;
}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;
" 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 (a.sfxs = 0 or a.sfxs is null) 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+
@ -1393,7 +1480,7 @@ public class ChartServiceImpl extends Service implements ChartService {
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;
}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,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.sfxs = 0 or a.sfxs is null) 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;
@ -1414,12 +1501,12 @@ public class ChartServiceImpl extends Service implements ChartService {
rs.executeQuery("select departmentid,departmentname,fleader from jcl_chart_department where departmentid = ? and versionid = ?",param.getDepartmentId(),param.getVersionId());
@ -79,7 +80,11 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
while(rs.next()){
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf("select id from hrmsubcompany where (canceled is null or canceled != '1') and supsubcomid = ?",rs.getString("id"))).build());