点击此处观看本文视频讲解,在线互动!
客户需求:
在人员的任职记录中,人员的所属部门不能直接显示为最末级部门。要显示为当前人员部门、当前人员的上级部门、当前人员的上上级部门。大致样式为显示人员所属人力资源组织、所属一级架构、所属二级架构、所属三级架构、所属四级架构。如下:
需求分析:可以通过任职记录模板上加字段,然后通过显示公式解决。难点在于如何判断当前人员的任职部门是几级架构,判断完架构后还要查上一级架构。客户还提出人力资源组织下的行政组织与人力资源组织下的直属部门为同一架构。难度还是很高。
实现方式:
(1)先写个视图,得到每个部门的一级架构、二级架构、三级架构、四级架构
视图脚本较长,请联系QQ 1285875498 获取。部分脚本如下:
--集团本部属于一级架构的部门
select
a.code as code,
a.name as name,
a.innercode as innercode,
a.pk_org as pk_org,
a.pk_fatherorg as pk_fatherorg,
a.pk_ownorg as pk_ownorg,
a.name as yjjg,
case when 1=1 then null else null end ejjg,
case when 1=1 then null else null end sjjg,
case when 1=1 then null else null end shjjg
from(
SELECT code,name,innercode ,pk_org , pk_fatherorg,pk_ownorg from org_orgs where pk_ownorg='0001AA10000000004YZR' ORDER BY INNERcode
)a
where length(nvl(a.innercode,'0'))=4
union all
--集团本部属于二级架构的部门
selec
aa.code as code,
aa.name as name,
aa.innercode as innercode,
aa.pk_org as pk_org,
aa.pk_fatherorg as pk_fatherorg,
aa.pk_ownorg as pk_ownorg,
a.name as yjjg,
aa.name as ejjg,
case when 1=1 then null else null end sjjg,
case when 1=1 then null else null end shjjg
from(
SELECT code,name,innercode ,pk_org , pk_fatherorg,pk_ownorg from org_orgs where pk_ownorg='0001AA10000000004YZR' ORDER BY INNERcode
)aa
LEFT OUTER JOIN (
SELECT code,name,innercode ,pk_org , pk_fatherorg,pk_ownorg from org_orgs where pk_ownorg='0001AA10000000004YZR' ORDER BY INNERcode
)a on substr(aa.innercode,0,4)=a.innercode
where length(nvl(aa.innercode,'0'))=8
(2)信息集-任职记录 加几个字段 ,同步元数据、同步模板。
(3)人员信息 等模板设置显示公式