Oracle脚本

pull/186/MERGE^2
dxfeng 3 years ago
parent db5ee74781
commit 1f9a5501d7

@ -11,7 +11,7 @@ union
select zd.id,zd.level_name,zj.id+1000,zd.level_no
from JCL_ORG_LEVEL zd inner join JCL_ORG_GRADE zj
on ','+zj.level_id+',' like '%,'+cast(zd.id as varchar(10))+',%'
where nvl(zd.forbidden_tag,0)<>1 and nvl(zd.delete_type,0)<>1;
where nvl(zd.forbidden_tag,0)<>1 and nvl(zd.delete_type,0)<>1
/
create or replace view v_jcl_post as
@ -19,7 +19,7 @@ select id*-1 fid,post_name fname,0 fparentid from JCL_ORG_POST
where nvl(delete_type,0)<>1
union
select id,post_info_name,post_id*-1 from JCL_ORG_POST_INFO
where nvl(forbidden_tag,0)<>1 and nvl(delete_type,0)<>1;
where nvl(forbidden_tag,0)<>1 and nvl(delete_type,0)<>1
/
CREATE OR REPLACE FUNCTION newid RETURN VARCHAR2
@ -28,12 +28,12 @@ guid VARCHAR2 (50);
BEGIN
guid := (RAWTOHEX(sys_guid()));
RETURN substr(guid,1,8)||'-'||substr(guid,9,4)||'-'||substr(guid,13,4)||'-'||substr(guid,17,4)||'-'||substr(guid,21,12);
END newid;
END newid
/
declare
orgid int;
orgid int;
cubeuuid1 varchar2(100);
appid1 int;
modename varchar2(100);

@ -2,21 +2,21 @@ insert into JCL_ORG_COMP(comp_no,comp_name_short,comp_name,parent_company,forbid
show_order,uuid,creator,delete_type,create_time)
select nvl(subcompanycode,''),subcompanyname,subcompanydesc,nvl(supsubcomid,0),
nvl(canceled,0) ,nvl(showorder,0),uuid,1,0,SYSDATE
from HrmSubCompany;
from HrmSubCompany
/
update JCL_ORG_COMP t1 set t1.parent_company=(select c.id
from HrmSubCompany a
inner join HrmSubCompany b on a.supsubcomid=b.id
inner join JCL_ORG_COMP c on b.uuid=c.uuid
where a.uuid=t1.uuid);
where a.uuid=t1.uuid)
/
insert into JCL_ORG_DEPT(dept_no, dept_name, dept_name_short,parent_comp,
show_order,forbidden_tag,creator,delete_type,create_time,uuid)
select a.departmentcode,a.departmentname,a.departmentmark,a.subcompanyid1,a.showorder,nvl(a.canceled,0),1,0,SYSDATE,uuid
from HrmDepartment a
left join HrmDepartmentDefined b on a.id=b.deptid;
left join HrmDepartmentDefined b on a.id=b.deptid
/
update JCL_ORG_DEPT t1
@ -24,7 +24,7 @@ set t1.parent_comp=(select c.id
from HrmDepartment a
inner join HrmSubCompany b on a.subcompanyid1=b.id
inner join JCL_ORG_COMP c on b.uuid=c.uuid
where t1.uuid=a.uuid);
where t1.uuid=a.uuid)
/
update JCL_ORG_dept t1
@ -32,7 +32,7 @@ set t1.parent_dept=(select c.id
from HrmDepartment a
inner join HrmDepartment b on a.supdepid=b.id
inner join JCL_ORG_dept c on b.uuid=c.uuid
where t1.uuid=a.uuid);
where t1.uuid=a.uuid)
/
insert into jcl_org_job(job_no, job_name, parent_comp, parent_dept,
@ -49,5 +49,5 @@ from (select distinct subcompanyid1,departmentid,jobtitle from HrmResource) a
on a.subcompanyid1=c.ecid
inner join
(select a.id ecid,b.id deptid from HrmDepartment a inner join JCL_ORG_DEPT b on a.uuid=b.uuid) d
on a.departmentid=d.ecid;
on a.departmentid=d.ecid
/
Loading…
Cancel
Save