weaver-hrm-salary/resource/sqlupgrade/Oracle/sql202308150603.sql

57 lines
2.6 KiB
MySQL
Raw Normal View History

create table hrsa_sob_add_up_rule
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
salary_sob_id number,
income_category varchar2(100),
salary_item_id number,
add_up_column_data_index varchar2(100)
)
/
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')
/