You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
weaver-hrm-organization/docs/sqlupgrade/GS/sql202212120503.sql

78 lines
3.7 KiB
MySQL

2 years ago
delete from jcl_org_cardaccess;
/
insert into jcl_org_cardaccess (type_id, type_name, status, all_people , superior , all_superior ,
delete_type, creator, create_time, update_time) select ID,
FORMLABEL , 1, 0, 0, 0, 0, 1, SYSDATE,
SYSDATE from cus_treeform where scope='HrmCustomFieldByInfoType';
/
update jcl_org_cardbutton set name = '<EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD>Ϣ', url = '/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo/${id}' where id = 1;
/
delete from jcl_org_map;
/
INSERT INTO jcl_org_map ( id, ftype, fobjid, uuid,fclass, fclassname, fnumber, fname,
fleader, fleaderimg, fleadername, fleaderjobid, fleaderjob, fparentid,fobjparentid,
fplan, fonjob, fisvitual, fdatebegin, fdateend)
SELECT 0, 0, 0, uuid, 0, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD>', '00', companyname,
0, NULL, NULL, 0, NULL, -1, 0,
0, 0, 0, TO_DATE(to_char(SYSDATE,'yyyy-MM-dd'),'yyyy-MM-dd'), TO_DATE('2099-12-31','yyyy-MM-dd') FROM hrmcompany;
/
insert into jcl_org_map
(id,ftype,fobjid,uuid,fclass,fclassname,fnumber,fname,fleader,fleaderimg,
fleadername,fleaderjobid,fleaderjob,fleaderlv,fleaderst,fparentid,fobjparentid,
fplan,fonjob,fisvitual,fdatebegin,fdateend)
select a.id,1,a.id,a.uuid,0,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD>', '',a.subcompanyname,null,'',
'',NULL,'','','',nvl(a.supsubcomid,0),nvl(a.supsubcomid,0),
0,0,0,TO_DATE(to_char(SYSDATE,'yyyy-MM-dd'),'yyyy-MM-dd'), TO_DATE('2099-12-31','yyyy-MM-dd') from hrmsubcompany a
where nvl(a.canceled,0) <>1;
/
insert into jcl_org_map
(id,ftype,fobjid,uuid,fclass,fclassname,fnumber,fname,fleader,fleaderimg,
fleadername,fleaderjobid,fleaderjob,fleaderlv,fleaderst,fparentid,fobjparentid,
fplan,fonjob,fisvitual,fdatebegin,fdateend)
select a.id+100000000,2,a.id,a.uuid,0,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD>',a.DEPARTMENTCODE,a.departmentname,a.BMFZR,b.messagerurl,
b.lastname,b.jobtitle,c.jobtitlemark,null,null,
(case nvl(a.supdepid,0) when 0 then a.subcompanyid1 else a.supdepid+100000000 end),
(case nvl(a.supdepid,0) when 0 then a.subcompanyid1 else a.supdepid end),
0,0,0,TO_DATE(to_char(SYSDATE,'yyyy-MM-dd'),'yyyy-MM-dd'), TO_DATE('2099-12-31','yyyy-MM-dd')
from
HrmDepartment a
left join hrmresource b on a.BMFZR=b.ID
left join hrmjobtitles c on b.JOBTITLE=c.id
where nvl(a.canceled,0) <>1;
/
insert into jcl_org_map
(id,ftype,fobjid,fclass,fclassname,fnumber,fname,
fparentid,fobjparentid,
fplan,fonjob,fisvitual,fdatebegin,fdateend)
select a.id+200000000,3,a.id,0,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD>',a.job_no,a.job_name,
(case nvl(parent_job,0) when 0 then parent_dept+100000000 else parent_job+200000000 end),
(case nvl(parent_job,0) when 0 then parent_dept else parent_job end),
nvl(e.fcnt,0),nvl(f.fcnt,0),0,TO_DATE(to_char(SYSDATE,'yyyy-MM-dd'),'yyyy-MM-dd'), TO_DATE('2099-12-31','yyyy-MM-dd')
from JCL_ORG_job a
left join (select job_id,sum(nvl(staff_num,0)) fcnt from JCL_ORG_STAFF
where plan_id in (select id from JCL_ORG_STAFFPLAN
where time_start<=TO_DATE(to_char(SYSDATE,'yyyy-MM-dd'),'yyyy-MM-dd') and time_end>TO_DATE(to_char(SYSDATE,'yyyy-MM-dd'),'yyyy-MM-dd'))
group by job_id) e on a.id=e.job_id
left join (select jobtitle,count(1) fcnt from hrmresource group by jobtitle) f
on f.JOBTITLE=a.id
where nvl(a.delete_type,0) <>1 and nvl(a.forbidden_tag,0) <>1;
/
insert into jcl_org_map
(id,ftype,fobjid,uuid,fclass,fclassname,fnumber,fname,fleaderimg,
fleaderjobid,fleaderjob,fleaderlv,fleaderst,fparentid,fobjparentid,
fisvitual,fdatebegin,fdateend)
select a.id+300000000,4,a.id,a.uuid,0,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD>',a.workcode,a.LASTNAME,a.messagerurl,
b.id,b.job_name,null,null, nvl( b.id, '' ) +200000000,b.id,
0,TO_DATE(to_char(SYSDATE,'yyyy-MM-dd'),'yyyy-MM-dd'), TO_DATE('2099-12-31','yyyy-MM-dd')
from hrmresource a
left join jcl_org_job b ON a.JOBTITLE = b.id
where a.status<4;
/