sql="select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,b.jobtitlename as jobname from hrmresource a left join hrmjobtitles b on a.jobtitle=b.id where a.status < 4 and a.departmentid = ? ";
sql="select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,c.zwmc as jobname \n"+
" from hrmresource a \n"+
" left join cus_fielddata b on a.id = b.id and b.scopeid = +"+scopeid+"\n"+
" left join uf_zwxxjmb c on b."+fieldid+" = c.id\n"+
" where a.status < 4 and a.departmentid = ?";
}else{
sql="select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,c.jobtitlename as jobname from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid left join hrmjobtitles c on a.jobtitle=c.id where a.status < 4 and b.departmentid = ? ";
sql="select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,d.zwmc as jobname \n"+
" from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid \n"+
" left join cus_fielddata c on a.id = c.id and c.scopeid = +"+scopeid+"\n"+
" left join uf_zwxxjmb d on c."+fieldid+" = d.id\n"+
" 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;