IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_emp]') AND type IN ('U')) DROP TABLE [hrsa_tax_agent_emp] GO CREATE TABLE [hrsa_tax_agent_emp] ( [id] bigint NOT NULL, [create_time] datetime NULL, [update_time] datetime NULL, [creator] bigint NULL, [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, [tax_agent_id] bigint NULL, [employee_id] bigint NULL, [employee_name] varchar(255) COLLATE Chinese_PRC_CI_AS NULL ) GO ALTER TABLE [hrsa_tax_agent_emp] SET (LOCK_ESCALATION = TABLE) GO CREATE NONCLUSTERED INDEX [idx_tenant_key] ON [hrsa_tax_agent_emp] ( [tenant_key] ASC ) GO CREATE NONCLUSTERED INDEX [idx_tax_agent] ON [hrsa_tax_agent_emp] ( [tax_agent_id] ASC ) GO ALTER TABLE [hrsa_tax_agent_emp] ADD CONSTRAINT [PK__hrsa_tax__3213E83F1A221DC1] PRIMARY KEY CLUSTERED ([id]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_base]') AND type IN ('U')) DROP TABLE [hrsa_tax_agent_base] GO CREATE TABLE [hrsa_tax_agent_base] ( [id] bigint NOT NULL, [devolution_status] int DEFAULT 0, [create_time] datetime DEFAULT getdate(), [update_time] datetime DEFAULT getdate(), [creator] bigint DEFAULT 0, [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL ) GO ALTER TABLE [hrsa_tax_agent_base] SET (LOCK_ESCALATION = TABLE) GO CREATE NONCLUSTERED INDEX [idx_tenant_key] ON [hrsa_tax_agent_base] ( [tenant_key] ASC ) GO ALTER TABLE [hrsa_tax_agent_base] ADD CONSTRAINT [PK__hrsa_tax__3213E83FE121B302] PRIMARY KEY CLUSTERED ([id]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_manage_range]') AND type IN ('U')) DROP TABLE [hrsa_tax_agent_manage_range] GO CREATE TABLE [hrsa_tax_agent_manage_range] ( [id] bigint NOT NULL, [tax_agent_id] bigint DEFAULT 0, [employee_id] bigint DEFAULT 0, [tax_agent_sub_admin_id] bigint DEFAULT 0, [target_type] tinyint DEFAULT 1, [target_id] bigint DEFAULT 0, [employee_status] varchar(100) COLLATE Chinese_PRC_CI_AS NULL, [include_type] int DEFAULT 1, [creator] bigint DEFAULT 0, [create_time] datetime DEFAULT getdate(), [update_time] datetime DEFAULT getdate(), [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, [range_type] int DEFAULT 0 ) GO ALTER TABLE [hrsa_tax_agent_manage_range] SET (LOCK_ESCALATION = TABLE) GO CREATE NONCLUSTERED INDEX [idx_tax_agent_sub_admin_id] ON [hrsa_tax_agent_manage_range] ( [tax_agent_sub_admin_id] ASC ) GO CREATE NONCLUSTERED INDEX [idx_tenant_key] ON [hrsa_tax_agent_manage_range] ( [tenant_key] ASC ) GO ALTER TABLE [hrsa_tax_agent_manage_range] ADD CONSTRAINT [PK__hrsa_tax__3213E83F877A395F] PRIMARY KEY CLUSTERED ([id]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_emp_change]') AND type IN ('U')) DROP TABLE [hrsa_tax_agent_emp_change] GO CREATE TABLE [hrsa_tax_agent_emp_change] ( [id] bigint NOT NULL, [create_time] datetime NULL, [update_time] datetime NULL, [creator] bigint NULL, [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, [tax_agent_id] bigint NULL, [employee_id] bigint NULL, [change_type] int DEFAULT 0, [employee_name] varchar(255) COLLATE Chinese_PRC_CI_AS NULL, [module_type] int DEFAULT 0 ) GO ALTER TABLE [hrsa_tax_agent_emp_change] SET (LOCK_ESCALATION = TABLE) GO CREATE NONCLUSTERED INDEX [idx_tenant_key] ON [hrsa_tax_agent_emp_change] ( [tenant_key] ASC ) GO CREATE NONCLUSTERED INDEX [idx_tax_agent] ON [hrsa_tax_agent_emp_change] ( [tax_agent_id] ASC ) GO ALTER TABLE [hrsa_tax_agent_emp_change] ADD CONSTRAINT [PK__hrsa_tax__3213E83F2DC37AA6] PRIMARY KEY CLUSTERED ([id]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_sub_admin_emp]') AND type IN ('U')) DROP TABLE [hrsa_tax_agent_sub_admin_emp] GO CREATE TABLE [hrsa_tax_agent_sub_admin_emp] ( [id] bigint NOT NULL, [create_time] datetime NULL, [update_time] datetime NULL, [creator] bigint NULL, [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, [tax_agent_id] bigint DEFAULT 0, [tax_agent_sub_admin_id] bigint DEFAULT 0, [employee_id] bigint DEFAULT 0, [employee_name] varchar(255) COLLATE Chinese_PRC_CI_AS NULL ) GO ALTER TABLE [hrsa_tax_agent_sub_admin_emp] SET (LOCK_ESCALATION = TABLE) GO CREATE NONCLUSTERED INDEX [idx_tenant_key] ON [hrsa_tax_agent_sub_admin_emp] ( [tenant_key] ASC ) GO CREATE NONCLUSTERED INDEX [idx_tax_agent] ON [hrsa_tax_agent_sub_admin_emp] ( [tax_agent_id] ASC ) GO ALTER TABLE [hrsa_tax_agent_sub_admin_emp] ADD CONSTRAINT [PK__hrsa_tax__3213E83F2F2EE404] PRIMARY KEY CLUSTERED ([id]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_sub_admin]') AND type IN ('U')) DROP TABLE [hrsa_tax_agent_sub_admin] GO CREATE TABLE [hrsa_tax_agent_sub_admin] ( [id] bigint NOT NULL, [tax_agent_id] bigint NULL, [employee_id] bigint NULL, [description] varchar(100) COLLATE Chinese_PRC_CI_AS NULL, [create_time] datetime NULL, [update_time] datetime NULL, [creator] bigint NULL, [delete_type] int NULL, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, [remark] text COLLATE Chinese_PRC_CI_AS NULL ) GO ALTER TABLE [hrsa_tax_agent_sub_admin] SET (LOCK_ESCALATION = TABLE) GO CREATE NONCLUSTERED INDEX [idx_tenant_key] ON [hrsa_tax_agent_sub_admin] ( [tenant_key] ASC ) GO CREATE NONCLUSTERED INDEX [idx_tax_agent_id] ON [hrsa_tax_agent_sub_admin] ( [tax_agent_id] ASC ) GO CREATE NONCLUSTERED INDEX [idx_employee_id] ON [hrsa_tax_agent_sub_admin] ( [employee_id] ASC ) GO ALTER TABLE [hrsa_tax_agent_sub_admin] ADD CONSTRAINT [PK__hrsa_tax__3213E83F26DE578A] PRIMARY KEY CLUSTERED ([id]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_sub_admin]') AND type IN ('U')) DROP TABLE [hrsa_tax_agent_sub_admin] GO CREATE TABLE [hrsa_tax_agent_sub_admin] ( [id] bigint NOT NULL, [tax_agent_id] bigint NULL, [employee_id] bigint NULL, [description] varchar(100) COLLATE Chinese_PRC_CI_AS NULL, [create_time] datetime NULL, [update_time] datetime NULL, [creator] bigint NULL, [delete_type] int NULL, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, [remark] text COLLATE Chinese_PRC_CI_AS NULL ) GO ALTER TABLE [hrsa_tax_agent_sub_admin] SET (LOCK_ESCALATION = TABLE) GO CREATE NONCLUSTERED INDEX [idx_tenant_key] ON [hrsa_tax_agent_sub_admin] ( [tenant_key] ASC ) GO CREATE NONCLUSTERED INDEX [idx_tax_agent_id] ON [hrsa_tax_agent_sub_admin] ( [tax_agent_id] ASC ) GO CREATE NONCLUSTERED INDEX [idx_employee_id] ON [hrsa_tax_agent_sub_admin] ( [employee_id] ASC ) GO ALTER TABLE [hrsa_tax_agent_sub_admin] ADD CONSTRAINT [PK__hrsa_tax__3213E83F26DE578A] PRIMARY KEY CLUSTERED ([id]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_admin]') AND type IN ('U')) DROP TABLE [hrsa_tax_agent_admin] GO CREATE TABLE [hrsa_tax_agent_admin] ( [id] bigint NOT NULL, [tax_agent_id] bigint NULL, [employee_id] bigint NULL, [create_time] datetime DEFAULT getdate(), [update_time] datetime DEFAULT getdate(), [creator] bigint DEFAULT 0, [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL ) GO ALTER TABLE [hrsa_tax_agent_admin] SET (LOCK_ESCALATION = TABLE) GO CREATE NONCLUSTERED INDEX [idx_tenant_key] ON [hrsa_tax_agent_admin] ( [tenant_key] ASC ) GO CREATE NONCLUSTERED INDEX [idx_employee_id] ON [hrsa_tax_agent_admin] ( [employee_id] ASC ) GO ALTER TABLE [hrsa_tax_agent_admin] ADD CONSTRAINT [PK__hrsa_tax__3213E83F01D6FDC9] PRIMARY KEY CLUSTERED ([id]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ALTER TABLE hrsa_tax_agent ADD payment_agency varchar(255) NULL GO ALTER TABLE hrsa_salary_sob ADD tax_agent_id bigint NULL GO INSERT INTO hrsa_tax_agent_base(id, devolution_status, create_time, update_time, creator, delete_type, tenant_key) VALUES (1653303537239, 0, '2022-05-23 18:58:53', '2022-05-23 19:12:12', 1, 0, 'all_teams'); GO ALTER TABLE hrsa_bill_detail_temp ADD payment_organization bigint NULL GO ALTER TABLE hrsa_bill_detail ADD payment_organization bigint NULL GO ALTER TABLE hrsa_bill_batch ADD payment_organization bigint NULL GO