@ -149,15 +160,15 @@ public class ChartServiceImpl extends Service implements ChartService {
}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()){
while(rs.next()){
ChartPOchartPO=newChartPO();
chartPO.setFtype(rs.getString("type"));
chartPO.setFobjid(rs.getString("id"));
@ -184,7 +195,7 @@ public class ChartServiceImpl extends Service implements ChartService {
@ -209,14 +221,14 @@ public class ChartServiceImpl extends Service implements ChartService {
// TODO 查询当前实际的数据
Stringsql;
// 查询部门本身
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+"'";
}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+"'";
return"select id,companyname as name,'0' as type from hrmcompany";
return"select id,companyname as name,'0' as type from "+COMPANY_TABLE;
}else{
//查询其他维度集团版本信息
return"select id,companyname as name,'0' as type from jcl_chart_companyvirtual where "+
"versionid = "+vesionId+" and companyvirtualid = "+dimension;
return"select id,companyname as name,'0' as type from "+COMPANY_TABLE+" where "+
" versionid = "+versionId+" and companyvirtualid = "+dimension;
}
}else{
if(hasVirtualFields){
if(showVirtual){
return"select id,subcompanyname as name,'1' as type,isvirtual as isvitual from "+SUB_COMPANY_TABLE+" where versionid = "+versionId+" and subcompanyid = "+root;
}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')";
}
}else{
return"select id,subcompanyname as name,'1' as type from "+SUB_COMPANY_TABLE+" where versionid = "+versionId+" and subcompanyid = "+root;
}
}else{
return"select id,subcompanyname as name,'1' as type from jcl_chart_subcompanyvirtual where "+
" versionid= "+vesionId+" and subcompanyvirtualid"+root;
}
}
@ -359,7 +379,7 @@ public class ChartServiceImpl extends Service implements ChartService {
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;
}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;
}
}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;
}
if(!isRealDimension){
sql+=" and companyid = "+fObjId;
}
break;
case"1":
if(hasVirtualFields){
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+
" 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;
}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+
" 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;
}
}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+
" 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;
}
break;
case"2":
if(hasVirtualFields){
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;
}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;
}
}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 id from " + SUB_COMPANY_TABLE + " where (supsubcomid is null or supsubcomid = '0') and companyid = '" + fObjId + "'";
break;
case "1":
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 + "'";
} 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 + "'";
}
break;
case "2":
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 + "'";
} else {
sql = "select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'";
}
break;
default:
break;
}
}
if(StringUtils.isNotBlank(sql)){
RecordSet rs = new RecordSet();
rs.executeQuery(sql);
return rs.next();
}
//String sql = "";
//if (StringUtils.isNotBlank(fType)) {
// switch (fType) {
// case "0":
// sql = "select id from " + SUB_COMPANY_TABLE + " where (supsubcomid is null or supsubcomid = '0') and companyid = '" + fObjId + "'";
// break;
// case "1":
// 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 + "'";
// } 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 + "'";
// }
// break;
// case "2":
// 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 + "'";
// } else {
// sql = "select id from " + DEPARTMENT_TABLE + " where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "'";
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 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+"'";
}
}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+"'";