diff --git a/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.xml b/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.xml index 4537304e0..1f003ba57 100644 --- a/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.xml @@ -214,14 +214,14 @@ SELECT FROM hrsa_insurance_base_info t - LEFT JOIN( SELECT social.payment_organization, social.employee_id, social.social_end_time FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON t.employee_id = social.employee_id AND t.payment_organization = social.payment_organization - LEFT JOIN( SELECT fund.payment_organization, fund.employee_id, fund.fund_end_time FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON t.employee_id = fund.employee_id AND t.payment_organization = fund.payment_organization - LEFT JOIN( SELECT other.payment_organization, other.employee_id, other.other_end_time FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON t.employee_id = other.employee_id AND t.payment_organization = other.payment_organization + LEFT JOIN( SELECT social.payment_organization, social.employee_id, social.social_end_time, social.social_scheme_id FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON t.employee_id = social.employee_id AND t.payment_organization = social.payment_organization + LEFT JOIN( SELECT fund.payment_organization, fund.employee_id, fund.fund_end_time, fund.fund_scheme_id FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON t.employee_id = fund.employee_id AND t.payment_organization = fund.payment_organization + LEFT JOIN( SELECT other.payment_organization, other.employee_id, other.other_end_time, other.other_scheme_id FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON t.employee_id = other.employee_id AND t.payment_organization = other.payment_organization WHERE t.delete_type = 0 AND t.run_status = '2' - AND social.social_end_time is not null and social.social_end_time ]]> ' ' and social.social_end_time #{today} - AND fund.fund_end_time is not null and fund.fund_end_time ]]> ' ' and fund.fund_end_time #{today} - AND other.other_end_time is not null and other.other_end_time ]]> ' ' and other.other_end_time #{today} + AND (social.social_scheme_id is null or (social.social_end_time is not null and social.social_end_time ]]> ' ' and social.social_end_time #{today})) + AND (fund.fund_scheme_id is null or (fund.fund_end_time is not null and fund.fund_end_time ]]> ' ' and fund.fund_end_time #{today})) + AND (other.other_scheme_id is null or (other.other_end_time is not null and other.other_end_time ]]> ' ' and other.other_end_time #{today}))