weaver-hrm-salary/resource/sqlupgrade/Mysql/sql202206071403.sql

141 lines
7.2 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE hrsa_tax_agent_emp
(
id bigint(20) NOT NULL COMMENT 'ID',
create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
update_time datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
creator bigint(20) NULL DEFAULT NULL COMMENT '创建人id',
delete_type int(11) NULL DEFAULT 0,
tenant_key varchar(10) NULL DEFAULT NULL COMMENT '租户KEY',
tax_agent_id bigint(20) NULL DEFAULT NULL COMMENT '个税扣缴义务人的主键id',
employee_id bigint(20) NULL DEFAULT NULL COMMENT '人员信息表的主键id',
employee_name varchar(255) NULL DEFAULT NULL,
PRIMARY KEY (id) USING BTREE,
INDEX idx_tenant_key(tenant_key) USING BTREE,
INDEX idx_tax_agent(tax_agent_id) USING BTREE
) ;
CREATE TABLE hrsa_tax_agent_emp_change
(
id bigint(20) NOT NULL COMMENT 'ID',
create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
update_time datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
creator bigint(20) NULL DEFAULT NULL COMMENT '创建人id',
delete_type int(11) NULL DEFAULT 0 COMMENT '是否删除',
tenant_key varchar(10) NULL DEFAULT NULL COMMENT '租户KEY',
tax_agent_id bigint(20) NOT NULL COMMENT '个税扣缴义务人的主键id',
employee_id bigint(20) NOT NULL COMMENT '人员信息表的主键id',
change_type int(11) NOT NULL DEFAULT 0 COMMENT '增量类型。1新增、2删除',
employee_name varchar(255) NULL DEFAULT NULL,
module_type int(4) NOT NULL DEFAULT 0,
PRIMARY KEY (id) USING BTREE,
INDEX idx_tenant_key(tenant_key) USING BTREE,
INDEX idx_tax_agent(tax_agent_id) USING BTREE
) ;
CREATE TABLE hrsa_tax_agent_admin
(
id bigint(20) NOT NULL COMMENT '主键',
tax_agent_id bigint(20) NOT NULL COMMENT '个税扣缴义务人的主键id',
employee_id bigint(20) NOT NULL COMMENT '人员信息表的主键id',
create_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) COMMENT '创建时间',
update_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) ON UPDATE CURRENT_TIMESTAMP (0) COMMENT '更新时间',
creator bigint(20) NOT NULL DEFAULT 0 COMMENT '创建人',
delete_type int(11) NOT NULL DEFAULT 0 COMMENT '是否已删除。0未删除、1已删除',
tenant_key varchar(10) NOT NULL DEFAULT '' COMMENT '租户ID',
PRIMARY KEY (id) USING BTREE,
INDEX idx_tenant_key(tenant_key) USING BTREE,
INDEX idx_employee_id(employee_id) USING BTREE
) ;
CREATE TABLE hrsa_tax_agent_manage_range
(
id bigint(20) NOT NULL COMMENT '主键id',
tax_agent_id bigint(20) NOT NULL DEFAULT 0 COMMENT '个税扣缴义务人的id',
employee_id bigint(20) NOT NULL DEFAULT 0 COMMENT '人员表的主键id',
tax_agent_sub_admin_id bigint(20) NOT NULL DEFAULT 0 COMMENT '个税扣缴义务人的分管理员的id',
target_type tinyint(4) NOT NULL DEFAULT 1 COMMENT '对象类型。1人员、2部门、3岗位',
target_id bigint(20) NOT NULL DEFAULT 0 COMMENT '对象id',
employee_status varchar(100) NOT NULL,
include_type int(4) NOT NULL DEFAULT 1,
creator bigint(20) NOT NULL DEFAULT 0 COMMENT '创建人',
create_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) COMMENT '创建时间',
update_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) ON UPDATE CURRENT_TIMESTAMP (0) COMMENT '更新时间',
delete_type int(11) NOT NULL DEFAULT 0 COMMENT '是否已删除。0未删除、1已删除',
tenant_key varchar(10) NOT NULL DEFAULT '' COMMENT '租户ID',
range_type int(4) NOT NULL DEFAULT 0,
PRIMARY KEY (id) USING BTREE,
INDEX idx_tenant(tenant_key) USING BTREE,
INDEX idx_tax_agent_sub_admin_id(tax_agent_sub_admin_id) USING BTREE,
INDEX idx_tenant_key(tenant_key) USING BTREE
) ;
CREATE TABLE hrsa_tax_agent_base
(
id bigint(20) NOT NULL COMMENT '主键',
devolution_status int(11) NOT NULL DEFAULT 0 COMMENT '分权开启状态。0关、1',
create_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) COMMENT '创建时间',
update_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) ON UPDATE CURRENT_TIMESTAMP (0) COMMENT '更新时间',
creator bigint(20) NOT NULL DEFAULT 0 COMMENT '创建人',
delete_type int(11) NOT NULL DEFAULT 0 COMMENT '是否已删除。0未删除、1已删除',
tenant_key varchar(10) NOT NULL DEFAULT '' COMMENT '租户ID',
PRIMARY KEY (id) USING BTREE,
INDEX idx_tenant_key(tenant_key) USING BTREE
) ;
CREATE TABLE hrsa_tax_agent_sub_admin
(
id bigint(20) NOT NULL COMMENT '主键',
tax_agent_id bigint(20) NOT NULL COMMENT '个税扣缴义务人的主键id',
employee_id bigint(20) NOT NULL COMMENT '人员信息表的主键id',
description varchar(100) NULL DEFAULT NULL COMMENT '描述',
create_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP (0) COMMENT '更新时间',
creator bigint(20) NOT NULL DEFAULT 0 COMMENT '创建人',
delete_type int(11) NOT NULL DEFAULT 0 COMMENT '是否已删除。0未删除、1已删除',
tenant_key varchar(10) NOT NULL DEFAULT '' COMMENT '租户ID',
remark text NULL,
PRIMARY KEY (id) USING BTREE,
INDEX idx_tenant_key(tenant_key) USING BTREE,
INDEX idx_tax_agent_id(tax_agent_id) USING BTREE,
INDEX idx_employee_id(employee_id) USING BTREE
) ;
CREATE TABLE hrsa_tax_agent_sub_admin_emp
(
id bigint(20) NOT NULL COMMENT 'ID',
create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
update_time datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
creator bigint(20) NULL DEFAULT NULL COMMENT '创建人id',
delete_type int(11) NULL DEFAULT 0 COMMENT '是否删除',
tenant_key varchar(10) NULL DEFAULT NULL COMMENT '租户KEY',
tax_agent_id bigint(20) NOT NULL DEFAULT 0 COMMENT '个税扣缴义务人的主键id',
tax_agent_sub_admin_id bigint(20) NOT NULL DEFAULT 0 COMMENT '个税扣缴义务人的分管理员的id',
employee_id bigint(20) NOT NULL DEFAULT 0 COMMENT '人员信息表的主键id',
employee_name varchar(255) NULL DEFAULT NULL COMMENT '人员姓名',
PRIMARY KEY (id) USING BTREE,
INDEX idx_tenant_key(tenant_key) USING BTREE,
INDEX idx_tax_agent(tax_agent_id) USING BTREE
) ;
ALTER TABLE hrsa_tax_agent ADD COLUMN payment_agency varchar(255) NULL COMMENT '代缴机构' ;
ALTER TABLE hrsa_salary_sob ADD COLUMN tax_agent_id bigint(0) NULL COMMENT '个税扣缴义务人的主键id' ;
INSERT INTO hrsa_tax_agent_base(id, devolution_status, create_time, update_time, creator, delete_type, tenant_key) VALUES (1653303537239, 1, '2022-05-23 18:58:53', '2022-05-23 19:12:12', 1, 0, 'all_teams');
ALTER TABLE hrsa_bill_detail_temp ADD COLUMN payment_organization bigint(0) NULL COMMENT '个税扣缴义务人id' ;
ALTER TABLE hrsa_bill_detail ADD COLUMN payment_organization bigint(0) NULL COMMENT '个税扣缴义务人id' ;
ALTER TABLE hrsa_bill_batch ADD COLUMN payment_organization bigint(0) NULL COMMENT '个税扣缴义务人id' ;