easXtSync.xml 84 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <nodes>
  3. <node ID="updateUserStatus" desc="更新用户信息">update T_PM_EASXTUSERMAP set (FForbidden,FIsDelete,FAgentUser) = (select u.FForbidden,u.FIsDelete,u.FAgentUser from t_pm_user u where T_PM_EASXTUSERMAP.FUserId = u.FId) where exists (select u.fid from t_pm_user u where T_PM_EASXTUSERMAP.FUserId = u.FId)</node>
  4. <node ID="updateUserStatus2" desc="更新用户信息">update t_pm_easxtusermap set FForbidden=0 ,FIsDelete=0,FAgentUser=0 where fuserId is null or fuserId=''</node>
  5. <node ID="updateDeletedUserMap" desc="人员离职更新映射表">update T_PM_EASXTUSERMAP set FStatus = 0 where FStatus=1 and exists(select p.FID from t_bd_person p inner JOIN T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID where T_PM_EASXTUSERMAP.fpersonid= p.fid and empType.FinService !=1 and empType.FinService != 4)</node>
  6. <node ID="updateDeletedPUMap" desc="用户删除或者职员禁用时更新中间表status为0">update T_PM_EASXTUSERMAP set FStatus = 0 where FStatus=1 and (FIsDelete = 1 or exists(select p.FID from t_bd_person p where T_PM_EASXTUSERMAP.fpersonid = p.fid and p.FDeletedStatus = 2))</node>
  7. <node ID="updateDeletedPerson" desc="职员真删除更新中间表status为0">update T_PM_EASXTUSERMAP set FStatus = 0 where not exists(select p.fid from t_bd_person p where p.fid = T_PM_EASXTUSERMAP.fpersonid)</node>
  8. <node ID="updateReNomalUserMap" desc="shr需求不删除离职中间表职员,正常人员需求修改回来">update T_PM_EASXTUSERMAP set FStatus = 1, FIsSynch = 1 where FStatus=0 and FIsDelete = 0 and exists(select p.FID from t_bd_person p inner JOIN T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID where T_PM_EASXTUSERMAP.fpersonid= p.fid and (empType.FinService =1 or empType.FinService = 4) and p.FDeletedStatus = 1)</node>
  9. <node ID="updateReNomalPUMap" desc="shr需求不删除离职中间表用户,正常人员需求修改回来">update T_PM_EASXTUSERMAP set FStatus = 1, FIsSynch = 1 where FStatus=0 and 1=2 and (FIsDelete = 0 and exists(select p.FID from t_bd_person p where T_PM_EASXTUSERMAP.fpersonid = p.fid and p.FDeletedStatus = 1))</node>
  10. <node ID="insertWhenNewUser" desc="新增用户_号码与已同步到map表的关联职员不同_默认为新用户插入T_PM_EASXTUSERMAP表一条数据">insert into T_PM_EASXTUSERMAP(FID,FPersonId,FUserId,FXtId,FPersonName,FCell ,FOrgLongName ,FPosition,FEmail,FUserNumber,FUserName,FForbidden,FIsDelete,FAgentUser,FcreateTime,fpersonnumber) select newbosid('F4AF4F04') FID,p.fid FPersonId,u.fid FUserId,null FXtId,LTRIM(RTRIM(p.FName_l2)) FPersonName, case when(u.FID is null) then RTRIM(p.FCell) else RTRIM(u.FCell) end FCell,case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end FOrgLongName,pos.FName_l2 FPosition,case when(u.FID is null) then RTRIM(p.FEmail) else RTRIM(u.FEmail) end FEmail,u.FNumber FUserNumber,u.FName_l2 FUserName,u.FForbidden FForbidden,case when(u.FID is null) then (case when(p.FDeletedStatus = 1) then 0 else 1 end) else u.FIsDelete end FIsDelete,u.FAgentUser FAgentUser,now() FcreateTime,p.fnumber from t_bd_person p left outer join t_pm_user u on u.fpersonid = p.fid left outer join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left outer join t_org_positionmember opm on opm.FPERSONID = p.FID LEFT OUTER JOIN T_org_position pos on opm.FPOSITIONID = pos.fid left outer join t_org_admin org ON pos.fadminorgunitid = org.fid where opm.FISPRIMARY = 1 and (empType.FinService = 1 or empType.FinService = 4) and ((u.FID is null and p.FDeletedStatus = 1) or (u.FForbidden=0 and u.FIsDelete=0 and p.FDeletedStatus = 1)) and not exists(select FUserId from T_PM_EASXTUSERMAP easxt where easxt.FUserId = u.fid) and exists(select u1.FID from t_pm_user u1 left join T_PM_EASXTUSERMAP easxt on u1.FPersonId = easxt.FPersonId where easxt.FUserId is null and easxt.FCell != u1.FCell and u1.FID = u.FID)</node>
  11. <node ID="updateWhenNewUser" desc="新增用户_号码与已同步到map表的关联职员相同_更新T_PM_EASXTUSERMAP表fuserid">update T_PM_EASXTUSERMAP set FCell =(select u.FCell from t_pm_user u where u.FCell is not null and T_PM_EASXTUSERMAP.FUserId = u.FId and (T_PM_EASXTUSERMAP.FCell is null or T_PM_EASXTUSERMAP.FCell != u.FCell )) where exists (select u.FCell from t_pm_user u where u.FCell is not null and T_PM_EASXTUSERMAP.FUserId = u.FId and (T_PM_EASXTUSERMAP.FCell is null or T_PM_EASXTUSERMAP.FCell != u.FCell ))</node>
  12. <node ID="updateUserCell" desc="用户手机变更">update T_PM_EASXTUSERMAP set FCell =(select u.FCell from t_pm_user u where T_PM_EASXTUSERMAP.FUserId = u.FId and (T_PM_EASXTUSERMAP.FCell != u.FCell or T_PM_EASXTUSERMAP.FCell = '' or T_PM_EASXTUSERMAP.FCell is null)) where exists (select u.FCell from t_pm_user u where T_PM_EASXTUSERMAP.FUserId = u.FId and (T_PM_EASXTUSERMAP.FCell != u.FCell or T_PM_EASXTUSERMAP.FCell = '' or T_PM_EASXTUSERMAP.FCell is null))</node>
  13. <node ID="updateNoUserCell" desc="无用户职员手机变更">update T_PM_EASXTUSERMAP set FCell = (select p.FCell from t_bd_person p where T_PM_EASXTUSERMAP.FPersonId = p.FId and (T_PM_EASXTUSERMAP.FCell != p.FCell or T_PM_EASXTUSERMAP.FCell = '' or T_PM_EASXTUSERMAP.FCell is null)) where exists(select p.FCell from t_bd_person p where T_PM_EASXTUSERMAP.FPersonId = p.FId and (T_PM_EASXTUSERMAP.FCell != p.FCell or T_PM_EASXTUSERMAP.FCell = '' or T_PM_EASXTUSERMAP.FCell is null)) and (T_PM_EASXTUSERMAP.FUserId is null or T_PM_EASXTUSERMAP.FUserId = '')</node>
  14. <node ID="updatePCellWhenUCellNull" desc="关联用户并且用户手机为空,更新职员手机">update T_PM_EASXTUSERMAP set FCell = (select p.FCell from T_BD_Person p left join T_PM_User u on p.FID = u.FPersonId where u.FID = T_PM_EASXTUSERMAP.FUserId and (u.FCell is null or u.FCell = '') and (T_PM_EASXTUSERMAP.FCell != p.FCell or T_PM_EASXTUSERMAP.FCell = '' or T_PM_EASXTUSERMAP.FCell is null)) where exists(select p.FCell from T_BD_Person p left join T_PM_User u on p.FID = u.FPersonId where u.FID = T_PM_EASXTUSERMAP.FUserId and (u.FCell is null or u.FCell = '') and (T_PM_EASXTUSERMAP.FCell != p.FCell or T_PM_EASXTUSERMAP.FCell = '' or T_PM_EASXTUSERMAP.FCell is null))</node>
  15. <node ID="updatePersonWeights_sqlServer" desc="更新用户权重到中间表sqlserver">select t1.sortCode,t1.pid from (select ROW_NUMBER() over(order by org.FSORTCODE asc,org.FLONGNUMBER asc,pos.FINDEX asc, pos.fnumber asc,p.FINDEX asc, p.fnumber asc,pm.FISPRIMARY desc) as sortCode, p.fid pid from t_bd_person p inner join T_ORG_POSITIONMEMBER pm on pm.FPERSONID = p.FID inner join T_ORG_POSITION pos on pos.FID = pm.FPOSITIONID inner join t_org_admin org on org.fid = pos.FADMINORGUNITID where pm.FISPRIMARY = 1) t1 where exists( select 1 from T_PM_EASXTUSERMAP umap where umap.FPersonId = t1.pid and (umap.fweights is null or umap.fweights = '' or (umap.fweights is not null and umap.fweights != t1.sortCode)))</node>
  16. <node ID="updatePersonWeights_Oracle" desc="更新用户权重到中间表Orecle">select t1.sortCode, t1.pid from (select ROWNUM as sortCode ,p.fid pid from t_bd_person p inner join T_ORG_POSITIONMEMBER pm on pm.FPERSONID = p.FID inner join T_ORG_POSITION pos on pos.FID = pm.FPOSITIONID inner join t_org_admin org on org.fid = pos.FADMINORGUNITID where pm.FISPRIMARY = 1 order by org.FSORTCODE asc,org.flongnumber asc,pos.findex asc, pos.fnumber asc,p.FINDEX asc, p.fnumber asc,pm.FISPRIMARY desc) t1 where exists( select 1 from T_PM_EASXTUSERMAP umap where umap.FPersonId = t1.pid and (umap.fweights is null or umap.fweights = '' or (umap.fweights is not null and umap.fweights != t1.sortCode)))</node>
  17. <node ID="updatePersonWeights_DB2" desc="更新用户权重到中间表DB2">select t1.sortCode,t1.pid from (select rownumber() over(order by org.FSORTCODE asc,org.flongnumber asc,pos.findex asc, pos.fnumber asc,p.FINDEX asc, p.fnumber asc,pm.FISPRIMARY desc) as sortCode ,p.fid pid from t_bd_person p inner join T_ORG_POSITIONMEMBER pm on pm.FPERSONID = p.FID inner join T_ORG_POSITION pos on pos.FID = pm.FPOSITIONID inner join t_org_admin org on org.fid = pos.FADMINORGUNITID where pm.FISPRIMARY = 1) t1 where exists( select 1 from T_PM_EASXTUSERMAP umap where umap.FPersonId = t1.pid and (umap.fweights is null or umap.fweights = '' or (umap.fweights is not null and umap.fweights != t1.sortCode)))</node>
  18. <node ID="updateNoUserEmail" desc="更未关联职员用户邮箱">update T_PM_EASXTUSERMAP set FEmail = (select p.FEmail from t_bd_person p where p.FEmail is not null and T_PM_EASXTUSERMAP.FPersonId = p.FID and (T_PM_EASXTUSERMAP.FEmail is null or T_PM_EASXTUSERMAP.FEmail = '' or (T_PM_EASXTUSERMAP.FEmail != p.FEmail and T_PM_EASXTUSERMAP.FEmail is not null )) and T_PM_EASXTUSERMAP.FUserId is null) where exists (select p.FEmail from t_bd_person p where p.FEmail is not null and T_PM_EASXTUSERMAP.FPersonId = p.FID and (T_PM_EASXTUSERMAP.FEmail is null or T_PM_EASXTUSERMAP.FEmail = '' or (T_PM_EASXTUSERMAP.FEmail != p.FEmail and T_PM_EASXTUSERMAP.FEmail is not null )) and T_PM_EASXTUSERMAP.FUserId is null)</node>
  19. <node ID="updateUserEmail" desc="更用户邮箱">update T_PM_EASXTUSERMAP set FEmail = (select u.FEmail from t_pm_user u where u.FEmail is not null and T_PM_EASXTUSERMAP.FUserId = u.FID and (T_PM_EASXTUSERMAP.FEmail is null or T_PM_EASXTUSERMAP.FEmail = '' or (T_PM_EASXTUSERMAP.FEmail != u.FEmail and T_PM_EASXTUSERMAP.FEmail is not null ))) where exists (select u.FEmail from t_pm_user u where u.FEmail is not null and T_PM_EASXTUSERMAP.FUserId = u.FID and (T_PM_EASXTUSERMAP.FEmail is null or T_PM_EASXTUSERMAP.FEmail = '' or (T_PM_EASXTUSERMAP.FEmail != u.FEmail and T_PM_EASXTUSERMAP.FEmail is not null )))</node>
  20. <node ID="updatePEmailWhenUEmailNull" desc="更用户邮箱为空的时候用户邮箱为空的时候">update T_PM_EASXTUSERMAP set FEmail = (select p.FEmail from T_BD_Person p left join T_PM_User u on p.FID = u.FPersonId where u.FID = T_PM_EASXTUSERMAP.FUserId and (u.FEmail is null or u.FEmail = '') and (T_PM_EASXTUSERMAP.FEmail != p.FEmail or T_PM_EASXTUSERMAP.FEmail = '' or T_PM_EASXTUSERMAP.FEmail is null)) where exists(select p.FEmail from T_BD_Person p left join T_PM_User u on p.FID = u.FPersonId where u.FID = T_PM_EASXTUSERMAP.FUserId and (u.FEmail is null or u.FEmail = '') and (T_PM_EASXTUSERMAP.FEmail != p.FEmail or T_PM_EASXTUSERMAP.FEmail = '' or T_PM_EASXTUSERMAP.FEmail is null))</node>
  21. <node ID="updateUserPosition" desc="更新用户职位">update T_PM_EASXTUSERMAP set FPosition = (select pos.FName_l2 from t_bd_person p inner JOIN t_org_positionmember opm on opm.FPERSONID = p.FID LEFT OUTER JOIN T_org_position pos on opm.FPOSITIONID = pos.fid where opm.FISPRIMARY = 1 and pos.FName_l2 is not null and T_PM_EASXTUSERMAP.FPersonId = p.FId and (T_PM_EASXTUSERMAP.FPosition is null or T_PM_EASXTUSERMAP.FPosition != pos.FName_l2)) where exists (select pos.FName_l2 from t_bd_person p inner JOIN t_org_positionmember opm on opm.FPERSONID = p.FID LEFT OUTER JOIN T_org_position pos on opm.FPOSITIONID = pos.fid where opm.FISPRIMARY = 1 and pos.FName_l2 is not null and T_PM_EASXTUSERMAP.FPersonId = p.FId and (T_PM_EASXTUSERMAP.FPosition is null or T_PM_EASXTUSERMAP.FPosition != pos.FName_l2))</node>
  22. <node ID="updateUserOrg" desc="更新用户组织">update T_PM_EASXTUSERMAP set FOrgLongName = (select case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end from t_bd_person p inner JOIN t_org_positionmember opm on opm.FPERSONID = p.FID LEFT OUTER JOIN T_org_position pos on opm.FPOSITIONID = pos.fid inner JOIN t_org_admin org ON pos.Fadminorgunitid = org.fid where opm.FISPRIMARY = 1 and org.fdisplayname_l2 is not null and T_PM_EASXTUSERMAP.FPersonId = p.FId and (T_PM_EASXTUSERMAP.FOrgLongName is null or T_PM_EASXTUSERMAP.FOrgLongName != (case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end))) where exists (select p.fid from t_bd_person p inner JOIN t_org_positionmember opm on opm.FPERSONID = p.FID LEFT OUTER JOIN T_org_position pos on opm.FPOSITIONID = pos.fid inner JOIN t_org_admin org ON pos.Fadminorgunitid = org.fid where opm.FISPRIMARY = 1 and org.fdisplayname_l2 is not null and T_PM_EASXTUSERMAP.FPersonId = p.FId and (T_PM_EASXTUSERMAP.FOrgLongName is null or T_PM_EASXTUSERMAP.FOrgLongName != (case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end)))</node>
  23. <node ID="updateNoUserName" desc="更新未关联职员姓名">update T_PM_EASXTUSERMAP set FPersonName =(select p.FName_l2 from t_bd_person p where T_PM_EASXTUSERMAP.FPersonId = p.FId and T_PM_EASXTUSERMAP.FPersonName != p.FName_l2 and T_PM_EASXTUSERMAP.FUserId is null) where exists (select p.FName_l2 from t_bd_person p where p.FName_l2 is not null and T_PM_EASXTUSERMAP.FPersonId = p.FId and T_PM_EASXTUSERMAP.FPersonName != p.FName_l2 and T_PM_EASXTUSERMAP.FUserId is null)</node>
  24. <node ID="updateUserName" desc="更新用户姓名">update T_PM_EASXTUSERMAP set (FUserName,FPersonName) =(select u.FName_l2,u.FName_l2 from t_pm_user u where T_PM_EASXTUSERMAP.FUserId = u.FId and (T_PM_EASXTUSERMAP.FUserName != u.FName_l2 or T_PM_EASXTUSERMAP.FUserName is null)) where exists (select u.FName_l2 from t_pm_user u where u.FName_l2 is not null and T_PM_EASXTUSERMAP.FUserId = u.FId and (T_PM_EASXTUSERMAP.FUserName != u.FName_l2 or T_PM_EASXTUSERMAP.FUserName is null))</node>
  25. <node ID="updatePersonNumber" desc="更新员工编号">update T_PM_EASXTUSERMAP set FPersonNumber =(select p.FNumber from t_bd_person p where p.FNumber is not null and T_PM_EASXTUSERMAP.FPersonId = p.FId and (T_PM_EASXTUSERMAP.FPersonNumber != p.FNumber or T_PM_EASXTUSERMAP.FPersonNumber is null or T_PM_EASXTUSERMAP.FPersonNumber = '')) where exists (select 1 from t_bd_person p where p.FNumber is not null and T_PM_EASXTUSERMAP.FPersonId = p.FId and (T_PM_EASXTUSERMAP.FPersonNumber != p.FNumber or T_PM_EASXTUSERMAP.FPersonNumber is null or T_PM_EASXTUSERMAP.FPersonNumber = ''))</node>
  26. <node ID="updateUserPersonNumber" desc="更新关联用户的员工编号">update T_PM_EASXTUSERMAP set FPersonNumber =(select p.FNumber from t_bd_person p inner join t_pm_user u on u.FPERSONID = p.fid where p.FNumber is not null and T_PM_EASXTUSERMAP.Fuserid = u.FId and (T_PM_EASXTUSERMAP.FPersonNumber != p.FNumber or T_PM_EASXTUSERMAP.FPersonNumber is null or T_PM_EASXTUSERMAP.FPersonNumber = '')) where exists (select 1 from t_bd_person p inner join t_pm_user u on u.FPERSONID = p.fid where p.FNumber is not null and T_PM_EASXTUSERMAP.Fuserid = u.FId and (T_PM_EASXTUSERMAP.FPersonNumber != p.FNumber or T_PM_EASXTUSERMAP.FPersonNumber is null or T_PM_EASXTUSERMAP.FPersonNumber = ''))</node>
  27. <node ID="insertNewPersonToMap" desc="新增职员同步到map表">insert into T_PM_EASXTUSERMAP(FID,FPersonId,FUserId,FXtId,FPersonName,FCell ,FOrgLongName ,FPosition,FEmail,FUserNumber,FUserName,FForbidden,FIsDelete,FAgentUser,FcreateTime,fpersonnumber) select newbosid('F4AF4F04') FID,p.fid FPersonId,u.fid FUserId,null FXtId,LTRIM(RTRIM(p.FName_l2)) FPersonName, case when(u.FID is null) then RTRIM(p.FCell) else RTRIM(u.FCell) end FCell,case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end FOrgLongName,pos.FName_l2 FPosition,case when(u.FID is null) then RTRIM(p.FEmail) else RTRIM(u.FEmail) end FEmail,u.FNumber FUserNumber,u.FName_l2 FUserName,u.FForbidden,case when(u.FID is null) then (case when(p.FDeletedStatus = 1) then 0 else 1 end) else u.FIsDelete end FIsDelete,u.FAgentUser,now() createtime,p.fnumber from t_bd_person p left outer join t_pm_user u on u.fpersonid = p.fid left outer join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left outer join t_org_positionmember opm on opm.FPERSONID = p.FID LEFT OUTER JOIN T_org_position pos on opm.FPOSITIONID = pos.fid left outer join t_org_admin org ON pos.fadminorgunitid = org.fid where opm.FISPRIMARY = 1 and (empType.FinService = 1 or empType.FinService = 4) and ((u.FID is null and p.FDeletedStatus = 1) or (u.FForbidden=0 and u.FIsDelete=0 and u.FAgentUser=0 and p.FDeletedStatus = 1)) and not exists(select FPersonId from T_PM_EASXTUSERMAP easxt where (case when(easxt.fuserid is not null) then easxt.fuserid else easxt.fpersonid end) = (case when(u.fid is not null) then u.fid else p.fid end))</node>
  28. <node ID="updatePersonRealDelete" desc="更新职员真删除状态">delete FROM T_PM_EASXTUSERMAP where not exists (select eas.fid from T_BD_Person eas left join T_HR_BDEmployeeType empType on eas.FEMPLOYEETYPEID = empType.FID where eas.FID = T_PM_EASXTUSERMAP.FPersonId and (empType.FinService =1 or empType.FinService = 4) and eas.FDeletedStatus = 1)</node>
  29. <node ID="updateUserRealDelete" desc="更新用户删除状态">delete FROM T_PM_EASXTUSERMAP where T_PM_EASXTUSERMAP.FUserId is not null and not exists(SELECT u.fid FROM t_pm_user u where u.FID = T_PM_EASXTUSERMAP.FUserId and u.FISDELETE = 0)</node>
  30. <node ID="updateOrgRealDelete" desc="更新组织真删除状态">delete from T_PM_EASXTORGMAP where not exists (select eas.fid from T_ORG_Admin eas where eas.FID = T_PM_EASXTORGMAP.FEasOrgId and eas.fisSealup = 0)</node>
  31. <node ID="updateOrgWeights_DB2" desc="更新组织权重到中间表DB2">update t_pm_easxtorgmap set fweights = (select org.sortCode from(select rownumber() over(order by fsortcode) as sortCode, fid from t_org_admin) org where T_PM_EASXTORGMAP.feasorgid = org.FID and (T_PM_EASXTORGMAP.fweights is null or T_PM_EASXTORGMAP.fweights = '' or (T_PM_EASXTORGMAP.fweights is not null and T_PM_EASXTORGMAP.fweights != org.SORTCODE))) where exists(select 1 from(select rownumber() over(order by fsortcode) as sortCode, fid from t_org_admin) org where T_PM_EASXTORGMAP.feasorgid = org.FID and (T_PM_EASXTORGMAP.fweights is null or T_PM_EASXTORGMAP.fweights = '' or (T_PM_EASXTORGMAP.fweights is not null and T_PM_EASXTORGMAP.fweights != org.SORTCODE))) </node>
  32. <node ID="updateOrgWeights_sqlServer" desc="更新组织权重到中间表SQL Server">update t_pm_easxtorgmap set fweights = (select org.sortCode from(select ROW_NUMBER() over(order by fsortcode) as sortCode, fid from t_org_admin) org where T_PM_EASXTORGMAP.feasorgid = org.FID and (T_PM_EASXTORGMAP.fweights is null or T_PM_EASXTORGMAP.fweights = '' or (T_PM_EASXTORGMAP.fweights is not null and T_PM_EASXTORGMAP.fweights != org.SORTCODE))) where exists(select 1 from(select ROW_NUMBER() over(order by fsortcode) as sortCode, fid from t_org_admin) org where T_PM_EASXTORGMAP.feasorgid = org.FID and (T_PM_EASXTORGMAP.fweights is null or T_PM_EASXTORGMAP.fweights = '' or (T_PM_EASXTORGMAP.fweights is not null and T_PM_EASXTORGMAP.fweights != org.SORTCODE))) </node>
  33. <node ID="updateOrgWeights_Oracle" desc="更新组织权重到中间表Oracle">update t_pm_easxtorgmap set fweights = (select org1.sortCode from (select ROWNUM as sortCode,org.fid from(select ROWNUM, fid from t_org_admin order by FSORTCODE) org) org1 where T_PM_EASXTORGMAP.feasorgid = org1.FID and (T_PM_EASXTORGMAP.fweights is null or T_PM_EASXTORGMAP.fweights = '' or (T_PM_EASXTORGMAP.fweights is not null and T_PM_EASXTORGMAP.fweights != org1.sortCode))) where exists(select org1.sortCode from (select ROWNUM as sortCode,org.fid from(select ROWNUM, fid from t_org_admin order by FSORTCODE) org) org1 where T_PM_EASXTORGMAP.feasorgid = org1.FID and (T_PM_EASXTORGMAP.fweights is null or T_PM_EASXTORGMAP.fweights = '' or (T_PM_EASXTORGMAP.fweights is not null and T_PM_EASXTORGMAP.fweights != org1.sortCode))) </node>
  34. <node ID="updateOrgEasParentId" desc="更新orgmap组织eas的上级id,用于组织挪动">update T_PM_EASXTORGMAP omap set (FEasParentId) = (select easorg.fparentid FEasParentId from t_org_admin easorg where easorg.fid = omap.feasorgid and (easorg.fparentid != omap.feasparentid or omap.feasparentid is null)) where exists(select 1 from t_org_admin easorg where easorg.fid = omap.feasorgid and (easorg.fparentid != omap.feasparentid or omap.feasparentid is null))</node>
  35. <node ID="updateOrgXtParentId" desc="更新orgmap组织云之家的上级id,用于组织挪动">update t_pm_easxtorgmap set fxtparentid = (select omapp.fxtorgid from t_pm_easxtorgmap omap inner join t_pm_easxtorgmap omapp on omap.feasparentid = omapp.feasorgid where t_pm_easxtorgmap.feasorgid = omap.feasorgid and (t_pm_easxtorgmap.fxtparentid != omapp.fxtorgid or t_pm_easxtorgmap.fxtparentid is null)) where exists(select 1 from t_pm_easxtorgmap omap inner join t_pm_easxtorgmap omapp on omap.feasparentid = omapp.feasorgid where t_pm_easxtorgmap.feasorgid = omap.feasorgid and (t_pm_easxtorgmap.fxtparentid != omapp.fxtorgid or t_pm_easxtorgmap.fxtparentid is null))</node>
  36. <node ID="updateOrgStatus" desc="更新orgmap组织封存状态">update T_PM_EASXTORGMAP set FEasStatus = (select org.FIsSealUp from T_ORG_ADMIN org where T_PM_EASXTORGMAP.FEasOrgId = org.FId and org.FIsSealUp=1 and org.FIsSealUp != T_PM_EASXTORGMAP.FEasStatus) where exists (select org.FID from T_ORG_ADMIN org where T_PM_EASXTORGMAP.FEasOrgId = org.FId and org.FIsSealUp=1 and org.FIsSealUp != T_PM_EASXTORGMAP.FEasStatus)</node>
  37. <node ID="updateOrgLongName" desc="更新orgmap组织长名称">update T_PM_EASXTORGMAP set FOrgLongName =(select case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end FOrgLongName from T_ORG_ADMIN org where T_PM_EASXTORGMAP.FEasOrgId = org.FId and T_PM_EASXTORGMAP.FOrgLongName != case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end) where exists (select org.FID from T_ORG_ADMIN org where T_PM_EASXTORGMAP.FEasOrgId = org.FId and T_PM_EASXTORGMAP.FOrgLongName != case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end)</node>
  38. <node ID="updateOrgName" desc="更新orgmap组织短名称">update T_PM_EASXTORGMAP set FName =(select FName_L2 from T_ORG_ADMIN org where T_PM_EASXTORGMAP.FEasOrgId = org.FId and T_PM_EASXTORGMAP.FName != org.FName_l2) where exists (select org.FID from T_ORG_ADMIN org where T_PM_EASXTORGMAP.FEasOrgId = org.FId and T_PM_EASXTORGMAP.FName != org.FName_l2)</node>
  39. <node ID="insertNewOrgToMap" desc="新增组织同步到orgmap表">INSERT INTO T_PM_EASXTORGMAP(FID, FEasOrgId, FEasParentId, FName, FOrgLongName, FEasStatus) select newbosid('F4AF4F04') FID, org.FID FEasOrgId, org.FParentID FEasParentId, org.FName_L2 FName, case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end FOrgLongName, org.FIsSealUp FEasStatus from T_ORG_Admin org where FIsFreeze = 0 and org.FIsSealUp=0 and not exists(select FEasOrgId from T_PM_EASXTORGMAP orgmap where orgmap.FEasOrgId = org.FID)</node>
  40. <node ID="fillUserId">update t_pm_easxtusermap set FuserId=(select top 1 u.fid from t_pm_user u where t_pm_easxtusermap.fpersonId = u.fpersonId and u.FForbidden=0 and u.FIsDelete=0) where fuserId is null </node>
  41. <node ID="cantSyncWithNoInservice">update t_pm_easxtusermap set fissynch=0,fdescription='离职' where fstatus=0 and (fxtId is null or fxtID='')</node>
  42. <node ID="canSyncWithCellNotNull" desc="电话号码非空可同步">update t_pm_easxtusermap set FISSynch = 1,FDescription=null where FISSynch = 0 and FCell is not null</node>
  43. <node ID="canSyncWithCellNotRepeat" desc="电话号码不重复可同步">update t_pm_easxtusermap set FISSynch = 1,FDescription=null where FISSynch =0 and not exists (select FID from t_pm_easxtusermap easxt2 where t_pm_easxtusermap.FPersonID != easxt2.FPersonID and t_pm_easxtusermap.FCell = easxt2.FCell and t_pm_easxtusermap.FCell is not null and easxt2.FCell is not null)</node>
  44. <node ID="cantSyncWithCellNull" desc="电话号码为空和邮箱均为空不可同步">update t_pm_easxtusermap set FISSynch = 0,FDescription='手机为空,请填写手机号再进行检查绑定' where FISSynch =1 and (FCell is null or FCell = '') and (FEmail = '' or FEmail is null)</node>
  45. <node ID="cantSyncWithCellRepeat" desc="职员类电话号码重复不可同步">update t_pm_easxtusermap set FISSynch = 0,FDescription='EAS多个职员手机号相同,不能同步' where FISSynch =1 and exists (select FID from t_pm_easxtusermap easxt2 where t_pm_easxtusermap.FPersonID != easxt2.FPersonID and t_pm_easxtusermap.FCell = easxt2.FCell and t_pm_easxtusermap.FCell is not null and easxt2.FCell is not null)</node>
  46. <node ID="cantSyncWithCellError" desc="用户或职员手机号码格式不对">update t_pm_easxtusermap set FISSynch = 0,FDescription='EAS用户或职员手机号码格式不对' where FISSynch =1 and len(fcell) > 13</node>
  47. <node ID="cantSyncWithCellRepeat4User" desc="用户类电话号码重复不可同步">update t_pm_easxtusermap set FISSynch = 0,FDescription='EAS多个用户手机号相同,不能同步' where FISSynch =1 and exists (select FID from t_pm_easxtusermap easxt2 where t_pm_easxtusermap.FuserId != easxt2.FuserId and t_pm_easxtusermap.FCell = easxt2.FCell and t_pm_easxtusermap.FCell is not null and easxt2.FCell is not null)</node>
  48. <node ID="cantSyncWithEmailRepeat" desc="职员类邮箱码重复不可同步">update t_pm_easxtusermap set FISSynch = 0,FDescription='EAS多个职员邮箱相同,不能同步' where FISSynch =1 and (FUserId = '' or FUserId is null) and exists (select FID from t_pm_easxtusermap easxt2 where t_pm_easxtusermap.FPersonID != easxt2.FPersonID and t_pm_easxtusermap.FEmail = easxt2.FEmail and t_pm_easxtusermap.FEmail is not null and easxt2.FEmail is not null)</node>
  49. <node ID="cantSyncWithEmailRepeat4User" desc="用户类邮箱重复不可同步">update t_pm_easxtusermap set FISSynch = 0,FDescription='EAS多个用户邮箱相同,不能同步' where FISSynch =1 and exists (select FID from t_pm_easxtusermap easxt2 where t_pm_easxtusermap.FuserId != easxt2.FuserId and t_pm_easxtusermap.FEmail = easxt2.FEmail and t_pm_easxtusermap.FEmail is not null and easxt2.FEmail is not null)</node>
  50. <node ID="cantSyncSameCellButDiffName" desc="云之家已有其他人使用该手机号码不能同步">update t_pm_easxtusermap set fdescription = '云之家已有其他人使用该手机号码,不能同步',fissynch=0 where exists(select 1 from t_xt_user xt where xt.fpersonname != t_pm_easxtusermap.fpersonname and xt.fcell = t_pm_easxtusermap.fcell and FStatus = 1) and (fxtid is null or fxtid = '')</node>
  51. <node ID="insertIntoXtTable" desc="获取讯通职员信息">insert into t_xt_user(FID,FPersonName,FCell,FOrgLongName,FPosition,FEmail,FStatus,FPhotoUrl,FPhones,FIsHidePhone,FGender,fweights,fpersonnumber) values(?,?,?,?,?,?,?,?,?,?,?,?,?)</node>
  52. <node ID="insertIntoCellUpdateRecordsTable" desc="获取讯通手机变更记录">insert into T_XT_CellUpdateRecords(FID,FCreateTime,fnewPhone,foldPhone,feid,fxtId) values(?,?,?,?,?,?)</node>
  53. <node ID="insertIntoXtOrgTable" desc="获取讯通组织信息">insert into t_xt_org(FID,FOrgLongName,FName,FParentId,fweights) values(?,?,?,?,?)</node>
  54. <node ID="insertIntoXtOrgLeaderTable" desc="获取讯通组织负责人信息">insert into T_XT_ORGLEADER(FID,FOrgLongName,FXtId,fxtorgid) values(?,?,?,?)</node>
  55. <node ID="insertIntoXtPartTable" desc="获取讯通兼职信息">insert into T_XT_PART(FID,FOrgId,FXtId,FJobTitle) values(?,?,?,?)</node>
  56. <node ID="insertIntoXtRelationsTable" desc="获取讯通上级信息">insert into T_XT_PERSONRELATIONS(FID,FLeaderXtId,FXtId,FRelationType) values(?,?,?,?)</node>
  57. <node ID="getOrgLeaderFromUserMap" desc="从职员关联表获取部门负责人xtid到临时表T_XT_ORGLEADERTMP">insert into T_XT_ORGLEADERTMP(forgid, fxtid, FPositionStatus) select distinct org.fid forgid, umap.fxtid fxtid, pos.FDeletedStatus FPositionStatus from T_ORG_Admin org inner join T_ORG_Position pos on pos.FID = org.FResponPositionID inner join t_org_positionmember opm on opm.FPOSITIONID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID inner join T_PM_EASXTUSERMAP umap on p.fid = umap.fpersonid where opm.FISPRIMARY = 1 and pos.FISRESPPOSITION = 1 and org.FResponPositionID is not null and umap.fxtid is not null and not exists(select FOrgId from T_XT_ORGLEADERTMP omtmp where omtmp.FOrgId = org.FID)</node>
  58. <node ID="deleteOrgLeaderTmp" desc="清除部门负责人临时表">delete from T_XT_ORGLEADERTMP</node>
  59. <node ID="deleteUserMap" desc="清除同步用户中间表">delete from t_pm_easxtusermap</node>
  60. <node ID="deleteOrgMap" desc="清除同步组织中间表">delete from t_pm_easxtorgmap</node>
  61. <node ID="deletePartMap" desc="清除兼职中间表">delete from T_PM_EASXTPARTMAP</node>
  62. <node ID="deleteXtCheckTime" desc="清除拉取云之家用户事件记录表">delete from t_xt_checktime</node>
  63. <node ID="deleteXtOrg" desc="清除云之家表组织表">delete from t_xt_org</node>
  64. <node ID="deleteXtUser" desc="清除云之家表用户表">delete from t_xt_user</node>
  65. <node ID="deleteXtOrgLeader" desc="清除云之家表部门负责人">delete from T_XT_ORGLEADER</node>
  66. <node ID="deleteXtPart" desc="清除云之家表兼职">delete from T_XT_PART</node>
  67. <node ID="deleteXtRelations" desc="清除云之家表上级表">delete from T_XT_PERSONRELATIONS</node>
  68. <node ID="insertMiddleOrgLeader" desc="往负责人中间表插入数据">insert into T_PM_EASXTORGLEADER(fid, FOrgLongName, fxtid, fxtorgid) select newbosid('F4AF4F04') fid, case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end FOrgLongName, umap.fxtid fxtid, omap.fxtorgid fxtorgid from T_ORG_Admin org inner join T_ORG_Position pos on pos.FID = org.FResponPositionID inner join t_org_positionmember opm on opm.FPOSITIONID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID inner join T_PM_EASXTUSERMAP umap on p.fid = umap.fpersonid inner join t_pm_easxtorgmap omap on omap.feasorgid = org.fid where pos.FISRESPPOSITION = 1 and org.FResponPositionID is not null and umap.fxtid is not null and umap.FStatus = 1 and pos.FDELETEDSTATUS = 1 and org.fisSealup != 1 and not exists(select lold.fid from T_PM_EASXTORGLEADER lold where lold.fxtid = umap.fxtid and lold.fxtorgid = omap.fxtorgid)</node>
  69. <node ID="selectAddMiddleOrgLeader" desc="查询需要新增的部门负责人">select distinct eas.fxtid xtid, eas.FOrgLongName orgLongName, umap.fpersonname personName,umap.fcell cell,umap.fweights weights,fxtorgid orgId FROM T_PM_EASXTORGLEADER eas inner join t_pm_easxtusermap umap on umap.fxtid = eas.fxtid where umap.fissynch = 1 and umap.fstatus = 1 and not exists(SELECT * FROM t_xt_orgleader xt where xt.fxtid=eas.fxtid and xt.fxtorgid=eas.fxtorgid) and not exists(select 1 from T_XT_NoSyncPerson nsp where nsp.fpersonid = umap.fpersonid) and exists(select 1 from T_ORG_Admin org inner join T_ORG_Position pos on pos.FID = org.FResponPositionID inner join t_org_positionmember opm on opm.FPOSITIONID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID inner join T_PM_EASXTUSERMAP umap on p.fid = umap.fpersonid inner join t_pm_easxtorgmap omap on omap.feasorgid = org.fid where pos.FISRESPPOSITION = 1 and org.FResponPositionID is not null and umap.fxtid is not null and pos.FDELETEDSTATUS = 1 and org.fisSealup != 1 and umap.FStatus = 1 and eas.fxtid = umap.fxtid and eas.fxtorgid = omap.fxtorgid) and eas.fxtorgid is not null</node>
  70. <node ID="selectDeleteMiddleOrgLeader" desc="查询需要删除的部门负责人">select distinct leader.fxtid xtid, leader.FOrgLongName orgLongName, umap.fpersonname personName,umap.fcell cell,umap.fweights weights, leader.fxtorgid orgId FROM T_PM_EASXTORGLEADER leader inner join t_pm_easxtusermap umap on umap.fxtid = leader.fxtid where umap.fxtid is not null and not exists(select 1 from T_ORG_Admin org inner join T_ORG_Position pos on pos.FID = org.FResponPositionID inner join t_org_positionmember opm on opm.FPOSITIONID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID inner join T_PM_EASXTUSERMAP umap on p.fid = umap.fpersonid inner join t_pm_easxtorgmap omap on omap.feasorgid = org.fid where pos.FISRESPPOSITION = 1 and org.FResponPositionID is not null and umap.fxtid is not null and pos.FDELETEDSTATUS = 1 and org.fisSealup != 1 and umap.FStatus = 1 and leader.fxtid = umap.fxtid and leader.fxtorgid = omap.fxtorgid) and exists(select 1 from T_XT_ORGLEADER xtol where xtol.fxtid = leader.fxtid and xtol.fxtorgid = leader.fxtorgid) and leader.fxtorgid is not null</node>
  71. <node ID="deleteDeletedMiddleOrgLeader" desc="删除已经删除的部门负责人从中表">delete from T_PM_EASXTORGLEADER where not exists(select 1 from T_ORG_Admin org inner join T_ORG_Position pos on pos.FID = org.FResponPositionID inner join t_org_positionmember opm on opm.FPOSITIONID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID inner join T_PM_EASXTUSERMAP umap on p.fid = umap.fpersonid inner join t_pm_easxtorgmap omap on omap.feasorgid = org.fid where pos.FISRESPPOSITION = 1 and org.FResponPositionID is not null and umap.fxtid is not null and pos.FDELETEDSTATUS = 1 and org.fisSealup != 1 and umap.FStatus = 1 and T_PM_EASXTORGLEADER.fxtid = umap.fxtid and T_PM_EASXTORGLEADER.fxtorgid = omap.fxtorgid) and not exists(select 1 from T_XT_ORGLEADER xtol where xtol.fxtid = T_PM_EASXTORGLEADER.fxtid and xtol.fxtorgid = T_PM_EASXTORGLEADER.fxtorgid)</node>
  72. <node ID="updateIntoXtOrgTable4Leader" desc="从中间表T_XT_ORGLEADERTMP更新组织关联表部门负责人信息">update T_PM_EASXTORGMAP set (fxtid,FPositionStatus) = (select omtmp.fxtid,omtmp.FPositionStatus from T_XT_ORGLEADERTMP omtmp where omtmp.forgid = T_PM_EASXTORGMAP.feasorgid and omtmp.fxtid is not null and omtmp.fxtid != T_PM_EASXTORGMAP.fxtid) where exists (select fxtid from T_XT_ORGLEADERTMP omtmp where omtmp.forgid = T_PM_EASXTORGMAP.feasorgid and omtmp.fxtid is not null and omtmp.fxtid != T_PM_EASXTORGMAP.fxtid)</node>
  73. <node ID="bindOrgLeaderByOrgLongName" desc="按照组织长名称绑定从xt拉取的部门负责人">update T_PM_EASXTORGMAP set fxtid = (select leader.fxtid from T_XT_ORGLEADER leader where leader.FOrgLongName = T_PM_EASXTORGMAP.FOrgLongName and leader.fxtid is not null and leader.FOrgLongName is not null) where exists (select leader.fxtid from T_XT_ORGLEADER leader where leader.FOrgLongName = T_PM_EASXTORGMAP.FOrgLongName and leader.fxtid is not null and leader.FOrgLongName is not null)</node>
  74. <node ID="selectBatchSetOrgLeader" desc="查询需要设置同步云之家的部门负责人">select omap.fxtid xtid, omap.FOrgLongName orgLongName from T_PM_EASXTORGMAP omap where omap.feasstatus = 0 and omap.fpositionstatus = 1 and omap.fxtid is not null and omap.FOrgLongName is not null and not exists (select leader.fid from T_XT_ORGLEADER leader where leader.FOrgLongName =omap.FOrgLongName)</node>
  75. <node ID="selectBatchDeleteOrgLeader" desc="查询需要删除同步云之家的部门负责人">select omap.fxtid xtid, omap.FOrgLongName orgLongName from T_PM_EASXTORGMAP omap where omap.FXtId is not null and not exists(select umap.fxtid from T_ORG_Admin org inner join T_ORG_Position pos on pos.FID = org.FResponPositionID inner join t_org_positionmember opm on opm.FPositionID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID inner join T_PM_EASXTUSERMAP umap on p.FID = umap.FPersonId where opm.FISPRIMARY = 1 and org.FResponPositionID is not null and pos.FISRESPPOSITION = 1 and umap.FXtId is not null and omap.FXtId = umap.FXtId)</node>
  76. <node ID="updateIntoXtOrgTable" desc="更新组织关联表">update T_PM_EASXTORGMAP set (FXtOrgId,FXtParentId) = (select xtorg.FID, xtorg.FParentId from T_XT_ORG xtorg where xtorg.FOrgLongName = T_PM_EASXTORGMAP.FOrgLongName) where exists (select xtorg.FID from T_XT_ORG xtorg where xtorg.FOrgLongName = T_PM_EASXTORGMAP.FOrgLongName)</node>
  77. <node ID="updateXtTable" desc="更新t_xt_user的信息">update t_xt_user set FPersonName = ?,FCell = ?,FOrgLongName = ?,FPosition = ?,FEmail = ?,FStatus = ? where fid = ?</node>
  78. <node ID="bindByNameAndCell" desc="按名称手机绑定,惠君确定,改为直接按手机绑定">update t_pm_easxtusermap set fxtid = (select xt.fid from t_xt_user xt where xt.fcell is not null and (t_pm_easxtusermap.fxtid = '' or t_pm_easxtusermap.fxtid is null or (t_pm_easxtusermap.fxtid != xt.fid and t_pm_easxtusermap.fxtid is not null)) and xt.fcell=t_pm_easxtusermap.fcell and xt.fpersonname=t_pm_easxtusermap.fpersonname and xt.fcell not in (select fcell FROM t_xt_user group by fcell having count(fcell) &gt;= 2 and fcell is not null)) where exists(select xt.fid from t_xt_user xt where xt.fcell is not null and (t_pm_easxtusermap.fxtid = '' or t_pm_easxtusermap.fxtid is null or (t_pm_easxtusermap.fxtid != xt.fid and t_pm_easxtusermap.fxtid is not null)) and xt.fcell=t_pm_easxtusermap.fcell and xt.fpersonname=t_pm_easxtusermap.fpersonname and t_pm_easxtusermap.fstatus = 1 and t_pm_easxtusermap.FIsSynch = 1 and xt.fcell not in (select fcell FROM t_xt_user group by fcell having count(fcell) &gt;= 2 and fcell is not null))</node>
  79. <node ID="bindByNameAndMail" desc="按名称邮箱绑定">update t_pm_easxtusermap set fxtid = (select xt.fid from t_xt_user xt where xt.femail=t_pm_easxtusermap.femail and xt.fpersonname=t_pm_easxtusermap.fpersonname and (xt.fcell = '' or xt.fcell is null) and xt.FEmail is not null and (t_pm_easxtusermap.fxtid = '' or t_pm_easxtusermap.fxtid is null or (t_pm_easxtusermap.fxtid != xt.fid and t_pm_easxtusermap.fxtid is not null))and xt.femail not in (select FEmail FROM t_xt_user group by FEmail having count(FEmail) &gt;= 2 and FEmail is not null) and t_pm_easxtusermap.fcell is null) where exists(select xt.fid from t_xt_user xt where xt.femail=t_pm_easxtusermap.femail and xt.fpersonname=t_pm_easxtusermap.fpersonname and t_pm_easxtusermap.fstatus = 1 and t_pm_easxtusermap.FIsSynch = 1 and (xt.fcell = '' or xt.fcell is null) and xt.FEmail is not null and (t_pm_easxtusermap.fxtid = '' or t_pm_easxtusermap.fxtid is null or (t_pm_easxtusermap.fxtid != xt.fid and t_pm_easxtusermap.fxtid is not null)) and xt.femail not in (select FEmail FROM t_xt_user group by FEmail having count(FEmail) &gt;= 2 and FEmail is not null) and t_pm_easxtusermap.fcell is null)</node>
  80. <node ID="bindOrgByOrgLongName" desc="按组织长名称绑定云之家组织id">update t_pm_easxtorgmap set (fxtorgid,FXtParentId) = (select xtorg.fid,xtorg.FParentId from t_xt_org xtorg where (xtorg.FOrgLongName=t_pm_easxtorgmap.FOrgLongName or ((xtorg.FParentId is null or xtorg.FParentId = '') and to_char(t_pm_easxtorgmap.FOrgLongName)=to_char('\'))) and xtorg.FOrgLongName not in (select FOrgLongName from t_xt_org group by FOrgLongName having count(FOrgLongName) &gt;= 2 and FOrgLongName is not null) and (t_pm_easxtorgmap.fxtorgid != xtorg.fid or t_pm_easxtorgmap.fxtorgid is null)) where exists(select xtorg.fid from t_xt_org xtorg where (xtorg.FOrgLongName=t_pm_easxtorgmap.FOrgLongName or ((xtorg.FParentId is null or xtorg.FParentId = '') and to_char(t_pm_easxtorgmap.FOrgLongName)=to_char('\'))) and xtorg.FOrgLongName not in (select FOrgLongName from t_xt_org group by FOrgLongName having count(FOrgLongName) &gt;= 2 and FOrgLongName is not null) and (t_pm_easxtorgmap.fxtorgid != xtorg.fid or t_pm_easxtorgmap.fxtorgid is null))</node>
  81. <node ID="bindUpdateCellToMap" desc="按组织长名称绑定云之家修改的用户手机到中间表">update t_pm_easxtusermap set fcell = (select top 1 cur.fnewPhone from T_XT_CellUpdateRecords cur where cur.fxtid = t_pm_easxtusermap.fxtid and (t_pm_easxtusermap.fcell != cur.fnewPhone or t_pm_easxtusermap.fcell is null) order by fcreatetime desc) where exists(select top 1 cur.fnewPhone from T_XT_CellUpdateRecords cur where cur.fxtid = t_pm_easxtusermap.fxtid and (t_pm_easxtusermap.fcell != cur.fnewPhone or t_pm_easxtusermap.fcell is null) order by fcreatetime desc)</node>
  82. <node ID="bindUpdateCellToMapWithID" desc="按xuid绑定云之家修改的用户手机到中间表">update t_pm_easxtusermap set fcell = (select cur.fnewPhone from T_XT_CellUpdateRecords cur where t_pm_easxtusermap.fxtid = cur.fxtid and (t_pm_easxtusermap.fcell != cur.fnewPhone or t_pm_easxtusermap.fcell is null) and fid = ?) where exists(select cur.fnewPhone from T_XT_CellUpdateRecords cur where t_pm_easxtusermap.fxtid = cur.fxtid and (t_pm_easxtusermap.fcell != cur.fnewPhone or t_pm_easxtusermap.fcell is null) and fid = ?)</node>
  83. <node ID="updateUserCellFromMap" desc="从中间表更新用户手机">update t_pm_user set fcell = (SELECT fcell FROM t_pm_easxtusermap map where map.fuserid = t_pm_user.fid and map.fuserid is not nul and (t_pm_user.fcell != map.fcell or t_pm_user.fcell is null)) where exists(SELECT 1 FROM t_pm_easxtusermap map where map.fuserid = t_pm_user.fid and map.fuserid is not nul and (t_pm_user.fcell != map.fcell or t_pm_user.fcell is null))</node>
  84. <node ID="updatePersonCellFromMap" desc="从中间表更新职员手机(没有关联用户的职员)">update T_BD_PERSON set fcell = (SELECT fcell FROM t_pm_easxtusermap map where map.fpersonid = T_BD_PERSON.fid and (map.fuserid is null or map.fuserid = '') and (T_BD_PERSON.fcell != map.fcell or map.fcell is null)) where exists(SELECT 1 FROM t_pm_easxtusermap map where map.fpersonid = T_BD_PERSON.fid and (map.fuserid is null or map.fuserid = '') and (T_BD_PERSON.fcell != map.fcell or map.fcell is null))</node>
  85. <node ID="getNeedUpdateCellWithXTID" desc="从中间表将修改了的手机更新到本地WithXTID">select distinct umap.fuserid userid, umap.fpersonid personid,cur.fnewPhone newphone,cur.fxtid xtid,cur.fcreatetime createtime from T_XT_CellUpdateRecords cur inner join t_pm_easxtusermap umap on umap.fxtid = cur.fxtid where umap.fxtid = ? order by cur.fcreatetime desc</node>
  86. <node ID="getNeedUpdateCell" desc="从中间表将修改了的手机更新到本地">select distinct umap.fuserid userid, umap.fpersonid personid,cur.fnewPhone newphone,cur.fxtid xtid,cur.fcreatetime createtime from T_XT_CellUpdateRecords cur inner join t_pm_easxtusermap umap on umap.fxtid = cur.fxtid order by cur.fcreatetime desc</node>
  87. <node ID="bindSql" desc="绑定T_PM_EASXTUSERMAP">update T_PM_EASXTUSERMAP easxt set (FXtId) =(select t_tm_tmp.fxtid from t_tm_tmp where easxt.fpersonId = t_tm_tmp.fpersonid) where easxt.FXtId is null and not exists (select tmp.fpersonid from (select tmp1.fpersonid fpersonId,tmp1.fxtid fxtid from t_tm_tmp tmp1, t_tm_tmp tmp2 where (tmp1.fpersonId = tmp2.fpersonId and tmp1.fxtId != tmp2.fxtId) or (tmp1.fpersonid != tmp2.fpersonId and tmp1.fxtId = tmp2.fxtId))tmp where easxt.fpersonId = tmp.fpersonid)</node>
  88. <node ID="selectAddNewOrgInfo" desc="查找新增组织">select distinct FOrgLongName,org.FSortCode from T_PM_EASXTORGMAP easxt left join T_ORG_Admin org on org.FID = easxt.FEasOrgId where not exists (select FID from t_xt_org xt where easxt.FXtOrgId = xt.FID ) and easxt.feasstatus = 0 and to_char(easxt.forglongname) != to_char('\') and not exists(select 1 from T_XT_NoSyncOrg nso where nso.forgid = easxt.feasorgid) order by org.FSortCode</node>
  89. <node ID="selectDeleteOrgInfo" desc="查找删除组织">select distinct FOrgLongName,FXtOrgId from T_PM_EASXTORGMAP easxt where exists (select FID from t_xt_org xt where easxt.FXtOrgId = xt.FID) and easxt.feasstatus = 1 union select distinct FOrgLongName,FXtOrgId from T_PM_EASXTORGMAP easxt where not exists (select eas.fid from T_ORG_Admin eas where eas.FID = easxt.FEasOrgId) and exists (select FID from t_xt_org xt where easxt.FXtOrgId = xt.FID) union select distinct FOrgLongName,FXtOrgId from T_PM_EASXTORGMAP easxt where exists(select 1 from T_XT_NoSyncOrg nso where nso.forgid = easxt.feasorgid) and exists (select FID from t_xt_org xt where easxt.FXtOrgId = xt.FID)</node>
  90. <node ID="deleteDeletedOrgInfo" desc="删除已经删除的组织">delete from T_PM_EASXTORGMAP where not exists(select xtorg.fid from t_xt_org xtorg where xtorg.fid = T_PM_EASXTORGMAP.fxtorgid) and feasstatus = 1</node>
  91. <node ID="selectMoveOrg" desc="查找挪动的组织">SELECT distinct omap.fxtorgid orgid, omap.fxtparentid moveToOrgId, xtorg.forglongname department,toparent.forglongname toPdepartment,oldparent.forglongname oldPdepartment FROM T_PM_EASXTORGMAP omap left join T_XT_ORG xtorg on xtorg.fid = omap.fxtorgid left join T_XT_ORG toparent on toparent.fid = omap.fxtparentid left join T_XT_ORG oldparent on oldparent.fid = xtorg.fparentid where xtorg.fparentid != omap.fxtparentid and omap.fxtparentid is not null and not exists(select 1 from T_XT_NoSyncOrg nso where nso.forgid = omap.feasorgid) </node>
  92. <node ID="selectUpdateOrgName" desc="查找组织名称变化的数据">select easxt.FName orgLongName, xt.FOrgLongName oldOrgLongName, xt.fid orgId from T_PM_EASXTORGMAP easxt,t_xt_org xt where easxt.FXtOrgId = xt.FID and easxt.FName != xt.FName and not exists(select xt1.fid from T_XT_ORG xt1 where xt1.fid = easxt.fxtorgid and (xt1.fparentid is null or xt1.fparentid = '')) and not exists(select 1 from T_XT_NoSyncOrg nso where nso.forgid = easxt.feasorgid)</node>
  93. <node ID="selectUpdateOrgWeights" desc="查找组织权重排序变化的数据">select easxt.forglongname orgLongName, xt.fid orgId,easxt.fweights weights from T_PM_EASXTORGMAP easxt,t_xt_org xt where easxt.FXtOrgId = xt.FID and (easxt.fweights != xt.fweights or xt.fweights is null or xt.fweights = '') and not exists(select 1 from T_XT_NoSyncOrg nso where nso.forgid = easxt.feasorgid)</node>
  94. <node ID="selectAddNewUserInfo" desc="查找新增职员">select distinct easxt.FPersonId easpersonId,case when(easxt.FUserId is null) then easxt.FPersonName else easxt.FUserName end easPersonName,easxt.FCell cell,easxt.FEmail email,easxt.FPosition position,easxt.FOrgLongName orgLongName,p.FGender gender,p.FBirthday birthday, p.FINDEX weights, easxt.FPersonNumber easpersonnumber from T_PM_EASXTUSERMAP easxt inner join T_BD_Person p on p.FID = easxt.FPersonId where (not exists (select FID from t_xt_user xt where easxt.FXtId = xt.FID) or exists (select FID from t_xt_user xt where easxt.FXtId = xt.FID and xt.fstatus = 0)) and easxt.FIsSynch = 1 and easxt.FStatus =1 and not exists(select nsp.fpersonid from T_XT_NoSyncPerson nsp where nsp.fpersonid = easxt.fpersonid) </node>
  95. <node ID="selectChangeCellUserInfo" desc="查找手机号码变更职员,调用更新人员信息接口">select distinct FPersonId easpersonId,case when(FUserId is null) then FPersonName else FUserName end easPersonName,FCell cell,FEmail email,FPosition position,FOrgLongName orgLongName,fxtid from T_PM_EASXTUSERMAP easxt where exists (select FID from t_xt_user xt where easxt.FXtId = xt.FID and easxt.fcell is not null and (xt.fcell != easxt.fcell or xt.fcell is null)) and easxt.FIsSynch = 1 and easxt.FStatus =1 and not exists(select nsp.fpersonid from T_XT_NoSyncPerson nsp where nsp.fpersonid = easxt.fpersonid) </node>
  96. <node ID="syncUserInfoFail" desc="更新同步失败原因--已废弃">update t_pm_easxtusermap set FISSynch = 0,FDescription=? where FCell=?</node>
  97. <node ID="selectUpdatePersonStatus" desc="查找状态更新员工">select distinct empType.FinService ftype,easxt1.fpersonId easPersonId,case when(easxt1.FUserId is null) then easxt1.FPersonName else easxt1.FUserName end easPersonName,easxt1.FCell cell,easxt1.forgLongName org,easxt1.FPosition position,easxt1.femail email,easxt1.FxtId xtId,easxt1.FOrgLongName orgLongName from T_PM_EASXTUSERMAP easxt1 inner join t_xt_user xt on easxt1.fxtid = xt.fid inner join T_BD_Person p on easxt1.FPersonId = p.FID left join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID where easxt1.FStatus != xt.fstatus</node>
  98. <node ID="selectDeletedUser1" desc="查找删除的员工">select distinct easxt1.fpersonId easPersonId,case when(easxt1.FUserId is null) then easxt1.FPersonName else easxt1.FUserName end easPersonName,easxt1.FCell cell,easxt1.forgLongName org,easxt1.FPosition position,easxt1.femail email,easxt1.FxtId xtId,easxt1.FOrgLongName orgLongName from T_PM_EASXTUSERMAP easxt1 left join t_xt_user xt on easxt1.fxtid = xt.fid inner join T_BD_Person p on easxt1.FPersonId = p.FID where easxt1.FStatus = 0 and easxt1.FIsSynch = 1 and xt.fstatus =1 and exists(select fid from t_xt_user xt where easxt1.fxtId = xt.FId) union select distinct easxt1.fpersonId easPersonId,case when(easxt1.FUserId is null) then easxt1.FPersonName else easxt1.FUserName end easPersonName,easxt1.FCell cell,easxt1.forgLongName org,easxt1.FPosition position,easxt1.femail email,easxt1.FxtId xtId,easxt1.FOrgLongName orgLongName from T_PM_EASXTUSERMAP easxt1 inner join T_BD_Person p on easxt1.FPersonId = p.FID where exists(select nsp.fpersonid from T_XT_NoSyncPerson nsp where nsp.fpersonid = easxt1.fpersonid) and exists(select fid from t_xt_user xt where easxt1.fxtId = xt.FId)</node>
  99. <node ID="deleteBothDePerson" desc="删除两边都离职的员工">delete from T_PM_EASXTUSERMAP where not exists(select fid from t_xt_user xt where T_PM_EASXTUSERMAP.fxtId = xt.FId) and not exists (select eas.fid from T_BD_Person eas left join T_HR_BDEmployeeType empType on eas.FEMPLOYEETYPEID = empType.FID where eas.FID = T_PM_EASXTUSERMAP.FPersonId and (empType.FinService =1 or empType.FinService = 4) and eas.FDeletedStatus = 1) and FStatus = 0</node>
  100. <node ID="deleteBothDeUsers" desc="删除两边都离职的用户">delete T_PM_EASXTUSERMAP where not exists(select fid from t_xt_user xt where T_PM_EASXTUSERMAP.fxtId = xt.FId) and T_PM_EASXTUSERMAP.FUserId is not null and not exists(SELECT u.fid FROM t_pm_user u where u.FID = T_PM_EASXTUSERMAP.FUserId and u.FISDELETE = 0) and FStatus = 0</node>
  101. <node ID="deleteDeletedUsers" desc="删除已删除的员工--已废弃">delete from T_PM_EASXTUSERMAP where exists(select fid from t_xt_user xt where T_PM_EASXTUSERMAP.fxtId = xt.FId and T_PM_EASXTUSERMAP.FIsDelete = 1 and xt.Fstatus=0)</node>
  102. <node ID="deleteUsersWithProblem" desc="清除异常数据--已废弃">delete from T_PM_EASXTUSERMAP where exists(select fid from t_xt_user xt where T_PM_EASXTUSERMAP.fxtId = xt.FId and (T_PM_EASXTUSERMAP.FStatus = 1 and (T_PM_EASXTUSERMAP.FIsdelete=1 or T_PM_EASXTUSERMAP.FForbidden=1)))</node>
  103. <node ID="selectOrgChanged" desc="组织改变的数据">select distinct xt.FOrgLongName oldOrgLongName,easxt.FXtId xtId,easxt.FOrgLongName orgLongName,easxt.fpersonId easPersonId,case when(easxt.FUserId is null) then easxt.FPersonName else easxt.FUserName end easPersonName,easxt.FCell cell,easxt.FEmail email,easxt.FPosition position from t_pm_easxtusermap easxt inner join t_xt_user xt on easxt.FXtId = xt.FID left join t_xt_org xtorg on xtorg.FOrgLongName = xt.forglongname where (to_char(ltrim(rtrim(easxt.FOrgLongName))) != to_char(ltrim(rtrim(case when(xtorg.fparentid is null or xtorg.fparentid = '') then to_char('\') else to_char(xt.FOrgLongName) end)))) and easxt.fstatus = 1 and xt.Fstatus=1 and not exists(select nsp.fpersonid from T_XT_NoSyncPerson nsp where nsp.fpersonid = easxt.fpersonid)</node>
  104. <node ID="selectUserChanged" desc="职员信息改变">select distinct p.FGender,p.findex,case when(u.FID is null) then RTRIM(p.FHomePhone) else RTRIM(u.FHomePhone) end fofficePhone1, case when(u.FID is null) then RTRIM(p.FOfficePhone) else RTRIM(u.FOfficePhone) end fofficePhone2,p.FBirthday,easxt.FXtId xtId,easxt.FPersonId easpersonId, case when(easxt.FUserId is null) then easxt.FPersonName else easxt.FUserName end easPersonName,easxt.FCell cell,easxt.FPosition position,easxt.FEmail email,easxt.FOrgLongName orgLongName from t_pm_easxtusermap easxt inner join t_xt_user xt on easxt.FXtId = xt.FID inner join T_BD_Person p on easxt.FPersonId = p.FID left join t_pm_user u on easxt.fuserid = p.fid where easxt.fstatus=1 and xt.fstatus=1 and ((easxt.FPosition is not null and ltrim(rtrim(easxt.FPosition)) != ltrim(rtrim(xt.FPosition))) or (p.FGender != xt.FGender)) and not exists(select nsp.fpersonid from T_XT_NoSyncPerson nsp where nsp.fpersonid = easxt.fpersonid)</node>
  105. <node ID="selectUserChangedNew" desc="职员信息改变新">select distinct p.FGender,p.findex,case when(u.FID is null) then RTRIM(p.FHomePhone) else RTRIM(u.FHomePhone) end fofficePhone1, case when(u.FID is null) then RTRIM(p.FOfficePhone) else RTRIM(u.FOfficePhone) end fofficePhone2,p.FBirthday,easxt.FXtId xtId,easxt.FPersonId easpersonId, case when(easxt.FUserId is null) then easxt.FPersonName else easxt.FUserName end easPersonName,easxt.FCell cell,easxt.FPosition position,easxt.FEmail email,easxt.FOrgLongName orgLongName,easxt.fweights weights, easxt.FPersonNumber easpersonnumber from t_pm_easxtusermap easxt inner join t_xt_user xt on easxt.FXtId = xt.FID inner join T_BD_Person p on easxt.FPersonId = p.FID left join t_pm_user u on easxt.fuserid = p.fid where easxt.fstatus=1 and xt.fstatus=1 </node>
  106. <node ID="selectUnSyncedPerson" desc="未同步成功的职员">select distinct FPersonName easPersonName,FCell cell,FEmail email,FPosition position,FOrgLongName orgLongName from T_PM_EASXTUSERMAP easxt where easxt.FxtId is null and easxt.FIsSynch = 0 and easxt.FStatus =1 and fcreatetime &gt;(select max(fsynchtime) from t_xt_synchtime)</node>
  107. <node ID="bindDatas" desc="已绑定数据">select distinct easxt.FPersonId easPersonId,easxt.FCell cell,easxt.FPersonName easPersonName,easxt.FOrgLongName org,easxt.FEmail email,easxt.FPosition position,easxt.Fdescription description from T_PM_EASXTUSERMAP easxt inner join t_xt_user xt on easxt.fxtId = xt.fid where easxt.FStatus = 1 and xt.fstatus = 1</node>
  108. <node ID="unBindDatas" desc="未绑定数据">select distinct easxt.FPersonId easPersonId,easxt.FCell cell,easxt.FPersonName easPersonName,easxt.FOrgLongName org,easxt.FEmail email,easxt.FPosition position,easxt.Fdescription description from T_PM_EASXTUSERMAP easxt where easxt.FxtId is null</node>
  109. <node ID="deletedPerson" desc="离职人员">select distinct easxt.FPersonId easPersonId,easxt.FCell cell,easxt.FPersonName easPersonName,easxt.FOrgLongName org,easxt.FEmail email,easxt.FPosition position,easxt.Fdescription description from T_PM_EASXTUSERMAP easxt inner join t_xt_user xt on easxt.fxtid = xt.fid where easxt.FStatus = 0 and xt.fstatus =1</node>
  110. <node ID="diffInfo" desc="数据不一致">select distinct easxt.FPersonName easPersonName,easxt.FCell easCell,easxt.FOrgLongName easOrgLongName,easxt.FPosition easPosition,easxt.FEmail easEmail,xt.FPersonName xtPersonName,xt.FCell xtCell,xt.FOrglongName xtOrgLongName,xt.FPosition xtPosition,xt.FEmail xtEmail from t_pm_easxtusermap easxt inner join t_xt_user xt on easxt.FXtId = xt.FID where (easxt.FStatus=1 and xt.FStatus=1) and (((easxt.FOrgLongName is not null and xt.FOrgLongName is null) or (easxt.FOrgLongName is not null and xt.FOrgLongName is not null and rtrim(easxt.FOrgLongName) != rtrim(xt.FOrgLongName))) or ((easxt.FPosition is not null and xt.FPosition is null) or (easxt.FPosition is not null and xt.FPosition is not null and rtrim(easxt.FPosition)!=rtrim(xt.FPosition))) or ((easxt.FEMail is not null and xt.FEmail is null) or (easxt.FEMail is not null and xt.FEmail is not null and rtrim(easxt.FEmail)!=rtrim(xt.FEmail))) or((easxt.FPersonName is not null and xt.FPersonName is null) or (easxt.FPersonName is not null and xt.FPersonName is not null and rtrim(easxt.FPersonName)!=rtrim(xt.FPersonName))) or ((easxt.Fcell is not null and xt.Fcell is null) or (easxt.Fcell is not null and xt.Fcell is not null and rtrim(easxt.Fcell)!=rtrim(xt.Fcell))))</node>
  111. <node ID="personLog">select distinct b.fpersonId,b.fpersonName easPerson,a.foperation operation,a.fsuccess status,a.fdescription description,a.foperationtime createTime from t_xt_log a inner join t_pm_easxtusermap b on a.fpersonId=b.fpersonId where foperation &lt;&gt; 0 </node>
  112. <node ID="orgLog">select forgName orgName,foperation operation,fsuccess status,fdescription description,foperationtime createTime from t_xt_log where foperation=0 </node>
  113. <node ID="insertPartMap" desc="插入已有兼职信息到中间表T_PM_EASXTPARTMAP">insert into T_PM_EASXTPARTMAP(FID,FEasOrgId,FXtOrgId,FXtId,FJobTitle) select newbosid('F4AF4F04') FID,omap.FEasOrgId FEasOrgId,omap.FXtOrgId FXtOrgId,umap.FXtId FXtId,pos.FName_L2 FJobTitle from T_ORG_PositionMember opm inner join T_ORG_Position pos on opm.FPositionID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID left join T_PM_EASXTUSERMAP umap on p.FID = umap.FPersonId left join T_PM_EASXTORGMAP omap on pos.FAdminOrgUnitID = omap.FEasOrgId where opm.FIsPrimary != 1 and umap.FXtId is not null and umap.FStatus = 1 and omap.FXtOrgId is not null and not exists(SELECT FXtId FROM T_PM_EASXTPARTMAP where FXtId = umap.FXtId and fxtorgid = omap.fxtorgid and fjobtitle = pos.fname_l2)</node>
  114. <node ID="selectBatchSetPartMap" desc="查询批量设置的兼职信息">SELECT distinct pmap.fxtid openId,pmap.fxtorgid orgId,pmap.fjobTitle jobTitle,umap.FPersonName personName,umap.FCell cell,umap.FOrgLongName orgLongName FROM T_PM_EASXTPARTMAP pmap inner join T_PM_EASXTUSERMAP umap on umap.fxtid = pmap.fxtid inner join t_pm_easxtorgmap omap on omap.feasorgid = pmap.feasorgid where umap.FStatus = 1 and omap.FXtOrgId is not null and omap.feasstatus = 0 and not exists(SELECT fxtid FROM T_XT_PART where fxtid = pmap.fxtid and forgid = pmap.fxtorgid and pmap.fjobTitle = fjobtitle) and exists(select 1 from T_ORG_PositionMember opm inner join T_ORG_Position pos on opm.FPositionID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID left join T_PM_EASXTUSERMAP umap on p.FID = umap.FPersonId left join T_PM_EASXTORGMAP omap on pos.FAdminOrgUnitID = omap.FEasOrgId where opm.FIsPrimary != 1 and umap.FXtId is not null and omap.FXtOrgId is not null and pmap.FXtId = umap.FXtId and pmap.fxtorgid = omap.fxtorgid and pmap.fjobtitle = pos.fname_l2 and umap.fstatus=1 and omap.feasstatus = 0) and not exists(select 1 from T_XT_NoSyncOrg nso where nso.forgid = pmap.feasorgid) and not exists(select nsp.fpersonid from T_XT_NoSyncPerson nsp where nsp.fpersonid = umap.fpersonid)</node>
  115. <node ID="selectBatchDelPartMap" desc="查询批量删除的兼职信息">SELECT distinct easxt.fxtid openId,easxt.fxtorgid orgId,easxt.fjobTitle jobTitle,umap.FPersonName personName,umap.FCell cell,umap.FOrgLongName orgLongName FROM T_PM_EASXTPARTMAP easxt inner join T_PM_EASXTUSERMAP umap on umap.fxtid = easxt.fxtid where not exists(select umap.fxtid from T_ORG_PositionMember opm inner join T_ORG_Position pos on opm.FPositionID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID left join T_PM_EASXTUSERMAP umap on p.FID = umap.FPersonId left join T_PM_EASXTORGMAP omap on pos.FAdminOrgUnitID = omap.FEasOrgId where opm.FIsPrimary != 1 and umap.FXtId is not null and omap.FXtOrgId is not null and easxt.FXtId = umap.FXtId and easxt.fxtorgid = omap.fxtorgid and easxt.fjobtitle = pos.fname_l2 and umap.fstatus=1 and omap.feasstatus = 0) and exists(SELECT fxtid FROM T_XT_PART where fxtid = easxt.fxtid and forgid = easxt.fxtorgid and easxt.fjobTitle = fjobtitle)</node>
  116. <node ID="updateDelPartMap" desc="更新已删除的兼职信息,从中间表移除">select * FROM T_PM_EASXTPARTMAP where not exists(select umap.fxtid from T_ORG_PositionMember opm inner join T_ORG_Position pos on opm.FPositionID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID left join T_PM_EASXTUSERMAP umap on p.FID = umap.FPersonId left join T_PM_EASXTORGMAP omap on pos.FAdminOrgUnitID = omap.FEasOrgId where opm.FIsPrimary != 1 and umap.FXtId is not null and omap.FXtOrgId is not null and T_PM_EASXTPARTMAP.FXtId = umap.FXtId and T_PM_EASXTPARTMAP.fxtorgid = omap.fxtorgid and T_PM_EASXTPARTMAP.fjobtitle = pos.fname_l2 and umap.fstatus=1 and omap.feasstatus = 0) and not exists(SELECT fxtid FROM T_XT_PART where fxtid = T_PM_EASXTPARTMAP.fxtid and forgid = T_PM_EASXTPARTMAP.fxtorgid and T_PM_EASXTPARTMAP.fjobTitle = fjobtitle)</node>
  117. <node ID="insertRelationsMap" desc="插入已有上级信息到中间表T_PM_EASXTRELATIONSMAP">insert into T_PM_EASXTRELATIONSMAP(FID,FLeaderXtId,FXtId,FRelationType,FIsPrimary) (SELECT newbosid('F4AF4F04'),leader.fxtid leaderOpenId,pmap.fxtid openId,'LEADER',pm.FIsPrimary FROM T_PM_EASXTUSERMAP pmap left join T_ORG_POSITIONMEMBER pm on pmap.fpersonid = pm.FPERSONID left join T_ORG_POSITION pos on pm.FPOSITIONID = pos.FID left join T_ORG_POSITIONHIERARCHY ph on pm.FPOSITIONID = ph.FCHILDID left join T_ORG_POSITIONMEMBER pm1 on ph.FPARENTID = pm1.FPOSITIONID left join T_ORG_POSITION pos1 on pm1.FPOSITIONID = pos1.FID left join T_PM_EASXTUSERMAP leader on pm1.FPERSONID = leader.FPERSONID where pm.FPOSITIONID != pm1.FPOSITIONID and leader.fpersonid is not null and pmap.fpersonid is not null and leader.fxtid is not null and pmap.fxtid is not null and pmap.FStatus = 1 and ph.FHIERARCHYID = '00000000-0000-0000-0000-000000000001396FCAD0' and not exists(SELECT rela.fid FROM T_PM_EASXTRELATIONSMAP rela where pmap.fxtid = rela.fxtid and leader.fxtid = rela.fleaderxtid))</node>
  118. <node ID="selectBatchSetRelations" desc="查询批量新增上级">select distinct rmap.fleaderxtid leaderOpenId,rmap.fxtid openId,umap.FPersonName personName,umap.FCell cell,umap.FOrgLongName orgLongName,umap.FPosition position,lmap.FPersonName leaderPersonName,lmap.FPosition leaderPosition FROM T_PM_EASXTRELATIONSMAP rmap inner join T_PM_EASXTUSERMAP umap on umap.fxtid = rmap.fxtid inner join T_PM_EASXTUSERMAP lmap on lmap.fxtid = rmap.fleaderxtid where not exists(SELECT rela.fid FROM T_XT_PERSONRELATIONS rela where rmap.fxtid = rela.fxtid and rmap.fleaderxtid = rela.fleaderxtid) and exists(select leader.fxtid from T_PM_EASXTUSERMAP pmap left join T_ORG_POSITIONMEMBER pm on pmap.fpersonid = pm.FPERSONID left join T_ORG_POSITION pos on pm.FPOSITIONID = pos.FID left join T_ORG_POSITIONHIERARCHY ph on pm.FPOSITIONID = ph.FCHILDID left join T_ORG_POSITIONMEMBER pm1 on ph.FPARENTID = pm1.FPOSITIONID left join T_ORG_POSITION pos1 on pm1.FPOSITIONID = pos1.FID left join T_PM_EASXTUSERMAP leader on pm1.FPERSONID = leader.FPERSONID where pm.FPOSITIONID != pm1.FPOSITIONID and leader.fpersonid is not null and pmap.fpersonid is not null and leader.fxtid is not null and pmap.fxtid is not null and pmap.fxtid = rmap.fxtid and leader.fxtid = rmap.fleaderxtid) and not exists(select 1 from T_XT_NoSyncPerson nsp where nsp.fpersonid = lmap.fpersonid) and umap.FStatus = 1 and lmap.FStatus = 1 and not exists(select 1 from T_XT_NoSyncPerson nsp where nsp.fpersonid = umap.fpersonid)</node>
  119. <node ID="selectBatchDelRelations" desc="查询批量删除上级">select distinct rmap.fleaderxtid leaderOpenId,rmap.fxtid openId,umap.FPersonName personName,umap.FCell cell,umap.FOrgLongName orgLongName,umap.FPosition position,lmap.FPersonName leaderPersonName,lmap.FPosition leaderPosition FROM T_PM_EASXTRELATIONSMAP rmap inner join T_PM_EASXTUSERMAP umap on umap.fxtid = rmap.fxtid inner join T_PM_EASXTUSERMAP lmap on lmap.fxtid = rmap.fleaderxtid where (not exists (select leader.fxtid from T_PM_EASXTUSERMAP pmap left join T_ORG_POSITIONMEMBER pm on pmap.fpersonid = pm.FPERSONID left join T_ORG_POSITION pos on pm.FPOSITIONID = pos.FID left join T_ORG_POSITIONHIERARCHY ph on pm.FPOSITIONID = ph.FCHILDID left join T_ORG_POSITIONMEMBER pm1 on ph.FPARENTID = pm1.FPOSITIONID left join T_ORG_POSITION pos1 on pm1.FPOSITIONID = pos1.FID left join T_PM_EASXTUSERMAP leader on pm1.FPERSONID = leader.FPERSONID where pm.FPOSITIONID != pm1.FPOSITIONID and leader.fpersonid is not null and pmap.fpersonid is not null and leader.fxtid is not null and pmap.fxtid is not null and pmap.fxtid = rmap.fxtid and leader.fxtid = rmap.fleaderxtid) and exists(select xtre.fxtid from T_XT_PERSONRELATIONS xtre where xtre.fxtid = rmap.fxtid and xtre.FLeaderXtId = rmap.fleaderxtid) or umap.FStatus = 0 or lmap.FStatus = 0)</node>
  120. <node ID="updateDelRelationsMap" desc="更新已删除的上级信息,从中间表移除">delete from T_PM_EASXTRELATIONSMAP where not exists (select leader.fxtid from T_PM_EASXTUSERMAP pmap left join T_ORG_POSITIONMEMBER pm on pmap.fpersonid = pm.FPERSONID left join T_ORG_POSITION pos on pm.FPOSITIONID = pos.FID left join T_ORG_POSITIONHIERARCHY ph on pm.FPOSITIONID = ph.FCHILDID left join T_ORG_POSITIONMEMBER pm1 on ph.FPARENTID = pm1.FPOSITIONID left join T_ORG_POSITION pos1 on pm1.FPOSITIONID = pos1.FID left join T_PM_EASXTUSERMAP leader on pm1.FPERSONID = leader.FPERSONID where pm.FPOSITIONID != pm1.FPOSITIONID and leader.fpersonid is not null and pmap.fpersonid is not null and leader.fxtid is not null and pmap.fxtid is not null and pmap.FStatus = 1 and pmap.fxtid = T_PM_EASXTRELATIONSMAP.fxtid and leader.fxtid = T_PM_EASXTRELATIONSMAP.fleaderxtid and ph.FHIERARCHYID = '00000000-0000-0000-0000-000000000001396FCAD0') and not exists(select xtre.fxtid from T_XT_PERSONRELATIONS xtre where xtre.fxtid = T_PM_EASXTRELATIONSMAP.fxtid and xtre.FLeaderXtId = T_PM_EASXTRELATIONSMAP.fleaderxtid)</node>
  121. <node ID="getNormalUser" desc="查询符合条件的职员用户和未关联用户的职员">select p.fid FPersonId,u.fid FUserId,null FXtId,LTRIM(RTRIM(p.FName_l2)) FPersonName, case when(u.FID is null) then RTRIM(p.FCell) else RTRIM(u.FCell) end FCell,case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end FOrgLongName,pos.FName_l2 FPosition,case when(u.FID is null) then RTRIM(p.FEmail) else RTRIM(u.FEmail) end FEmail,u.FNumber FUserNumber,u.FName_l2 FUserName,u.FForbidden,u.FIsDelete,u.FAgentUser createtime from t_bd_person p left outer join t_pm_user u on u.fpersonid = p.fid left outer join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left outer join t_org_positionmember opm on opm.FPERSONID = p.FID LEFT OUTER JOIN T_org_position pos on opm.FPOSITIONID = pos.fid left outer join t_org_admin org ON pos.fadminorgunitid = org.fid where opm.FISPRIMARY = 1 and (empType.FinService = 1 or empType.FinService = 4) and (u.FID is null or (u.FForbidden=0 and u.FIsDelete=0))</node>
  122. <node ID="getNormalUserCount" desc="查询符合条件的职员用户和未关联用户的职员记录数count">select count(0) from t_bd_person p left outer join t_pm_user u on u.fpersonid = p.fid left outer join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left outer join t_org_positionmember opm on opm.FPERSONID = p.FID LEFT OUTER JOIN T_org_position pos on opm.FPOSITIONID = pos.fid left outer join t_org_admin org ON pos.fadminorgunitid = org.fid where opm.FISPRIMARY = 1 and (empType.FinService = 1 or empType.FinService = 4) and (u.FID is null or (u.FForbidden=0 and u.FIsDelete=0))</node>
  123. <node ID="getEasOrgLeader" desc="查询eas部门负责人,用于对比">select distinct (case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\')) else to_char('\') end) orglongname,p.fname_l2 leaderName,pos.fname_l2 from T_ORG_Admin org inner join T_ORG_Position pos on pos.FID = org.FResponPositionID inner join t_org_positionmember opm on opm.FPositionID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID where org.FResponPositionID is not null and pos.FISRESPPOSITION = 1</node>
  124. <node ID="getXtOrgFromOrgMap" desc="查询云之家组织 用于对比">select xt.fname forgname from t_pm_easxtorgmap omap left join t_xt_org xt on xt.fid = omap.fxtorgid where 1=1</node>
  125. <node ID="getXtOrg" desc="查询云之家组织 用于对比">select xt.fname forgname from t_xt_org xt where 1=1</node>
  126. <node ID="getXtOrgLeader" desc="查询云之家部门负责人,用于对比">select distinct xtuser.forglongname orglongname, xtuser.fpersonname leaderName from t_xt_orgleader leader left join t_xt_user xtuser on leader.fxtid = xtuser.fid left join t_xt_org xtorg on xtorg.forglongname = xtuser.forglongname where 1=1</node>
  127. <node ID="getXtPersonDetail" desc="查询云之家人员,用于对比">select u.*,o.FParentId from t_xt_user u left join t_xt_org o on u.forglongname=o.forglongname where 1=1</node>
  128. <node ID="getEasPersonDetail" desc="查询EAS人员,用于对比">select p.fid FPersonId,u.fid FUserId,null FXtId,LTRIM(RTRIM(p.FName_l2)) FPersonName, case when(u.FID is null) then RTRIM(p.FCell) else RTRIM(u.FCell) end FCell,org.fdisplayname_l2 FOrgLongName,pos.FName_l2 FPosition,case when(u.FID is null) then RTRIM(p.FEmail) else RTRIM(u.FEmail) end FEmail,u.FNumber FUserNumber,u.FName_l2 FUserName,u.FForbidden,u.FIsDelete,p.FGender,empType.FinService,p.fdeletedStatus,case when(u.FID is null) then RTRIM(p.FHomePhone) else RTRIM(u.FHomePhone) end fofficePhone1, case when(u.FID is null) then RTRIM(p.FOfficePhone) else RTRIM(u.FOfficePhone) end fofficePhone2,p.FBirthday,p.fnumber personnumber from t_bd_person p left outer join t_pm_user u on u.fpersonid = p.fid left outer join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left outer join t_org_positionmember opm on opm.FPERSONID = p.FID LEFT OUTER JOIN T_org_position pos on opm.FPOSITIONID = pos.fid left outer join t_org_admin org ON pos.fadminorgunitid = org.fid where 1 = 1</node>
  129. <node ID="getEasAllPersons" desc="查询EAS人员">SELECT distinct * FROM (SELECT org.fparentid orgparentid,p.fid fpersonid,u.fid fuserid,map.fxtid fxtid,p.fname_l2 fpersonname,case when(u.fcell is null or u.fcell = '') then p.fcell else u.fcell end fcell,org.FDISPLAYNAME_L2 forglongname,pos.fname_l2 fposition,case when(u.femail is null or u.femail = '') then p.femail else u.femail end femail,u.fnumber fusernumber,u.fname_l2 fusername, empType.FinService FinService,nsp.FPersonId noSyncPersonId,org.Flongnumber,map.fstatus mapstatus,map.fdescription fdescription,u.FNUMBER usernumber,p.fcell pcell,u.fcell ucell,p.femail pmail,u.femail umail,p.fnumber personnumber FROM t_bd_person p left join T_PM_USER u on u.fpersonid = p.fid left join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left join T_XT_NoSyncPerson nsp on nsp.FPersonId = p.fid left join T_ORG_POSITIONMEMBER pm on pm.FPERSONID = p.fid left join T_ORG_POSITION pos on pos.FID = pm.FPOSITIONID left join T_ORG_ADMIN org on org.FID = pos.FADMINORGUNITID left join T_PM_EASXTUSERMAP map on map.fuserid = u.fid union all SELECT org.fparentid orgparentid,p.fid fpersonid,u.fid fuserid,map.fxtid fxtid,p.fname_l2 fpersonname,case when(u.fcell is null or u.fcell = '') then p.fcell else u.fcell end fcell,org.FDISPLAYNAME_L2 forglongname,pos.fname_l2 fposition,case when(u.femail is null or u.femail = '') then p.femail else u.femail end femail,u.fnumber fusernumber,u.fname_l2 fusername, empType.FinService FinService,nsp.FPersonId noSyncPersonId,org.Flongnumber,map.fstatus mapstatus,map.fdescription fdescription,u.FNUMBER usernumber,p.fcell pcell,u.fcell ucell,p.femail pmail,u.femail umail,p.fnumber personnumber FROM t_bd_person p left join T_PM_USER u on u.fpersonid = p.fid left join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left join T_XT_NoSyncPerson nsp on nsp.FPersonId = p.fid left join T_ORG_POSITIONMEMBER pm on pm.FPERSONID = p.fid left join T_ORG_POSITION pos on pos.FID = pm.FPOSITIONID left join T_ORG_ADMIN org on org.FID = pos.FADMINORGUNITID left join T_PM_EASXTUSERMAP map on map.fpersonid = p.fid where u.fid is null or u.fid = '') t1 where t1.fpersonid is not null </node>
  130. <node ID="getSyncCondition" desc="查询EAS人员状态">SELECT distinct pm.FISPRIMARY isPrimary,empType.FinService inService,empType.fname_l2 inServiceName,p.FDELETEDSTATUS deletedStatus,u.FISDELETE udelete,u.FFORBIDDEN forbidden,p.fcell pcell,u.fcell ucell,p.femail pmail,u.femail umail FROM t_bd_person p left join T_PM_USER u on u.fpersonid = p.fid left join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left join T_ORG_POSITIONMEMBER pm on pm.FPERSONID = p.fid where 1=1</node>
  131. <node ID="getExportAllOrg" desc="查询导出的全部组织">SELECT org.FLONGNUMBER orglongnumber,org.FDISPLAYNAME_l2 orglongname, org.fname_l2 orgname, case when(org.FISSEALUP = 1) then '封存' else '正常' end issealup, case when(omap.fxtorgid is null or omap.fxtorgid = '') then '未绑定' else '已绑定' end isbind, case when(CHARINDEX(' ',org.fname_l2) &gt; 0 or CHARINDEX('\',org.fname_l2) &gt; 0 or CHARINDEX('_',org.fname_l2) &gt; 0 or org.FISSEALUP = 1) then '组织封存、或组织中存在空格、空字符“ ”、下划线“_”、反斜杠“\”等字符将导致同步出错,请检查!' else '' end reason,omap.fxtorgid xtorgid, xtorg.forglongname xtorglongname FROM t_org_admin org left join t_pm_easxtorgmap omap on omap.feasorgid = org.fid left join t_xt_org xtorg on xtorg.fid = omap.fxtorgid order by org.FLONGNUMBER</node>
  132. <node ID="getExportNoBindOrg" desc="查询导出的未绑定组织">SELECT org.FLONGNUMBER orglongnumber,org.FDISPLAYNAME_l2 orglongname, org.fname_l2 orgname, case when(org.FISSEALUP = 1) then '封存' else '正常' end issealup, case when(omap.fxtorgid is null or omap.fxtorgid = '') then '未绑定' else '已绑定' end isbind, case when(CHARINDEX(' ',org.fname_l2) &gt; 0 or CHARINDEX('\',org.fname_l2) &gt; 0 or CHARINDEX('_',org.fname_l2) &gt; 0 or org.FISSEALUP = 1) then '组织封存、或组织中存在空格、空字符“ ”、下划线“_”、反斜杠“\”等字符将导致同步出错,请检查!' else '' end reason,omap.fxtorgid xtorgid, xtorg.forglongname xtorglongname FROM t_org_admin org left join t_pm_easxtorgmap omap on omap.feasorgid = org.fid left join t_xt_org xtorg on xtorg.fid = omap.fxtorgid where omap.fxtorgid is null or omap.fxtorgid = '' order by org.FLONGNUMBER</node>
  133. <node ID="getExportOrgTitles" desc="查询导出的组织列头">组织长编码,组织长名称,组织名称,封存状态,绑定状态,异常,云之家组织ID,云之家组织长名称</node>
  134. <node ID="getExportAllPerson" desc="查询导出的全部人员">SELECT distinct p.fname_l2 personname,case when(u.fid is null or u.fid = '') then p.fcell else u.fcell end fcell,case when(u.fid is null or u.fid = '') then p.femail else u.femail end email,org.FDISPLAYNAME_l2 orglongname,pos.fname_l2,case when(p.FGENDER = 1) then '男' else '女' end gender,p.FBIRTHDAY birthday,case when(case when(u.fid is null) then pmap.fstatus else umap.fstatus end = 0) then '离职' else '在职' end mapstatus,case when(case when(u.fid is null) then pmap.fxtid else umap.fxtid end is null) then '未绑定' else '已绑定' end isbind, case when(u.fid is null) then pmap.fxtid else umap.fxtid end fxtid,case when(pm.FISPRIMARY is null) then '无' else '有' end hasposition,empType.fname_l2,empType.FINSERVICE,case when(p.FDELETEDSTATUS = 1) then '正常' else '禁用' end deletestatus,case when(u.fid is not null and u.FISDELETE = 1) then '删除' else '正常' end udelete,case when(u.fid is not null and u.FFORBIDDEN = 1) then '禁用' else '正常' end forbidden,case when(p.FDELETEDSTATUS != 1 or u.FFORBIDDEN != 0 or u.FISDELETE != 0 or pm.FISPRIMARY is null) then '离职' else '正常' end inTimeStatus,case when(nsp.FPersonId is null) then '上传' else '不上传' end synccontrol,case when(u.fid is null) then pmap.fdescription else umap.fdescription end description,case when(u.fid is null and pmap.fid is null) then '不存在' else '存在' end inmiddle,u.FNUMBER usernumber FROM t_bd_person p left join T_PM_USER u on u.fpersonid = p.fid left join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left join T_XT_NoSyncPerson nsp on nsp.FPersonId = p.fid left join T_ORG_POSITIONMEMBER pm on pm.FPERSONID = p.fid left join T_ORG_POSITION pos on pos.FID = pm.FPOSITIONID left join T_ORG_ADMIN org on org.FID = pos.FADMINORGUNITID left join T_PM_EASXTUSERMAP umap on umap.fuserid = u.fid left join T_PM_EASXTUSERMAP pmap on pmap.fpersonid = p.fid where pm.FISPRIMARY = 1 order by org.FDISPLAYNAME_l2</node>
  135. <node ID="getExportNoBindPerson" desc="查询导出的未绑定人员">SELECT distinct p.fname_l2 personname,case when(u.fid is null or u.fid = '') then p.fcell else u.fcell end fcell,case when(u.fid is null or u.fid = '') then p.femail else u.femail end email,org.FDISPLAYNAME_l2 orglongname,pos.fname_l2,case when(p.FGENDER = 1) then '男' else '女' end gender,p.FBIRTHDAY birthday,case when(case when(u.fid is null) then pmap.fstatus else umap.fstatus end = 0) then '离职' else '在职' end mapstatus,case when(case when(u.fid is null) then pmap.fxtid else umap.fxtid end is null) then '未绑定' else '已绑定' end isbind, case when(u.fid is null) then pmap.fxtid else umap.fxtid end fxtid,case when(pm.FISPRIMARY is null) then '无' else '有' end hasposition,empType.fname_l2,empType.FINSERVICE,case when(p.FDELETEDSTATUS = 1) then '正常' else '禁用' end deletestatus,case when(u.fid is not null and u.FISDELETE = 1) then '删除' else '正常' end udelete,case when(u.fid is not null and u.FFORBIDDEN = 1) then '禁用' else '正常' end forbidden,case when(p.FDELETEDSTATUS != 1 or u.FFORBIDDEN != 0 or u.FISDELETE != 0 or pm.FISPRIMARY is null) then '离职' else '正常' end inTimeStatus,case when(nsp.FPersonId is null) then '上传' else '不上传' end synccontrol,case when(u.fid is null) then pmap.fdescription else umap.fdescription end description,case when(u.fid is null and pmap.fid is null) then '不存在' else '存在' end inmiddle,u.FNUMBER usernumber FROM t_bd_person p left join T_PM_USER u on u.fpersonid = p.fid left join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left join T_XT_NoSyncPerson nsp on nsp.FPersonId = p.fid left join T_ORG_POSITIONMEMBER pm on pm.FPERSONID = p.fid left join T_ORG_POSITION pos on pos.FID = pm.FPOSITIONID left join T_ORG_ADMIN org on org.FID = pos.FADMINORGUNITID left join T_PM_EASXTUSERMAP umap on umap.fuserid = u.fid left join T_PM_EASXTUSERMAP pmap on pmap.fpersonid = p.fid where case when(u.fid is null) then pmap.fxtid else umap.fxtid end is null and pm.FISPRIMARY = 1 order by org.FDISPLAYNAME_l2</node>
  136. <node ID="getExportPersonsTitles" desc="查询导出的人员列头">姓名,手机,邮箱,组织长名称,职位,性别,生日,在职状态(中间表),绑定状态,云之家人员ID,职位状态,HR状态,在职判断值,职员禁用,用户删除,用户禁用,在职状态(实时),同步控制,异常,中间表状态,用户帐号</node>
  137. <node ID="getQuitPersonToMiddle" desc="离职人员插入中间表">insert into T_PM_EASXTUSERMAP(FID,FPersonId,FUserId,FXtId,FPersonName,FCell ,FOrgLongName ,FPosition,FEmail,FUserNumber,FUserName,FForbidden,FIsDelete,FAgentUser,FcreateTime,fpersonnumber) select newbosid('F4AF4F04') FID,p.fid FPersonId,u.fid FUserId,null FXtId,LTRIM(RTRIM(p.FName_l2)) FPersonName, case when(u.FID is null) then RTRIM(p.FCell) else RTRIM(u.FCell) end FCell,case when CHARINDEX('_',org.fdisplayname_l2) &gt; 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\\')) else to_char('\\') end FOrgLongName,pos.FName_l2 FPosition,case when(u.FID is null) then RTRIM(p.FEmail) else RTRIM(u.FEmail) end FEmail,u.FNumber FUserNumber,u.FName_l2 FUserName,u.FForbidden,case when(u.FID is null) then (case when(p.FDeletedStatus = 1) then 0 else 1 end) else u.FIsDelete end FIsDelete,u.FAgentUser,now() createtime,p.fnumber from t_bd_person p left outer join t_pm_user u on u.fpersonid = p.fid left outer join T_HR_BDEmployeeType empType ON p.FEmployeeTypeID = empType.FID left outer join t_org_positionmember opm on opm.FPERSONID = p.FID LEFT OUTER JOIN T_org_position pos on opm.FPOSITIONID = pos.fid left outer join t_org_admin org ON pos.fadminorgunitid = org.fid where not exists(select FPersonId from T_PM_EASXTUSERMAP easxt where (case when(easxt.fuserid is not null) then easxt.fuserid else easxt.fpersonid end) = (case when(u.fid is not null) then u.fid else p.fid end))</node>
  138. <node ID="bindQuitPerson" desc="离职人员插入中间表后绑定云之家人员">update t_pm_easxtusermap set fxtid = (select xt.fid from t_xt_user xt where xt.fcell is not null and (t_pm_easxtusermap.fxtid = '' or t_pm_easxtusermap.fxtid is null or (t_pm_easxtusermap.fxtid != xt.fid and t_pm_easxtusermap.fxtid is not null)) and xt.fcell=t_pm_easxtusermap.fcell and xt.fcell not in (select fcell FROM t_xt_user group by fcell having count(fcell) &gt;= 2 and fcell is not null)) where exists(select xt.fid from t_xt_user xt where xt.fcell is not null and (t_pm_easxtusermap.fxtid = '' or t_pm_easxtusermap.fxtid is null or (t_pm_easxtusermap.fxtid != xt.fid and t_pm_easxtusermap.fxtid is not null)) and xt.fcell=t_pm_easxtusermap.fcell and xt.fcell not in (select fcell FROM t_xt_user group by fcell having count(fcell) &gt;= 2 and fcell is not null))</node>
  139. <node ID="setXtIdNULL" desc="设置xtid为null当为空串的时候">update T_PM_EASXTUSERMAP set FXtId = null where FXtId = ''</node>
  140. <node ID="setCellNULL" desc="设置Cell为null当为空串的时候">update T_PM_EASXTUSERMAP set FCell = null where FCell = ''</node>
  141. <node ID="setEmailNULL" desc="设置Email为null当为空串的时候">update T_PM_EASXTUSERMAP set FEmail = null where FEmail = ''</node>
  142. <node ID="setPositionNULL" desc="设置Position为null当为空串的时候">update T_PM_EASXTUSERMAP set FPosition = null where FPosition = ''</node>
  143. <node ID="setOrgLongNameNULL" desc="设置OrgLongName为null当为空串的时候">update T_PM_EASXTUSERMAP set FOrgLongName = null where FOrgLongName = ''</node>
  144. <node ID="setDescriptionNULL" desc="设置Description为null当为空串的时候">update T_PM_EASXTUSERMAP set FDescription = null where FDescription = ''</node>
  145. <node ID="setUserNameNULL" desc="设置UserName为null当为空串的时候">update T_PM_EASXTUSERMAP set FUserName = null where FUserName = ''</node>
  146. <node ID="setUserNumberNULL" desc="设置UserNumber为null当为空串的时候">update T_PM_EASXTUSERMAP set FUserNumber = null where FUserNumber = ''</node>
  147. <node ID="setPersonNameNULL" desc="设置PersonName为null当为空串的时候">update T_PM_EASXTUSERMAP set FPersonName = null where FPersonName = ''</node>
  148. <node ID="setUserIdNULL" desc="设置UserId为null当为空串的时候">update T_PM_EASXTUSERMAP set FUserId = null where FUserId = ''</node>
  149. <node ID="getEASShangjiWithAdmin" desc="获取EAS行政组织上级,用于对比">SELECT distinct leader.FID, leader.FName_l2 leaderName, pos1.FName_l2 leaderPosition FROM T_BD_PERSON p left join t_pm_user u on p.fid = u.FPERSONID left join T_ORG_POSITIONMEMBER pm on p.FID = pm.FPERSONID left join T_ORG_POSITION pos on pm.FPOSITIONID = pos.FID left join T_ORG_POSITIONHIERARCHY ph on pm.FPOSITIONID = ph.FCHILDID left join T_ORG_POSITIONMEMBER pm1 on ph.FPARENTID = pm1.FPOSITIONID left join T_ORG_POSITION pos1 on pm1.FPOSITIONID = pos1.FID left join T_BD_PERSON leader on pm1.FPERSONID = leader.FID where pm.FPOSITIONID != pm1.FPOSITIONID and leader.FID is not null and p.FID is not null and ph.FHIERARCHYID = '00000000-0000-0000-0000-000000000001396FCAD0'</node>
  150. <node ID="getEASJianzhiWithAdmin" desc="获取EAS兼职用于对比">select distinct p.fid, u.fid, pos.FName_L2 jobTitle, case when CHARINDEX('_',org.fdisplayname_l2) > 0 then to_char(REPLACE (SUBSTRING(org.fdisplayname_l2,CHARINDEX('_',org.fdisplayname_l2)+1,length(org.fdisplayname_l2)), '_', '\\')) else to_char('\\') end orgLongName from T_ORG_PositionMember opm inner join T_ORG_Position pos on opm.FPositionID = pos.FID inner join T_BD_Person p on p.FID = opm.FPersonID inner join T_ORG_Admin org on pos.FADMINORGUNITID = org.FID left join T_PM_User u on u.FPERSONID =p.FID where opm.FIsPrimary != 1</node>
  151. <node ID="getYZJShangjiWithAdmin" desc="获取YZJ行政组织上级,用于对比">select u.FPersonName leaderName, u.FPosition leaderPosition from T_XT_PERSONRELATIONS r left join T_XT_USER u on u.FID = r.FLeaderXtId</node>
  152. <node ID="getYZJJianzhiWithAdmin" desc="获取YZJ兼职用于对比">select o.FOrgLongName orgLongName,p.FJobTitle jobTitle from T_XT_PART p left join T_XT_ORG o on p.FOrgId = o.FID</node>
  153. <node ID="getYZJEASByName" desc="获取YZJ和EAS人员按名称对比">SELECT * FROM (select 'EAS' as fromWhere,fpersonname personname,fusernumber usernumber, fxtid xtid,fcell cell, femail email, forglongname orglongname, fposition position, fpersonnumber personnumber,fweights weights from T_PM_easxtUsermap union all SELECT '云之家' as fromWhere, fpersonname personname,'无' usernumber, fid xtid,fcell cell, femail email,forglongname orglongname, fposition position, fpersonnumber personnumber,fweights weights FROM t_xt_user) allp where xtid is not null order by allp.personname asc, cell asc, email asc</node>
  154. </nodes>