@ -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+"'");
}
}elseif(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 {
Stringsql;
// 查询部门本身
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);
ChartPOdepartmentChartPO=newChartPO();
@ -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()){
ChartPOchartPO=newChartPO();
@ -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(ChartPOjobTitlePO:jobTitleList){
@ -290,7 +300,7 @@ public class ChartServiceImpl extends Service implements ChartService {
@ -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+"'";
@ -84,7 +83,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
}
List<CompanyTreePO>companyTree=newArrayList<>();
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(newRecordSet().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(newRecordSet().getDBType()).ifNull("supsubcomid","0")+" = '0'";
Stringsql="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(newRecordSet().getDBType()).ifNull("supsubcomid","0")+" = '"+subcompany+"'";
Stringsql="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(newRecordSet().getDBType()).ifNull("supsubcomid","0")+" = '"+subcompany+"'";
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(newRecordSet().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(newRecordSet().getDBType()).ifNull("supsubcomid","0")+" = '"+subcompany+"' and companyid = '"+fclass+"'";