@ -220,12 +223,20 @@ public class ChartServiceImpl extends Service implements ChartService {
RecordSetrs=newRecordSet();
RecordSetrs=newRecordSet();
// TODO 查询当前实际的数据
// TODO 查询当前实际的数据
Stringsql;
Stringsql;
if(isRealTime){
// 查询部门本身
// 查询部门本身
if(hasVirtualFields){
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{
}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+"'";
}
}
}else{
if(hasVirtualFields){
sql="select "+DEPARTMENT_ID+" as id,a.departmentname as name,fleader as bmfzr,isvirtual as isvitual from "+DEPARTMENT_TABLE+" a where a.id = '"+departmentId+"' and versionid = "+versionId;
}else{
sql="select "+DEPARTMENT_ID+" as id,a.departmentname as name,fleader as bmfzr from "+DEPARTMENT_TABLE+" a where a.id = '"+departmentId+"' and versionid = "+versionId;
}
}
rs.executeQuery(sql);
rs.executeQuery(sql);
ChartPOdepartmentChartPO=newChartPO();
ChartPOdepartmentChartPO=newChartPO();
if(rs.next()){
if(rs.next()){
@ -245,7 +256,11 @@ public class ChartServiceImpl extends Service implements ChartService {
if(showJob){
if(showJob){
// 查询部门下的岗位
// 查询部门下的岗位
if(isRealTime){
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+"'";
}else{
sql="select jobid as id ,jobname as name from jcl_chart_job where departmentid = '"+departmentId+"' and versionid = "+versionId;
}
rs.executeQuery(sql);
rs.executeQuery(sql);
while(rs.next()){
while(rs.next()){
ChartPOchartPO=newChartPO();
ChartPOchartPO=newChartPO();
@ -260,12 +275,20 @@ public class ChartServiceImpl extends Service implements ChartService {
jobTitleList.add(chartPO);
jobTitleList.add(chartPO);
}
}
if("0".equals(dimension)){
// 遍历岗位、查询对应岗位下的人员
if(isRealTime){
if(isRealDimension){
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{
}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 = ?";
}
}
// 遍历岗位、查询对应岗位下的人员
}else{
//if (isRealDimension) {
// 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 = ?";
@ -359,12 +382,12 @@ public class ChartServiceImpl extends Service implements ChartService {
}else{
}else{
if(hasVirtualFields){
if(hasVirtualFields){
if(showVirtual){
if(showVirtual){
return"select 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 from " +SUB_COMPANY_TABLE+" where versionid = "+versionId+" and subcompanyid = "+root;
}else{
}else{
return"select 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 from " +SUB_COMPANY_TABLE+" where versionid = "+versionId+" and subcompanyid = "+root+" and (isvirtual is null or isvirtual != '1')";
}
}
}else{
}else{
return"select 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 from " +SUB_COMPANY_TABLE+" where versionid = "+versionId+" and subcompanyid = "+root;
}
}
}
}
}
}
@ -468,12 +491,12 @@ public class ChartServiceImpl extends Service implements ChartService {
case"0":
case"0":
if(hasVirtualFields){
if(hasVirtualFields){
if(showVirtual){
if(showVirtual){
sql="select a.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 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;
}else{
}else{
sql="select a.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 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;
}
}
}else{
}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.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = "+versionId;
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;
}
}
if(!isRealDimension){
if(!isRealDimension){
sql+=" and companyid = "+fObjId;
sql+=" and companyid = "+fObjId;
@ -482,26 +505,26 @@ public class ChartServiceImpl extends Service implements ChartService {
case"1":
case"1":
if(hasVirtualFields){
if(hasVirtualFields){
if(showVirtual){
if(showVirtual){
sql="select a.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+
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 a.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;
" 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;
}else{
}else{
sql="select a.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+
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 a.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;
" 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;
}
}
}else{
}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 supsubcompanyid = '"+fObjId+"' and versionid = "+versionId+
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 a.id,a.departmentname as name,'2' as type from " +DEPARTMENT_TABLE+" a where (canceled is null or canceled != '1') and (supdepartmentid is null or supdepartmentid = '0') and subcompanyid = '"+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 (supdepartmentid is null or supdepartmentid = '0') and subcompanyid = '"+fObjId+"' and versionid = "+versionId;
}
}
break;
break;
case"2":
case"2":
if(hasVirtualFields){
if(hasVirtualFields){
if(showVirtual){
if(showVirtual){
sql="select a.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 from " +DEPARTMENT_TABLE+" a where (a.canceled is null or a.canceled != '1') and supdepartmentid = '"+fObjId+"' and versionid = "+versionId;
}else{
}else{
sql="select a.id,a.departmentname as name,'2' as type ,isvirtual as isvitual from " +DEPARTMENT_TABLE+" 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 from " +DEPARTMENT_TABLE+" where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supdepartmentid = '"+fObjId+"' and versionid = "+versionId;
}
}
}else{
}else{
sql="select a.id,a.departmentname as name,'2' as type from " +DEPARTMENT_TABLE+" a where (canceled is null or canceled != '1') and supdepartmentid = '"+fObjId+"' and versionid = "+versionId;
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 supdepartmentid = '"+fObjId+"' and versionid = "+versionId;
}
}
break;
break;
default:
default:
@ -593,11 +616,15 @@ public class ChartServiceImpl extends Service implements ChartService {