58 lines
2.8 KiB
SQL
58 lines
2.8 KiB
SQL
create table hrsa_sob_add_up_rule
|
|
(
|
|
id bigint primary key comment 'ID' ,
|
|
create_time datetime comment '创建时间' ,
|
|
update_time datetime comment '修改时间' ,
|
|
creator bigint comment '创建人id' ,
|
|
delete_type int default 0 comment '是否删除' ,
|
|
tenant_key varchar(10) comment '租户KEY' ,
|
|
salary_sob_id bigint comment '薪资账套的id' ,
|
|
income_category varchar(100) comment '收入所得项目' ,
|
|
salary_item_id bigint comment '薪资项目的id' ,
|
|
add_up_column_data_index varchar(100) comment '往期累计情况的字段索引'
|
|
)
|
|
;
|
|
insert into hrsa_sob_add_up_rule(id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id,
|
|
income_category, salary_item_id, add_up_column_data_index)
|
|
select id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id,
|
|
income_category, salary_item_id, salary_item_code as add_up_column_data_index
|
|
from hrsa_salary_sob_item
|
|
where delete_type = 0
|
|
and income_category = 1
|
|
and salary_item_code in ('addUpIncome', 'addUpSubtraction', 'addUpSocialSecurityTotal', 'addUpAccumulationFundTotal',
|
|
'addUpEnterpriseAndOther', 'addUpOtherDeduction', 'addUpTaxExemptIncome',
|
|
'addUpAllowedDonation', 'addUpTaxSavings')
|
|
;
|
|
|
|
insert into hrsa_sob_add_up_rule(id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id,
|
|
income_category, salary_item_id, add_up_column_data_index)
|
|
select id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id,
|
|
income_category, salary_item_id, 'addUpTaxPayable' as add_up_column_data_index
|
|
from hrsa_salary_sob_item
|
|
where delete_type = 0
|
|
and income_category = 1
|
|
and salary_item_code = 'addUpAdvanceTax'
|
|
;
|
|
|
|
delete from hrsa_sob_add_up_rule
|
|
where income_category = 1
|
|
and add_up_column_data_index in ('addUpTaxPayable', 'addUpAdvanceTax')
|
|
;
|
|
insert into hrsa_sob_add_up_rule(id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id,
|
|
income_category, salary_item_id, add_up_column_data_index)
|
|
select id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id,
|
|
income_category, salary_item_id, 'addUpAdvanceTax' as add_up_column_data_index
|
|
from hrsa_salary_sob_item
|
|
where delete_type = 0
|
|
and income_category = 1
|
|
and salary_item_code = 'addUpTaxPayable'
|
|
;
|
|
insert into hrsa_sob_add_up_rule(id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id,
|
|
income_category, salary_item_id, add_up_column_data_index)
|
|
select id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id,
|
|
income_category, salary_item_id, salary_item_code as add_up_column_data_index
|
|
from hrsa_salary_sob_item
|
|
where delete_type = 0
|
|
and income_category = 1
|
|
and salary_item_code in ('addUpTaxableIncome')
|
|
; |