CREATE TABLE JCL_ORG_ITEMCLASS (
    FID NUMBER NOT NULL,
    FNO NVARCHAR2(50) NOT NULL,
    FNAME NVARCHAR2 (50) NOT NULL,
    FMEMO NVARCHAR2 (255) NULL ,
    CREATOR NUMBER NULL,
    CREATE_TIME DATE NULL,
    UPDATE_TIME DATE NULL,
    CONSTRAINT JCL_ORG_ITEMCLASS_PK PRIMARY KEY (FID)
)
/

CREATE SEQUENCE JCL_ORG_ITEMCLASS_ID INCREMENT BY 1 START WITH 1 nomaxvalue minvalue 1 NOCYCLE
/
CREATE
OR REPLACE TRIGGER JCL_ORG_ITEMCLASS_ID_TIGGER BEFORE INSERT ON JCL_ORG_ITEMCLASS FOR EACH ROW
BEGIN
SELECT
    JCL_ORG_ITEMCLASS_ID.nextval INTO:new.FID
FROM
    dual;
END;
/


CREATE TABLE JCL_ORG_ITEM (
    FID NUMBER NOT NULL,
    FCLASSID NUMBER NOT NULL,
    FNO NVARCHAR2(50) NOT NULL,
    FNAME NVARCHAR2 (255) NOT NULL,
    FMEMO NVARCHAR2 (255) NULL,
    FDELETE NUMBER NOT NULL,
    CREATOR NUMBER NULL,
    CREATE_TIME DATE NULL,
    UPDATE_TIME DATE NULL,
    CONSTRAINT JCL_ORG_ITEM_PK PRIMARY KEY (FID)
)
/

CREATE SEQUENCE JCL_ORG_ITEM_ID INCREMENT BY 1 START WITH 1 nomaxvalue minvalue 1 NOCYCLE
/
CREATE
OR REPLACE TRIGGER JCL_ORG_ITEM_ID_TIGGER BEFORE INSERT ON JCL_ORG_ITEM FOR EACH ROW
BEGIN
SELECT
    JCL_ORG_ITEM_ID.nextval INTO:new.FID
FROM
    dual;
END;
/

delete from jcl_org_job where id not in (select max(id) from jcl_org_job group by parent_comp ,parent_dept,parent_job,job_name)
/
delete from jcl_field_extendinfo where extend_type =4
/

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(4, 'JCL_ORG_HRMRESOURCE', 'work_code', '编号', 'varchar(60)', 1, 4, 1, 0, 1, NULL, 1, 1, 1, 1, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'last_name', '姓名', 'varchar(60)', 1, 4, 1, 1, 1, NULL, 1, 1, 1, 2, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'sex', '性别', 'int', 5, 4, 1, 1, 1, NULL, 1, 1, 1, 3, 1, 0, SYSDATE, SYSDATE, '1', '["select","select",{"datas":[{"default":"","unuse":"","id":"0","key":"0","option":"男"},{"default":"","unuse":"","id":"1","key":"1","option":"女"}],"sort":"horizontal"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'status', '状态', 'int', 5, 4, 1, 1, 1, NULL, 1, 1, 1, 4, 1, 0, SYSDATE, SYSDATE, '1', '["select","select",{"datas":[{"default":"","unuse":"","id":"0","key":"0","option":"试用"},{"default":"","unuse":"","id":"1","key":"1","option":"正式"},{"default":"","unuse":"","id":"2","key":"2","option":"临时"},{"default":"","unuse":"","id":"3","key":"3","option":"试用延期"},{"default":"","unuse":"","id":"4","key":"4","option":"解聘"},{"default":"","unuse":"","id":"5","key":"5","option":"离职"},{"default":"","unuse":"","id":"6","key":"6","option":"退休"},{"default":"","unuse":"","id":"7","key":"7","option":"无效"},{"default":"","unuse":"","id":"8","key":"8","option":"在职"}],"sort":"horizontal"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'account_type', '账号类型', 'int', 5, 4, 1, 1, 1, NULL, 1, 1, 1, 5, 1, 0, SYSDATE, SYSDATE, '1', '["select","select",{"datas":[{"default":"","unuse":"","id":"0","key":"0","option":"主账号"},{"default":"","unuse":"","id":"1","key":"1","option":"次账号"}],"sort":"horizontal"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'belong_to', '主账号', 'int', 3, 4, 1, 0, 1, NULL, 1, 1, 1, 6, 1, 0, SYSDATE, SYSDATE, '1', '["browser",{"valueSpan":"人力资源","replaceDatas":[{"name":"人力资源","id":"1"}],"value":"1"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'ec_company', '所属分部', 'int', 3, 4, 1, 1, 1, NULL, 0, 0, 1, 7, 1, 0, SYSDATE, SYSDATE, '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(4, 'JCL_ORG_HRMRESOURCE', 'job_title', '岗位', 'int', 3, 4, 1, 1, 1, NULL, 1, 1, 1, 8, 1, 0, SYSDATE, SYSDATE, '666', '["browser",{"valueSpan":"聚才林岗位","replaceDatas":[{"name":"聚才林岗位","id":"666"}],"value":"666"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'ec_department', '所属部门', 'int', 3, 4, 1, 1, 1, NULL, 0, 0, 1, 9, 1, 0, SYSDATE, SYSDATE, '4', '["browser",{"valueSpan":"部门","replaceDatas":[{"name":"部门","id":"4"}],"value":"4"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'scheme_id', '等级方案', 'text', 3, 4, 1, 0, 1, NULL, 0, 0, 1, 10, 1, 0, SYSDATE, SYSDATE, '161', '["browser",{"valueSpan":"自定义单选","replaceDatas":[{"name":"自定义单选","id":"161"}],"value":"161"},{"valueSpan":"等级方案浏览按钮","value":"schemeBrowser"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'sequence_id', '岗位序列', 'text', 3, 4, 1, 0, 1, NULL, 0, 0, 1, 11, 1, 0, SYSDATE, SYSDATE, '161', '["browser",{"valueSpan":"自定义单选","replaceDatas":[{"name":"自定义单选","id":"161"}],"value":"161"},{"valueSpan":"岗位序列","value":"sequenceBrowser"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'job_grade', '职级', 'text', 3, 4, 1, 0, 1, NULL, 0, 0, 1, 12, 1, 0, SYSDATE, SYSDATE, '161', '["browser",{"valueSpan":"自定义单选","replaceDatas":[{"name":"自定义单选","id":"161"}],"value":"161"},{"valueSpan":"职级浏览按钮","value":"gradeBrowser"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'job_level', '职等', 'int', 3, 4, 1, 0, 1, NULL, 0, 0, 1, 13, 1, 0, SYSDATE, SYSDATE, '161', '["browser",{"valueSpan":"自定义单选","replaceDatas":[{"name":"自定义单选","id":"161"}],"value":"161"},{"valueSpan":"职等浏览按钮","value":"LevelBrowser"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'job_group_id', '职务类别', 'int', 3, 4, 1, 1, 1, NULL, 1, 1, 1, 14, 1, 0, SYSDATE, SYSDATE, '161', '["browser",{"valueSpan":"自定义单选","replaceDatas":[{"name":"自定义单选","id":"161"}],"value":"161"},{"valueSpan":"职务分类浏览按钮","value":"postBrowser"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'job_activity', '职务', 'int', 3, 4, 1, 1, 1, NULL, 1, 1, 1, 15, 1, 0, SYSDATE, SYSDATE, '161', '["browser",{"valueSpan":"自定义单选","replaceDatas":[{"name":"自定义单选","id":"161"}],"value":"161"},{"valueSpan":"职务信息浏览按钮","value":"PostInfoBrowser"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'location_id', '办公地点', 'int', 3, 4, 1, 1, 1, NULL, 1, 1, 1, 16, 1, 0, SYSDATE, SYSDATE, '262', '["browser",{"valueSpan":"办公地点","replaceDatas":[{"name":"办公地点","id":"262"}],"value":"262"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'show_order', '显示顺序', 'int', 1, 4, 1, 0, 1, NULL, 1, 1, 1, 17, 1, 0, SYSDATE, SYSDATE, '2', '["input","int"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'company_start_date', '入职日期', 'char(10)', 3, 4, 1, 0, 1, NULL, 1, 1, 1, 18, 1, 0, SYSDATE, SYSDATE, '2', '["browser",{"valueSpan":"日期","replaceDatas":[{"name":"日期","id":"2"}],"value":"2"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'work_start_date', '参加工作日期', 'char(10)', 3, 4, 1, 0, 1, NULL, 1, 1, 1, 19, 1, 0, SYSDATE, SYSDATE, '2', '["browser",{"valueSpan":"日期","replaceDatas":[{"name":"日期","id":"2"}],"value":"2"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'job_activity_desc', '职责描述', 'varchar(200)', 1, 4, 1, 0, 1, NULL, 1, 1, 1, 20, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","200"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'resource_image_id', '照片', 'varchar(1000)', 6, 4, 1, 0, 0, NULL, 1, 1, 1, 21, 1, 0, SYSDATE, SYSDATE, '1', '["upload","file"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'department_id', '所属部门', 'int', 3, 4, 1, 1, 0, NULL, 0, 0, 1, 22, 1, 0, SYSDATE, SYSDATE, '161', '["browser",{"valueSpan":"自定义单选","replaceDatas":[{"name":"自定义单选","id":"161"}],"value":"161"},{"valueSpan":"部门浏览按钮","value":"deptBrowser"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'login_id', '登录名', 'varchar(60)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 23, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'job_call', '职称', 'int', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 24, 1, 0, SYSDATE, SYSDATE, '260', '["browser",{"valueSpan":"职称","replaceDatas":[{"name":"职称","id":"260"}],"value":"260"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'system_language', '系统语言', 'int', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 25, 1, 0, SYSDATE, SYSDATE, '259', '["browser",{"valueSpan":"语言","replaceDatas":[{"name":"语言","id":"259"}],"value":"259"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'messager_url', '头像', 'varchar(1000)', 6, 4, 0, 0, 0, NULL, 1, 1, 1, 26, 1, 0, SYSDATE, SYSDATE, '1', '["upload","file"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'company_id', '所属分部', 'int', 3, 4, 1, 1, 0, NULL, 0, 0, 1, 27, 1, 0, SYSDATE, SYSDATE, '161', '["browser",{"valueSpan":"自定义单选","replaceDatas":[{"name":"自定义单选","id":"161"}],"value":"161"},{"valueSpan":"公司分部浏览按钮","value":"compBrowser"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'pass_word', '密码', 'varchar(100)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 28, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","100"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'sec_level', '安全级别', 'int', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 29, 1, 0, SYSDATE, SYSDATE, '2', '["input","int"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'birthday', '出生日期', 'char(10)', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 30, 1, 0, SYSDATE, SYSDATE, '2', '["browser",{"valueSpan":"日期","replaceDatas":[{"name":"日期","id":"2"}],"value":"2"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'folk', '民族', 'varchar(30)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 31, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","30"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'native_place', '籍贯', 'varchar(100)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 32, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","100"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'reg_resident_place', '户口', 'varchar(200)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 33, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","200"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'certificate_num', '身份证号码', 'varchar(60)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 34, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'marital_status', '婚姻状况', 'int', 5, 4, 0, 0, 1, NULL, 1, 1, 1, 35, 1, 0, SYSDATE, SYSDATE, '1', '["select","select",{"datas":[{"default":"","unuse":"","id":"0","key":"0","option":"未婚"},{"default":"","unuse":"","id":"1","key":"1","option":"已婚"},{"default":"","unuse":"","id":"2","key":"2","option":"离异"}],"sort":"horizontal"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'policy', '政治面貌', 'varchar(30)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 36, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","30"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'be_member_date', '入团日期', 'char(10)', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 37, 1, 0, SYSDATE, SYSDATE, '2', '["browser",{"valueSpan":"日期","replaceDatas":[{"name":"日期","id":"2"}],"value":"2"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'start_date', '合同开始日期', 'char(10)', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 38, 1, 0, SYSDATE, SYSDATE, '2', '["browser",{"valueSpan":"日期","replaceDatas":[{"name":"日期","id":"2"}],"value":"2"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'be_party_date', '入党日期', 'char(10)', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 39, 1, 0, SYSDATE, SYSDATE, '2', '["browser",{"valueSpan":"日期","replaceDatas":[{"name":"日期","id":"2"}],"value":"2"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'islabouunion', '工会会员', 'int', 5, 4, 0, 0, 1, NULL, 1, 1, 1, 40, 1, 0, SYSDATE, SYSDATE, '1', '["select","select",{"datas":[{"default":"","unuse":"","id":"0","key":"0","option":"是"},{"default":"","unuse":"","id":"1","key":"1","option":"否"}],"sort":"horizontal"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'education_level', '学历', 'int', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 41, 1, 0, SYSDATE, SYSDATE, '30', '["browser",{"valueSpan":"学历","replaceDatas":[{"name":"学历","id":"30"}],"value":"30"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'degree', '学位', 'varchar(30)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 42, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","30"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'health_info', '健康状况', 'int', 5, 4, 0, 0, 1, NULL, 1, 1, 1, 43, 1, 0, SYSDATE, SYSDATE, '1', '["select","select",{"datas":[{"default":"","unuse":"","id":"0","key":"0","option":"优秀"},{"default":"","unuse":"","id":"1","key":"1","option":"良好"},{"default":"","unuse":"","id":"2","key":"2","option":"一般"},{"default":"","unuse":"","id":"3","key":"3","option":"较差"}],"sort":"horizontal"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'height', '身高', 'int', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 44, 1, 0, SYSDATE, SYSDATE, '2', '["input","int"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'weight', '体重', 'int', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 45, 1, 0, SYSDATE, SYSDATE, '2', '["input","int"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'use_kind', '用工性质', 'int', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 46, 1, 0, SYSDATE, SYSDATE, '31', '["browser",{"valueSpan":"用工性质","replaceDatas":[{"name":"用工性质","id":"31"}],"value":"31"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'end_date', '合同结束日期', 'char(10)', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 47, 1, 0, SYSDATE, SYSDATE, '2', '["browser",{"valueSpan":"日期","replaceDatas":[{"name":"日期","id":"2"}],"value":"2"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'probation_end_date', '试用期结束日期', 'char(10)', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 48, 1, 0, SYSDATE, SYSDATE, '2', '["browser",{"valueSpan":"日期","replaceDatas":[{"name":"日期","id":"2"}],"value":"2"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'resident_place', '现居住地', 'varchar(200)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 49, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","200"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'home_address', '家庭联系方式', 'varchar(100)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 50, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","100"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'temp_resident_number', '暂住证号码', 'varchar(60)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 51, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'accum_fund_account', '公积金帐户', 'varchar(30)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 52, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","30"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'account_name', '工资账号户名', 'varchar(200)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 53, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","200"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'bank_id', '工资银行', 'varchar(400)', 3, 4, 0, 0, 1, NULL, 1, 1, 1, 54, 1, 0, SYSDATE, SYSDATE, '284', '["browser",{"valueSpan":"工资银行","replaceDatas":[{"name":"工资银行","id":"284"}],"value":"284"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'account_id', '工资账号', 'varchar(100)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 55, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","100"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'classification', '人员密级', 'int', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 56, 1, 0, SYSDATE, SYSDATE, '2', '["input","int"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'work_year', '工龄', 'decimal(15,2)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 57, 1, 0, SYSDATE, SYSDATE, '3', '["input","float"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'company_work_year', '司龄', 'decimal(15,2)', 1, 4, 0, 0, 1, NULL, 1, 1, 1, 58, 1, 0, SYSDATE, SYSDATE, '3', '["input","float"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'manager_id', '直接上级', 'int', 3, 7, 0, 0, 1, NULL, 1, 1, 1, 1, 1, 0, SYSDATE, SYSDATE, '1', '["browser",{"valueSpan":"人力资源","replaceDatas":[{"name":"人力资源","id":"1"}],"value":"1"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'assistant_id', '助理', 'int', 3, 7, 0, 0, 1, NULL, 1, 1, 1, 2, 1, 0, SYSDATE, SYSDATE, '1', '["browser",{"valueSpan":"人力资源","replaceDatas":[{"name":"人力资源","id":"1"}],"value":"1"}]', 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(4, 'JCL_ORG_HRMRESOURCE', 'mobile', '移动电话', 'varchar(60)', 1, 8, 1, 1, 1, NULL, 1, 1, 1, 1, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'telephone', '办公室电话', 'varchar(60)', 1, 8, 1, 0, 1, NULL, 1, 1, 1, 2, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'mobile_call', '其他电话', 'varchar(60)', 1, 8, 0, 0, 1, NULL, 1, 1, 1, 3, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'fax', '传真', 'varchar(60)', 1, 8, 0, 0, 1, NULL, 1, 1, 1, 4, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'email', '电子邮件', 'varchar(60)', 1, 8, 1, 1, 1, NULL, 1, 1, 1, 5, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCE', 'workroom', '办公室', 'varchar(60)', 1, 8, 0, 0, 1, NULL, 1, 1, 1, 6, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 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(4, 'JCL_ORG_HRMRESOURCEEXT', 'field257', '32133', 'varchar(60)', 1, 23, 1, 0, 1, NULL, 1, 1, 1, 1, 1, 0, SYSDATE, SYSDATE, '1', '["input","text","60"]', 1)
/

alter table JCL_ORG_HRMRESOURCE add  ec_department int
/
alter table JCL_ORG_HRMRESOURCE add ec_company int
/
alter table JCL_ORG_HRMRESOURCE add uuid varchar(50)
/
alter table JCL_ORG_HRMRESOURCE add job_grade varchar(50)
/
alter table JCL_ORG_HRMRESOURCE add scheme_id varchar(50)
/
alter table JCL_ORG_HRMRESOURCE add sequence_id varchar(50)
/
ALTER TABLE JCL_ORG_HRMRESOURCE MODIFY JOB_LEVEL NVARCHAR2(60)
/



insert into jcl_org_hrmresource (work_code, last_name, sex, status, account_type, belong_to, job_title, job_level, location_id, show_order, ec_company, company_id, ec_department, department_id, company_start_date, work_start_date, job_activity_desc, resource_image_id, mobile, telephone, email, uuid, delete_type) select a.workcode , a.lastname , a.sex , a.status , a.accounttype , a.belongto , c.id, c.grade_id, a.locationid , a.dsporder , a.subcompanyid1 , c.parent_comp, a.departmentid , c.parent_dept, a.companystartdate , a.workstartdate , a.jobactivitydesc , a.resourceimageid, a.mobile , a.telephone , a.email, a.uuid, 0 from hrmresource a inner join hrmjobtitles b on a.jobtitle = b.id inner join ( select * from jcl_org_job ) c on a.subcompanyid1 = c.ec_company and a.departmentid = c.ec_department and b.jobtitlename = c.job_name
/

delete from jcl_org_map
/

insert into jcl_org_map
(id,ftype,fobjid,fecid,uuid,fclass,fclassname,fnumber,fname,fleader,fleaderimg,
 fleadername,fleaderjobid,fleaderjob,fleaderlv,fleaderst,fparentid,fobjparentid,
 fplan,fonjob,fisvitual,fdatebegin,fdateend)
select 0,0,0,1,uuid,0,'行政维度','00',companyname,0,'','',0,'','','',-1,0,0,0,0,to_date(sysdate),to_date('2099-12-31','yyyy-mm-dd') from HrmCompany
/

insert into  jcl_org_map
(id,ftype,fobjid,fecid,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,b.id,a.uuid,0,'行政维度',a.comp_no,a.comp_name,a.comp_principal,c.messagerurl,
       c.lastname,c.jobtitle,d.jobtitlemark,g.job_level,g.job_grade,nvl(parent_company,0),nvl(parent_company,0),
       nvl(e.fcnt,0),nvl(f.fcnt,0),0,to_date(sysdate),to_date('2099-12-31','yyyy-mm-dd')
from
    JCL_ORG_comp a
        left join HrmSubCompany b on a.uuid=b.uuid
        left join hrmresource c on a.comp_principal=c.id
        left join hrmjobtitles d on c.jobtitle=d.id
        left join (select comp_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(sysdate) and time_end>to_date(sysdate))
                   group by comp_id) e on a.id=e.comp_id
        left join (select subcompanyid1,count(1) fcnt from hrmresource where status<=3 group by subcompanyid1) f
                  on f.subcompanyid1=b.id
        left join jcl_org_hrmresource g ON c.uuid = g.uuid
where nvl(a.delete_type,0) <>1 and nvl(a.forbidden_tag,0) <>1
/

insert into  jcl_org_map
(id,ftype,fobjid,fecid,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,b.id,a.uuid,0,'行政维度',a.dept_no,a.dept_name,a.dept_principal,c.messagerurl,
       c.lastname,c.jobtitle,d.jobtitlemark,g.job_level,g.job_grade,
       (case nvl(parent_dept,0) when 0 then parent_comp else parent_dept+100000000 end),
       (case nvl(parent_dept,0) when 0 then parent_comp else parent_dept end),
       nvl(e.fcnt,0),nvl(f.fcnt,0),0,to_date(sysdate),to_date('2099-12-31','yyyy-mm-dd')
from
    JCL_ORG_dept a
        left join HrmDepartment b on a.uuid=b.uuid
        left join hrmresource c on a.dept_principal=c.id
        left join hrmjobtitles d on c.jobtitle=d.id
        left join (select dept_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(sysdate) and time_end>to_date(sysdate))
                   group by dept_id) e on a.id=e.dept_id
        left join (select departmentid,count(1) fcnt from hrmresource where status<=3 group by departmentid) f on f.departmentid=b.id
        left join jcl_org_hrmresource g ON c.uuid = g.uuid
where nvl(a.delete_type,0) <>1 and nvl(a.forbidden_tag,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,'行政维度',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(sysdate),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(sysdate) and time_end>to_date(sysdate))
                    group by job_id) e on a.id=e.job_id
         left join (select d.id,b.jobtitlename,count(1) fcnt
                    from hrmresource a
                             inner join HrmJobTitles b on a.jobtitle=b.id
                             inner join hrmdepartment c on a.departmentid=c.id
                             inner join jcl_org_dept d on a.uuid=b.uuid
                    group by d.id,b.jobtitlename) f
                   on f.id=a.parent_dept and a.job_name=f.jobtitlename
where nvl(a.delete_type,0) <>1 and nvl(a.forbidden_tag,0) <>1
/

insert into  jcl_org_map
(id,ftype,fobjid,fecid,uuid,fclass,fclassname,fnumber,fname,fleaderimg,
 fleaderjobid,fleaderjob,fleaderlv,fleaderst,fparentid,fobjparentid,
 fisvitual,fdatebegin,fdateend)
select a.id+300000000,4,a.id,c.id,a.uuid,0,'行政维度',a.work_code,a.last_name,c.messagerurl,b.id ,
       b.job_name,a.job_level,a.job_grade,
       to_number(nvl(b.id,''))+200000000,
       to_number(nvl(b.id,'')),
       0,to_date(sysdate),to_date('2099-12-31','yyyy-mm-dd')
from jcl_org_hrmresource a
         left join jcl_org_job b ON a.job_title = b.id
         left join hrmresource c on a.uuid = c.uuid
where a.status<4
/