-- JCL_ORG_SCHEME
CREATE TABLE JCL_ORG_SCHEME (
    id int IDENTITY(1,1) NOT NULL,
    scheme_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    scheme_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    scheme_description text COLLATE Chinese_PRC_CI_AS NULL,
    forbidden_tag int NULL,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_SCHEME_PK PRIMARY KEY (id)
);
-- JCL_ORG_LEVEL
CREATE TABLE JCL_ORG_LEVEL (
    id int IDENTITY(1,1) NOT NULL,
    level_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    level_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    description text COLLATE Chinese_PRC_CI_AS NULL,
    scheme_id int null,
    forbidden_tag int NULL,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_LEVEL_PK PRIMARY KEY (id)
);
-- JCL_ORG_GRADE
CREATE TABLE JCL_ORG_GRADE (
    id int IDENTITY(1,1) NOT NULL,
    grade_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    grade_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    description text COLLATE Chinese_PRC_CI_AS NULL,
    scheme_id int null,
    level_id varchar(100) null,
    forbidden_tag int NULL,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_GRADE_PK PRIMARY KEY (id)
);

-- JCL_ORG_SEQUENCE
CREATE TABLE JCL_ORG_SEQUENCE (
    id int IDENTITY(1,1) NOT NULL,
    sequence_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    sequence_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    description text COLLATE Chinese_PRC_CI_AS NULL,
    scheme_id int null,
    forbidden_tag int NULL,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_SEQUENCE_PK PRIMARY KEY (id)
);

-- JCL_ORG_POST
CREATE TABLE JCL_ORG_POST (
    id int IDENTITY(1,1) NOT NULL,
    post_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    post_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    description text COLLATE Chinese_PRC_CI_AS NULL,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_POST_PK PRIMARY KEY (id)
);

-- JCL_ORG_POST_INFO
CREATE TABLE JCL_ORG_POST_INFO (
    id int IDENTITY(1,1) NOT NULL,
    post_info_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    post_info_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    post_info_authority text null,
    post_info_duty text null,
    post_info_qualification text null,
    post_id int null,
    description text COLLATE Chinese_PRC_CI_AS NULL,
    forbidden_tag int NULL,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_POST_INFO_PK PRIMARY KEY (id)
);

-- JCL_ORG_COMP
CREATE TABLE JCL_ORG_COMP (
    id int IDENTITY(1,1) NOT NULL,
    comp_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    comp_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    comp_name_short varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    parent_company int null,
    org_code varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    industry int null,
    comp_principal int null,
    description text COLLATE Chinese_PRC_CI_AS NULL,
    forbidden_tag int NULL,
    show_order int null,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    uuid varchar(100) null,
    CONSTRAINT JCL_ORG_COMP_PK PRIMARY KEY (id)
);

-- JCL_FIELD_EXTENDGROUP
CREATE TABLE JCL_FIELD_EXTENDGROUP (
    id int IDENTITY(1,1) NOT NULL,
    pid int null,
    extend_type int null,
    group_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    show_order int null,
    is_show varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    is_system_default int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_FIELD_EXTENDGROUP_PK PRIMARY KEY (id)
);

-- JCL_FIELD_EXTENDTITLE
create table JCL_FIELD_EXTENDTITLE (
    id int IDENTITY(1,1) NOT NULL,
    group_id int null,
    title varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    show_order int null,
    is_show int null,
    is_system_default int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_FIELD_EXTENDTITLE_PK PRIMARY KEY (id)
);

-- JCL_FIELD_EXTENDINFO
CREATE TABLE JCL_FIELD_EXTENDINFO (
    id int IDENTITY(1,1) NOT NULL,
    extend_type int null,
    table_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    field_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    field_name_desc varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    field_type varchar(1000) COLLATE Chinese_PRC_CI_AS NULL,
    control_type int null,
    custom_value text null,
    browser_type varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    extend_group_id int null,
    isenable int null,
    isrequired int null,
    list_show int null,
    search_show int null,
    edit_show int null,
    add_show int null,
    browser_show int null,
    show_order int null,
    is_system_default int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_FIELD_EXTENDINFO_PK PRIMARY KEY (id)
);

-- JCL_ORG_COMPEXT
CREATE TABLE JCL_ORG_COMPEXT (
    id int NOT NULL,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_COMPEXT_PK PRIMARY KEY (id)
);

-- JCL_ORG_COMPEXT_DT1
CREATE TABLE JCL_ORG_COMPEXT_DT1 (
    id int IDENTITY(1,1) NOT NULL,
    mainid int NULL,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_COMPEXT_DT1_PK PRIMARY KEY (id)
);

-- JCL_ORG_DEPT
CREATE TABLE JCL_ORG_DEPT (
    id int IDENTITY(1,1) NOT NULL,
    dept_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    dept_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    dept_name_short varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    parent_comp int null,
    parent_dept int null,
    dept_principal int null,
    show_order int null,
    description text COLLATE Chinese_PRC_CI_AS NULL,
    forbidden_tag int NULL,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    uuid varchar(100) null,
    CONSTRAINT JCL_ORG_DEPT_PK PRIMARY KEY (id)
);

-- JCL_ORG_DEPTEXT
CREATE TABLE JCL_ORG_DEPTEXT (
    id int NOT NULL,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_DEPTEXT_PK PRIMARY KEY (id)
);

-- JCL_ORG_DEPTEXT_DT1
CREATE TABLE JCL_ORG_DEPTEXT_DT1 (
    id int IDENTITY(1,1) NOT NULL,
    mainid int NULL,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_DEPTEXT_DT1_PK PRIMARY KEY (id)
);

-- JCL_ORG_JOB
CREATE TABLE JCL_ORG_JOB (
    id int IDENTITY(1,1) NOT NULL,
    job_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    job_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    parent_comp int null,
    ec_company int null,
    parent_dept int null,
    ec_department int null,
    sequence_id int null,
    scheme_id int null,
    parent_job int null,
    is_key int null,
    workplace varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    description text null,
    work_duty text null,
    work_authority text null,
    forbidden_tag int NULL,
    show_order int null,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_JOB_PK PRIMARY KEY (id)
);

-- JCL_ORG_JOBDT
CREATE TABLE JCL_ORG_JOBDT (
    id int IDENTITY(1,1) NOT NULL,
    mainid int NULL,
    level_id varchar(100) NULL,
    grade_id varchar(100) NULL,
    level_id_span varchar(1000) NULL,
    grade_id_span varchar(1000) NULL,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_JOBDT_PK PRIMARY KEY (id)
);

-- JCL_ORG_JOBEXT
CREATE TABLE JCL_ORG_JOBEXT (
    id int NOT NULL,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_JOBEXT_PK PRIMARY KEY (id)
);

-- JCL_ORG_JOBEXT_DT1
CREATE TABLE JCL_ORG_JOBEXT_DT1 (
    id int IDENTITY(1,1) NOT NULL,
    mainid int NULL,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_JOBEXT_DT1_PK PRIMARY KEY (id)
);

-- JCL_ORG_HRMRESOURCE
CREATE TABLE JCL_ORG_HRMRESOURCE (
    id int IDENTITY(1,1) NOT NULL,
    work_code varchar(60) null,
    login_id varchar(60) null,
    last_name varchar(60) null,
    sex int null,
    account_type int null,
    belong_to int null,
    company_id int null,
    department_id int null,
    job_activity int null,
    job_title int null,
    job_call int null,
    job_level int null,
    job_group_id int null,
    job_activity_desc varchar(200) null,
    status int null,
    system_language int null,
    resource_image_id varchar(1000) null,
    messager_url varchar(1000) null,
    location_id int null,
    manager_id int null,
    assistant_id int null,
    mobile varchar(60) null,
    telephone varchar(60) null,
    mobile_call varchar(60) null,
    fax varchar(60) null,
    email varchar(60) null,
    workroom varchar(60) null,
    pass_word varchar(100) null,
    sec_level int null,
    birthday char(10) null,
    folk varchar(30) null,
    native_place varchar(100) null,
    reg_resident_place varchar(200) null,
    certificate_num varchar(60) null,
    marital_status char(1) null,
    policy varchar(30) null,
    be_member_date char(10) null,
    be_party_date char(10) null,
    islabouunion char(1) null,
    degree varchar(30) null,
    health_info char(1) null,
    education_level int null,
    height varchar(10) null,
    weight int null,
    use_kind int null,
    start_date char(10) null,
    end_date char(10) null,
    probation_end_date char(10) null,
    resident_place varchar(200) null,
    home_address varchar(100) null,
    temp_resident_number varchar(60) null,
    company_start_date varchar(10) null,
    work_start_date varchar(10) null,
    accum_fund_account varchar(30) null,
    account_name varchar(200) null,
    bank_id int null,
    account_id varchar(100) null,
    show_order int null,
    classification char(1) null,
    company_work_year decimal(10,2) null,
    work_year decimal(10,2) null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_HRMRESOURCE_PK PRIMARY KEY (id)
);

-- JCL_ORG_HRMRESOURCEEXT
CREATE TABLE JCL_ORG_HRMRESOURCEEXT (
    id int IDENTITY(1,1) NOT NULL,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_HRMRESOURCEEXT_PK PRIMARY KEY (id)
);

-- JCL_ORG_HRMRESOURCEEXT_DT1
CREATE TABLE JCL_ORG_HRMRESOURCEEXT_DT1 (
    id int IDENTITY(1,1) NOT NULL,
    mainid int NULL,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_HRMRESOURCEEXT_DT1_PK PRIMARY KEY (id)
);


-- JCL_ORG_STAFFPLAN
CREATE TABLE JCL_ORG_STAFFPLAN (
    id int IDENTITY(1,1) NOT NULL,
    plan_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    plan_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    plan_year varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    time_start datetime null,
    time_end datetime null,
    company_id varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    description text NULL,
    forbidden_tag int NULL,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_STAFFPLAN_PK PRIMARY KEY (id)
);

-- JCL_ORG_STAFF
CREATE TABLE JCL_ORG_STAFF (
    id int IDENTITY(1,1) NOT NULL,
    plan_id int null,
    comp_id int null,
    dept_id int null,
    job_id int null,
    staff_num int null,
    control_policy int null,
    permanent_num int null,
    freeze_num int null,
    lack_status int null,
    staff_desc varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    description text null,
    is_used int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_STAFF_PK PRIMARY KEY (id)
);

-- JCL_ORG_STAFFS
CREATE TABLE JCL_ORG_STAFFS (
    id int IDENTITY(1,1) NOT NULL,
    staff_id int null,
    business_type int null,
    change_num int null,
    business_source int null,
    requestid int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (id)
);

CREATE TABLE HR_LOG (
    id int IDENTITY(1,1) NOT NULL,
    operate_desc varchar(100) NULL,
    operator_id int NULL,
    operator_name varchar(100) NULL,
    create_time datetime NULL,
    operate_type int NULL,
    params_str varchar(2000) NULL,
    client_ip varchar(100) NULL,
    method_name varchar(100) NULL,
    delete_type int NULL,
    class_name varchar(100) NULL,
    operate_module_name varchar(100) NULL,
    operate_module int NULL,
    message varchar(2000) NULL,
    value varchar(100) NULL,
    CONSTRAINT HR_LOG_PK PRIMARY KEY (id)
);

create table JCL_ORG_HRMRELATION (
    id int not null,
    scheme_id int null,
    level_id varchar(100) null,
    grade_id int null,
    sequence_id int null,
    post_id int null,
    post_info_id int null,
    company_id int null,
    department_id int null,
    job_id int null,
    creator int null,
    delete_type int null,
    create_time datetime null,
    update_time datetime null,
    constraint JCL_ORG_HRMRELATION_PK primary key (id)
);

-- JCL_ORG_MAP
CREATE TABLE JCL_ORG_MAP (
    id int IDENTITY(1,1) NOT NULL,
    ftype int NULL,
    fobjid int NULL,
    fecid int NULL,
    Uuid varchar(100) NULL,
    fclass int NULL,
    fclassname varchar(100) NULL,
    fnumber varchar(100) NULL,
    fname varchar(255) NULL,
    fleader int NULL,
    fleaderimg int NULL,
    fleadername varchar(100) NULL,
    fleaderjobid int NULL,
    fleaderjob varchar(255) NULL,
    fleaderlv varchar(100) NULL,
    fleaderst varchar(100) NULL,
    fparentid int null,
    fobjparentid int null,
    fplan int null,
    fonjob int null,
    fisvitual int null,
    fdatebegin date null,
    fdateend date null,
    creator int null,
    delete_type int null,
    create_time date null,
    update_time date null,
    CONSTRAINT JCL_ORG_MAP_PK PRIMARY KEY (id)
);

-- JCL_ORG_DETACH
create table JCL_ORG_DETACH (
  id int IDENTITY(1,1) not null,
  type int null,
  manger text not null,
  rolelevel text not null,
  module text not null,
  creator int null,
  delete_type int null,
  create_time date null,
  update_time date null,
  constraint JCL_ORG_DETACH_PK primary key (id)
);