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.
67 lines
6.3 KiB
SQL
67 lines
6.3 KiB
SQL
-- 更新表结构
|
|
alter table JCL_ORG_COMP add ec_company int;
|
|
alter table JCL_ORG_DEPT add ec_company int;
|
|
alter table JCL_ORG_DEPT add ec_department int;
|
|
alter table jcl_org_staffplan add ec_company varchar(100);
|
|
alter table jcl_org_staff add ec_company int;
|
|
alter table jcl_org_staff add ec_department int;
|
|
alter table JCL_ORG_STAFFS add description varchar(200);
|
|
-- 插入自定义信息
|
|
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (1, 'JCL_ORG_COMP', 'ec_company', '上级公司', 'int', 3, 1, 1, 0, 1, 1, 1, 1, 1, 6, 1, 0, GETDATE(), NULL, '164', '["browser",{"valueSpan":"分部","replaceDatas":[{"name":"分部","id":"164"}],"value":"164"}]', 0);
|
|
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (2, 'JCL_ORG_DEPT', 'ec_company', '所属分部', 'int', 3, 2, 1, 1, 1, 1, 1, 1, 1, 4, 1, 0, GETDATE(), NULL, '164', '["browser",{"valueSpan":"分部","replaceDatas":[{"name":"分部","id":"164"}],"value":"164"}]', 0);
|
|
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (2, 'JCL_ORG_DEPT', 'ec_department', '上级部门', 'int', 3, 2, 1, 0, 1, 1, 1, 1, 1, 5, 1, 0, GETDATE(), NULL, '4', '["browser",{"valueSpan":"部门","replaceDatas":[{"name":"部门","id":"4"}],"value":"4"}]', 0);
|
|
|
|
-- 更新自定义字段信息
|
|
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_COMP' and field_name ='parent_company';
|
|
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_DEPT' and field_name ='parent_comp';
|
|
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_DEPT' and field_name ='parent_dept';
|
|
update jcl_field_extendinfo set search_show=0,edit_show=0,add_show=0 where table_name ='JCL_ORG_JOB' and field_name='ec_company';
|
|
|
|
-- 更新浏览按钮
|
|
update WORKFLOW_BROWSERURL set TYPEID ='2' where ID = '666';
|
|
update datashowparam set ISSHOWNAME =0 where SEARCHNAME = 'post_info_no';
|
|
update datashowparam set ISSHOWNAME =1 where SEARCHNAME = 'post_info_name';
|
|
|
|
-- 更新视图
|
|
drop view v_jcl_zdzj;
|
|
drop view v_jcl_post;
|
|
|
|
create view v_jcl_zdzj as
|
|
select 'A'+cast(xl.id as varchar) fid,xl.sequence_name fname,'0' fparentid,xl.sequence_no fno,xl.id fobjid,'1' as ftype
|
|
from jcl_org_sequence xl
|
|
inner join JCL_ORG_GRADE zj on zj.scheme_id=xl.scheme_id and isnull(zj.forbidden_tag,0)<>1 and isnull(zj.delete_type,0)<>1
|
|
inner join JCL_ORG_LEVEL zd on zd.scheme_id=xl.scheme_id and isnull(zd.forbidden_tag,0)<>1 and isnull(zd.delete_type,0)<>1
|
|
where isnull(xl.forbidden_tag,0)<>1 and isnull(xl.delete_type,0)<>1
|
|
union
|
|
select cast(xl.id as varchar)+'A'+cast(zj.id as varchar),zj.grade_name,'A'+cast(xl.id as varchar),zj.grade_no,zj.id,'2' as ftype
|
|
from JCL_ORG_GRADE zj
|
|
inner join jcl_org_sequence xl on zj.scheme_id=xl.scheme_id
|
|
inner join JCL_ORG_LEVEL zd on ','+cast(zj.level_id as varchar)+',' like '%,'+cast(zd.id as varchar)+',%' and isnull(zd.forbidden_tag,0)<>1 and isnull(zd.delete_type,0)<>1
|
|
where isnull(zj.forbidden_tag,0)<>1 and isnull(zj.delete_type,0)<>1
|
|
union
|
|
select cast(xl.id as varchar)+'A'+cast(zj.id as varchar)+'A'+cast(zd.id as varchar),zd.level_name,cast(xl.id as varchar)+'A'+cast(zj.id as varchar),zd.level_no,zd.id,'3' as ftype
|
|
from JCL_ORG_LEVEL zd
|
|
inner join JCL_ORG_GRADE zj on ','+cast(zj.level_id as varchar)+',' like '%,'+cast(zd.id as varchar)+',%'
|
|
inner join jcl_org_sequence xl on zj.scheme_id=xl.scheme_id
|
|
where isnull(zd.forbidden_tag,0)<>1 and isnull(zd.delete_type,0)<>1;
|
|
|
|
create view v_jcl_post as
|
|
select a.id*-1 fid,a.post_name fname,0 fparentid from JCL_ORG_POST a
|
|
inner join JCL_ORG_POST_INFO b on a.id =b.post_id and isnull(b.forbidden_tag,0)<>1 and isnull(b.delete_type,0)<>1
|
|
where isnull(a.delete_type,0)<>1
|
|
union
|
|
select id,post_info_name,post_id*-1 from JCL_ORG_POST_INFO
|
|
where isnull(forbidden_tag,0)<>1 and isnull(delete_type,0)<>1;
|
|
|
|
-- SqlServer
|
|
-- 更新分部ec_company
|
|
update jcl_org_comp set ec_company = ( select eccompany from ( select DISTINCT b.id as parent_company, c.id as eccompany from jcl_org_comp a inner join jcl_org_comp b on a.parent_company = b.id inner join hrmsubcompany c on b.uuid = c.uuid ) e where jcl_org_comp.parent_company = e.parent_company );
|
|
-- 更新部门ec_department、ec_company
|
|
update JCL_ORG_DEPT set ec_department = ( select ecdepartment from ( select DISTINCT b.id as parent_dept, c.id as ecdepartment from JCL_ORG_DEPT a inner join JCL_ORG_DEPT b on a.parent_dept = b.id inner join hrmdepartment c on b.uuid = c.uuid ) e where JCL_ORG_DEPT.parent_dept = e.parent_dept );
|
|
update JCL_ORG_DEPT set ec_company = ( select eccompany from ( select a.id as id, c.id as eccompany from jcl_org_comp a inner join hrmsubcompany c on a.uuid = c.uuid) e where JCL_ORG_DEPT.parent_comp = e.id );
|
|
-- 更新人员jobtitle
|
|
update hrmresource set jobtitle = ( select top 1 id from HRMJOBTITLES where JOBTITLENAME = ( select JOB_NAME from jcl_org_job where id = ( select FIELD100002 from CUS_FIELDDATA where scope = 'HrmCustomFieldByInfoType' and SCOPEID = '-1' and CUS_FIELDDATA.ID = hrmresource.ID)));
|
|
-- 更新岗位ec_company、ec_department
|
|
update jcl_org_job set ec_company = (select eccompany from ( select a.id as id, c.id as eccompany from jcl_org_comp a inner join hrmsubcompany c on a.uuid = c.uuid) e where jcl_org_job.parent_comp = e.id );
|
|
update jcl_org_job set ec_department = ( select ec_department from ( select a.id as id, c.id as ec_department from jcl_org_dept a inner join hrmdepartment c on a.uuid = c.uuid) e where jcl_org_job.parent_dept = e.id );
|