CREATE TABLE hrsa_tax_agent_emp
(
    id NUMBER(38,0) primary key  NOT NULL,
    create_time   date DEFAULT sysdate,
    update_time   date DEFAULT sysdate,
    creator       NUMBER(38,0) DEFAULT 0,
    delete_type   number DEFAULT 0 ,
    tenant_key    varchar2(10) DEFAULT '',
    tax_agent_id  NUMBER(38,0) NOT NULL,
    employee_id   NUMBER(38,0) NOT NULL,
    employee_name varchar2(255)
) 
/

CREATE TABLE hrsa_tax_agent_emp_change
(
    id NUMBER(38,0) primary key  NOT NULL,
    create_time   date DEFAULT sysdate,
    update_time   date DEFAULT sysdate,
    creator       NUMBER(38,0) DEFAULT 0,
    delete_type   number DEFAULT 0 ,
    tenant_key    varchar2(10) DEFAULT '',
    tax_agent_id  NUMBER(38,0) NOT NULL,
    employee_id   NUMBER(38,0) NOT NULL,
    change_type   number DEFAULT 0 ,
    employee_name varchar2(255)  DEFAULT NULL,
    module_type   NUMBER(4,0)  DEFAULT 0
)
/

CREATE TABLE hrsa_tax_agent_admin
(
    id NUMBER(38,0) primary key  NOT NULL,
    tax_agent_id NUMBER(38,0) NOT NULL,
    employee_id  NUMBER(38,0) NOT NULL,
    create_time  date DEFAULT sysdate,
    update_time  date DEFAULT sysdate,
    creator      NUMBER(38,0) DEFAULT 0,
    delete_type  number DEFAULT 0 ,
    tenant_key   varchar2(10) DEFAULT ''
) 
/

CREATE TABLE hrsa_tax_agent_manage_range
(
    id NUMBER(38,0) primary key  NOT NULL,
    tax_agent_id           NUMBER(38,0) NOT NULL,
    employee_id            NUMBER(38,0) NOT NULL,
    tax_agent_sub_admin_id NUMBER(38,0) NOT NULL,
    target_type            number  DEFAULT 1,
    target_id              NUMBER(38,0) NOT NULL,
    employee_status        varchar2(100)  NOT NULL,
    include_type           number  DEFAULT 1,
    creator                NUMBER(38,0) DEFAULT '0',
    create_time            date DEFAULT sysdate,
    update_time            date DEFAULT sysdate,
    delete_type            number DEFAULT 0 ,
    tenant_key             varchar2(10) DEFAULT '',
    range_type             number  DEFAULT 0
)
/

CREATE TABLE hrsa_tax_agent_base
(
    id NUMBER(38,0) primary key  NOT NULL,
    devolution_status NUMBER(11,0)  DEFAULT 0 ,
    create_time       date DEFAULT sysdate,
    update_time       date DEFAULT sysdate,
    creator           NUMBER(38,0) DEFAULT '0',
    delete_type       number DEFAULT 0 ,
    tenant_key        varchar2(10) DEFAULT ''
)
/

CREATE TABLE hrsa_tax_agent_sub_admin
(
    id NUMBER(38,0) primary key  NOT NULL,
    tax_agent_id NUMBER(38,0) NOT NULL,
    employee_id  NUMBER(38,0) NOT NULL,
    description  varchar2(100)  ,
    create_time  date DEFAULT sysdate,
    update_time  date DEFAULT sysdate,
    creator      NUMBER(38,0) DEFAULT '0',
    delete_type  number DEFAULT 0 ,
    tenant_key   varchar2(10) DEFAULT '',
    remark       clob
)

/

CREATE TABLE hrsa_tax_agent_sub_admin_emp
(
    id NUMBER(38,0) primary key  NOT NULL,
    create_time            date DEFAULT sysdate,
    update_time            date DEFAULT sysdate,
    creator                NUMBER(38,0) DEFAULT '0',
    delete_type            number DEFAULT 0 ,
    tenant_key             varchar2(10) DEFAULT '',
    tax_agent_id           NUMBER(38,0) NOT NULL,
    tax_agent_sub_admin_id NUMBER(38,0) NOT NULL,
    employee_id            NUMBER(38,0) NOT NULL,
    employee_name          varchar2(255)
)
/

ALTER TABLE hrsa_tax_agent add (
	payment_agency varchar2(255)
)
/

ALTER TABLE hrsa_salary_sob add (
	tax_agent_id NUMBER(38,0)
)
/



INSERT INTO hrsa_tax_agent_base(id, devolution_status, create_time, update_time, creator, delete_type, tenant_key) VALUES (1653303537239, 1, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), 1, 0, 'all_teams')
/

ALTER TABLE hrsa_bill_detail_temp add (
	payment_organization NUMBER(38,0)
)
/

ALTER TABLE hrsa_bill_detail add (
	payment_organization NUMBER(38,0)
)
/

ALTER TABLE hrsa_bill_batch add (
	payment_organization NUMBER(38,0)
)
/