weaver-hrm-salary/resource/wiki/删除档案.txt

49 lines
1.8 KiB
Plaintext

操作前做好数据备份
一、删除指定扣缴义务人下的档案
删除扣缴义务人下的档案(注意删除后,再添加进扣缴义务人,不会自动生成档案)
1、查询hrsa_tax_agent表对应扣缴义务人id
select id from hrsa_tax_agent
2、删除社保福利档案
update hrsa_insurance_base_info set delete_type=3 where payment_organization = 扣缴义务人id
update hrsa_social_archives set delete_type=3 where payment_organization = 扣缴义务人id
update hrsa_fund_archives set delete_type=3 where payment_organization = 扣缴义务人id
update hrsa_other_archives set delete_type=3 where payment_organization = 扣缴义务人id
3、删除薪资档案
update hrsa_salary_archive set delete_type=3 where tax_agent_id=扣缴义务人id
二、删除停薪员工档案
update hrsa_salary_archive set delete_type=3 where run_status in ('STOP_FROM_PENDING','STOP_FROM_SUSPEND')
二、删除停薪员工社保档案
update hrsa_insurance_base_info set delete_type=3 where run_status in ('4','5')
三、删除指定人员档案
--删除社保福利档案
update hrsa_insurance_base_info set delete_type=3 WHERE employee_id = ? and payment_organization =?
update hrsa_social_archives set delete_type=3 WHERE employee_id = ? and payment_organization =?
update hrsa_fund_archives set delete_type=3 WHERE employee_id = ? and payment_organization =?
update hrsa_other_archives set delete_type=3 WHERE employee_id = ? and payment_organization =?
-- 删除薪资档案
update hrsa_salary_archive set delete_type=3 where employee_id = ? and tax_agent_id=?
update hrsa_salary_archive set delete_type=3;
update hrsa_insurance_base_info set delete_type=3;
update hrsa_social_archives set delete_type=3;
update hrsa_fund_archives set delete_type=3;
update hrsa_other_archives set delete_type=3;
update hrsa_tax_agent_emp set delete_type=3;