create table hrsa_sob_add_up_rule ( id bigint primary key , create_time timestamp, update_time timestamp, creator bigint, delete_type int default 0, tenant_key varchar(10), salary_sob_id bigint, income_category varchar(100), salary_item_id bigint, add_up_column_data_index varchar(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','addUpTaxFreeIncome','addUpTaxDeduction'); /