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+"'");
}
}else{
}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.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+"'");
}
}else{
}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+"'");
@ -225,12 +228,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 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()){
@ -250,7 +261,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();
@ -265,33 +280,22 @@ public class ChartServiceImpl extends Service implements ChartService {
jobTitleList.add(chartPO);
jobTitleList.add(chartPO);
}
}
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 = ?";
if(isRealTime){
if(isRealDimension){
sql="select a.id,a.lastname as name ,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.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{
sql="select a.resourceid as id,a.lastname as name ,a.belongto ,a.companyworkyear from jcl_chart_resource a where a.status < 4 and a.departmentid = ? and a.jobtitleid = ? and versionid = "+versionId;
sql="select a.id,a.lastname as name ,a.jobtitle ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? ";
if(isRealTime){
if(isRealDimension){
sql="select a.id,a.lastname as name ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? ";
}else{
sql="select a.id,a.lastname as name ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? ";
}
}else{
sql="select a.resourceid as id,a.lastname as name ,a.belongto ,a.companyworkyear from jcl_chart_resource a where a.status < 4 and a.departmentid = ? and versionid = "+versionId;
return"select id,companyname as name,'0' as type from hrmcompany";
return"select id,companyname as name,'0' as type from "+COMPANY_TABLE;
}else{
}else{
//查询其他维度集团版本信息
//查询其他维度集团版本信息
return"select id,companyname as name,'0' as type from jcl_chart_companyvirtual where "+
return"select id,companyname as name,'0' as type from " +COMPANY_TABLE+" where " +
"versionid = "+vesionId+" and companyvirtualid = "+dimension;
" versionid = " +versionId+" and companyvirtualid = "+dimension;
}
}
}else{
}else{
return"select id,subcompanyname as name,'1' as type from jcl_chart_subcompanyvirtual where "+
if(hasVirtualFields){
" versionid= "+vesionId+" and subcompanyvirtualid"+root;
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;
}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')";
}
}else{
return"select "+SUB_COMPANY_ID+" as id,subcompanyname as name,'1' as type from "+SUB_COMPANY_TABLE+" where versionid = "+versionId+" and subcompanyid = "+root;
}
}
}
}
}
@ -764,7 +799,7 @@ public class ChartServiceImpl extends Service implements ChartService {
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{
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{
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){
sql+=" and companyid = "+fObjId;
}
break;
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;
}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;
}
}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 (supdepartmentid is null or supdepartmentid = '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;
}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;
}
}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 supdepartmentid = '"+fObjId+"' and versionid = "+versionId;
sql = "select id from " + SUB_COMPANY_TABLE + " where (supsubcomid is null or supsubcomid = '0') and companyid = '" + fObjId + "'";
// sql = "select id from " + SUB_COMPANY_TABLE + " where (supsubcomid is null or supsubcomid = '0') and companyid = '" + fObjId + "'";
break;
// break;
case "1":
// case "1":
if (hasVirtualFields && !showVirtual) {
// if (hasVirtualFields && !showVirtual) {
sql = "select a.id 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 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 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 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 {
// } else {
sql = "select id from " + SUB_COMPANY_TABLE + " where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "' union select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'";
// sql = "select id from " + SUB_COMPANY_TABLE + " where (canceled is null or canceled != '1') and supsubcomid = '" + fObjId + "' union select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid1 = '" + fObjId + "'";
}
// }
break;
// break;
case "2":
// case "2":
if (hasVirtualFields && !showVirtual) {
// if (hasVirtualFields && !showVirtual) {
sql = "select a.id 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 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 {
// } else {
sql = "select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'";
// sql = "select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'";
}
// }
break;
// break;
default:
// default:
break;
// break;
}
// }
}
//}
if(StringUtils.isNotBlank(sql)){
//if (StringUtils.isNotBlank(sql)) {
RecordSet rs = new RecordSet();
// RecordSet rs = new RecordSet();
rs.executeQuery(sql);
// rs.executeQuery(sql);
return rs.next();
// return rs.next();
}
//}
returnfalse;
returnfalse;
}
}
@ -946,6 +1076,9 @@ public class ChartServiceImpl extends Service implements ChartService {
rs.executeQuery("select resourceid,workcode,lastname,sex,department,subcompany,jobtitle,mobile from jcl_chart_resource where departmentid = ? and versionid = ?",departmentId,versionId);
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 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+"'";
}
}
}else{
sql="select id as id, id as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompany where (canceled is null or canceled != '1') and "+DBType.get(newRecordSet().getDBType()).ifNull("supsubcompanyid","0")+" = '"+subcompany+"'";
sql="select id as id, id as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompanyvirtual where (canceled is null or canceled != '1') and "+DBType.get(newRecordSet().getDBType()).ifNull("supsubcompanyid","0")+" = '"+subcompany+"' and companyid = '"+fclass+"'";