delete from jcl_org_map where ftype =3 and fdateend > #{currentDate} and id not in (select a.FPARENTID from (select FPARENTID from jcl_org_map where ftype=4 and fdateend > #{currentDate}) a)
select a.id as fLeader,a.messagerurl as fLeaderImg,a.LASTNAME as fLeaderName,c.id as fLeaderJobId,b.JOBTITLEMARK as fLeaderJob,e.level_name as fLeaderLv,f.grade_name as fLeaderSt
select a.id as fLeader,a.messagerurl as fLeaderImg,a.LASTNAME as fLeaderName,a.jobtitle as fLeaderJobId,b.JOBTITLEMARK as fLeaderJob,e.level_name as fLeaderLv,f.grade_name as fLeaderSt
from hrmresource a
left join hrmjobtitles b on a.JOBTITLE=b.ID
left join jcl_org_job c on b.ID = c.ec_jobTitle
left join cus_fielddata d on a.id = d.id and d.scope='HrmCustomFieldByInfoType' and d.scopeid=3