Stringsql="select id ,subcompanyname ,canceled from hrmsubcompany where "+getCancelSqlStr()+" and (supsubcomid is null or supsubcomid = 0) and companyid = ? order by showorder";
Stringsql="select id ,subcompanyname ,canceled from hrmsubcompany where "+getCancelSqlStr()+" and (supsubcomid is null or supsubcomid = 0) and companyid = ? order by showorder,id";
sql="select id,departmentname ,canceled from hrmdepartment where "+getCancelSqlStr()+" and (supdepid is null or supdepid =0) and subcompanyid1 = ? order by showorder";
sql="select id,departmentname ,canceled from hrmdepartment where "+getCancelSqlStr()+" and (supdepid is null or supdepid =0) and subcompanyid1 = ? order by showorder,id";
rs.executeQuery("select id,subcompanyname,canceled from hrmsubcompany where (canceled is null or canceled != 1) and (supsubcomid is null or supsubcomid = 0) order by showorder");
rs.execute("delete from jcl_chart_subcompany where versionid = "+versionId);
@ -1272,6 +1291,7 @@ public class ChartServiceImpl extends Service implements ChartService {
if(isCurrentDimension){
sql="select "+dbType.concat("d","id")+"as id, id as value, departmentname as title, "+dbType.concat("d","supdepid")+" as pId from hrmdepartmentvirtual where (canceled is null or canceled != '1') and "+dbType.ifNull("supdepid","0")+" = "+subCompany;
}
sql+=" order by showorder,id ";
}else{
sql="select "+dbType.concat("d","departmentid")+"as id, departmentid as value, departmentname as title, "+dbType.concat("d","supdepartmentid")+" as pId from jcl_chart_department where (canceled is null or canceled != '1') and "+dbType.ifNull("supdepartmentid","0")+" = "+subCompany;
if(isCurrentDimension){
@ -1282,18 +1302,19 @@ public class ChartServiceImpl extends Service implements ChartService {
}
}else{
if(isSearchCurrent){
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.ifNull("supsubcomid","0")+" = "+subCompany+
" union select "+dbType.concat("d","id")+"as id, id as value, departmentname as title, subcompanyid1 as pId from hrmdepartment where (canceled is null or canceled != '1') and " +dbType.ifNull("subcompanyid1","0")+" = "+subCompany;
sql="select id as id, id as value, subcompanyname as title, supsubcomid as pId, showorder from hrmsubcompany where (canceled is null or canceled != '1') and " +dbType.ifNull("supsubcomid","0")+" = "+subCompany+
" union select "+dbType.concat("d","id")+"as id, id as value, departmentname as title, subcompanyid1 as pId, showorder from hrmdepartment where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and " +dbType.ifNull("subcompanyid1","0")+" = "+subCompany;
if(isCurrentDimension){
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.ifNull("supsubcomid","0")+" = "+subCompany+" and companyid = '"+dimension+"' "+
" union select "+dbType.concat("d","id")+"as id, id as value, departmentname as title, subcompanyid1 as pId from hrmdepartmentvirtual where (canceled is null or canceled != '1') and " +dbType.ifNull("subcompanyid1","0")+" = "+subCompany;
" union select "+dbType.concat("d","id")+"as id, id as value, departmentname as title, subcompanyid1 as pId from hrmdepartmentvirtual where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and" +dbType.ifNull("subcompanyid1","0")+" = "+subCompany;
}
sql+=" order by showorder,id ";
}else{
sql="select subcompanyid as id, subcompanyid as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompany where (canceled is null or canceled != '1') and "+dbType.ifNull("supsubcompanyid","0")+" = "+subCompany+
" union select "+dbType.concat("d","subcompanyid")+"as id, subcompanyid as value, departmentname as title, subcompanyid as pId from jcl_chart_department where (canceled is null or canceled != '1') and " +dbType.ifNull("subcompanyid","0")+" = "+subCompany;
" union select "+dbType.concat("d","subcompanyid")+"as id, subcompanyid as value, departmentname as title, subcompanyid as pId from jcl_chart_department where (canceled is null or canceled != '1') and (supdepartmentid is null or supdepartmentid =0) and " +dbType.ifNull("subcompanyid","0")+" = "+subCompany;
if(isCurrentDimension){
sql="select subcompanyvirtualid as id, subcompanyvirtualid as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompanyvirtual where (canceled is null or canceled != '1') and "+dbType.ifNull("supsubcompanyid","0")+" = "+subCompany+" and companyid = '"+dimension+"' "+
" union select "+dbType.concat("d","departmentvirtualid")+"as id, departmentvirtualid as value, departmentname as title, subcompanyid as pId from jcl_chart_departmentvirtual where (canceled is null or canceled != '1') and " +dbType.ifNull("subcompanyid","0")+" = "+subCompany;
" union select "+dbType.concat("d","departmentvirtualid")+"as id, departmentvirtualid as value, departmentname as title, subcompanyid as pId from jcl_chart_departmentvirtual where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and" +dbType.ifNull("subcompanyid","0")+" = "+subCompany;