CREATE TABLE hrsa_auth_data
(
    id           bigint NOT NULL,
    role_id      bigint NOT NULL,
    link         int NOT NULL,
    target_type  int NOT NULL,
    target       varchar(4000),
    target_name  varchar(4000),
    sorted_index int NOT NULL,
    creator      bigint NOT NULL,
    create_time  timestamp NOT NULL,
    update_time  timestamp NOT NULL,
    delete_type  int NOT NULL,
    tenant_key   varchar(10),
   PRIMARY KEY (id) 
);



CREATE TABLE hrsa_auth_member
(
    id          bigint NOT NULL,
    role_id     bigint NOT NULL,
    target_type int NOT NULL,
    target      varchar(4000) NOT NULL,
    target_name varchar(4000) NOT NULL,
    creator     bigint NOT NULL,
    create_time timestamp NOT NULL,
    update_time timestamp NOT NULL,
    delete_type int NOT NULL,
    tenant_key  varchar(10),
   PRIMARY KEY (id) 
);


CREATE TABLE hrsa_auth_opt
(
    id          bigint NOT NULL,
    role_id     bigint NOT NULL,
    page        varchar(200) NOT NULL,
    opt         varchar(200) NOT NULL,
    creator     bigint NOT NULL,
    create_time timestamp NOT NULL,
    update_time timestamp NOT NULL,
    delete_type int NOT NULL,
    tenant_key  varchar(10),
   PRIMARY KEY (id) 
);


CREATE TABLE hrsa_auth_role
(
    id           bigint NOT NULL,
    name         varchar(255) NOT NULL,
    description  varchar(400),
    creator      bigint NOT NULL,
    create_time  timestamp NOT NULL,
    update_time  timestamp NOT NULL,
    delete_type  int NOT NULL,
    tenant_key   varchar(10)  NOT NULL,
   PRIMARY KEY (id) 
);


CREATE TABLE hrsa_auth_role_data
(
    id          bigint NOT NULL,
    role_id     bigint NOT NULL,
    employee_id bigint NOT NULL,
    creator     bigint NOT NULL,
    create_time timestamp NOT NULL,
    update_time timestamp NOT NULL,
    delete_type int NOT NULL,
    tenant_key  varchar(10) NOT NULL,
   PRIMARY KEY (id) 
);


CREATE TABLE hrsa_auth_role_emp
(
    id          bigint NOT NULL,
    role_id     bigint NOT NULL,
    employee_id bigint NOT NULL,
    creator     bigint NOT NULL,
    create_time timestamp NOT NULL,
    update_time timestamp NOT NULL,
    delete_type int NOT NULL,
    tenant_key  varchar(10) NOT NULL,
   PRIMARY KEY (id) 
);


CREATE TABLE hrsa_auth_resource
(
    id          bigint NOT NULL,
    role_id     bigint NOT NULL,
    target_type int NOT NULL,
    target      bigint NOT NULL,
    target_name varchar(255),
    creator     bigint NOT NULL,
    create_time timestamp NOT NULL,
    update_time timestamp NOT NULL,
    delete_type int NOT NULL,
    tenant_key  varchar(10),
   PRIMARY KEY (id) 
);


CREATE TABLE hrsa_sob_tax_link
(
    id           bigint NOT NULL,
    sob_id       bigint NOT NULL,
    tax_agent_id bigint NOT NULL,
    creator      bigint NOT NULL,
    create_time  timestamp NOT NULL,
    update_time  timestamp NOT NULL,
    delete_type  int NOT NULL,
    tenant_key   varchar(10) ,
   PRIMARY KEY (id) 
) ;