t
.
add_up_accumulation_fund_total
, t.add_up_advance_tax
, t.add_up_allowed_donation
, t.add_up_child_education
, t.add_up_continuing_education
, t.add_up_enterprise_and_other
, t.add_up_housing_loan_interest
, t.add_up_housing_rent
, t.add_up_income
, t.add_up_other_deduction
, t.add_up_social_security_total
, t.add_up_subtraction
, t.add_up_support_elderly
, t.add_up_tax_exempt_income
, t.create_time
, t.creator
, t.delete_type
, t.employee_id
, t.id
, t.tax_agent_id
, t.tax_year_month
, t.tenant_key
, t.update_time
, t.year
, t.add_up_illness_medical
, t.add_up_tax_savings
, t.add_up_infant_care
t1
.
id
,
t1.tax_year_month,
t1.employee_id,
e.lastname as username,
d.departmentName AS departmentName,
e.mobile,
e.workcode as job_num,
e.companystartdate as hiredate,
t2.name AS tax_agent_name,
t1.add_up_income,
t1.add_up_subtraction,
t1.add_up_social_security_total,
t1.add_up_accumulation_fund_total,
t1.add_up_child_education,
t1.add_up_continuing_education,
t1.add_up_housing_loan_interest,
t1.add_up_housing_rent,
t1.add_up_support_elderly,
t1.add_up_illness_medical,
t1.add_up_infant_care,
t1.add_up_enterprise_and_other,
t1.add_up_other_deduction,
t1.add_up_tax_exempt_income,
t1.add_up_allowed_donation,
t1.add_up_tax_savings,
t1.add_up_advance_tax
AND t1.id IN
#{id}
AND t1.year = #{param.year}
AND t1.employee_id = #{param.employeeId}
AND
(
e.lastname like CONCAT('%',#{param.keyword},'%')
OR d.departmentname like CONCAT('%',#{param.keyword},'%')
OR e.workcode like CONCAT('%',#{param.keyword},'%')
)
AND t1.tax_year_month = #{param.taxYearMonth[0]}
AND (t1.tax_year_month BETWEEN #{param.taxYearMonth[0]} AND #{param.taxYearMonth[1]})
AND e.lastname like CONCAT('%',#{param.username},'%')
AND t1.tax_agent_id = #{param.taxAgentId}
AND d.id IN
#{id}
AND e.workcode like CONCAT('%',#{param.jobNum},'%')
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
AND e.mobile like CONCAT('%',#{param.mobile},'%')
AND t1.id IN
#{id}
AND t1.year = #{param.year}
AND t1.employee_id = #{param.employeeId}
AND
(
e.lastname like '%'||#{param.keyword}||'%'
OR d.departmentname like '%'||#{param.keyword}||'%'
OR e.workcode like '%'||#{param.keyword}||'%'
)
AND t1.tax_year_month = #{param.taxYearMonth[0]}
AND (t1.tax_year_month BETWEEN #{param.taxYearMonth[0]} AND #{param.taxYearMonth[1]})
AND e.lastname like '%'||#{param.username}||'%'
AND t1.tax_agent_id = #{param.taxAgentId}
AND d.id IN
#{id}
AND e.workcode like '%'||#{param.jobNum}||'%'
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
AND e.mobile like '%'||#{param.mobile}||'%'
AND t1.id IN
#{id}
AND t1.year = #{param.year}
AND t1.employee_id = #{param.employeeId}
AND
(
e.lastname like '%'+#{param.keyword}+'%'
OR d.departmentname like '%'+#{param.keyword}+'%'
OR e.workcode like '%'+#{param.keyword}+'%'
)
AND t1.tax_year_month = #{param.taxYearMonth[0]}
AND (t1.tax_year_month BETWEEN #{param.taxYearMonth[0]} AND #{param.taxYearMonth[1]})
AND e.lastname like '%'+#{param.username}+'%'
AND t1.tax_agent_id = #{param.taxAgentId}
AND d.id IN
#{id}
AND e.workcode like '%'+#{param.jobNum}+'%'
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
AND e.mobile like '%'+#{param.mobile}+'%'
INSERT INTO hrsa_add_up_situation(
employee_id,
tax_agent_id,
tax_year_month,
year,
add_up_income,
add_up_subtraction,
add_up_social_security_total,
add_up_accumulation_fund_total,
add_up_child_education,
add_up_continuing_education,
add_up_housing_loan_interest,
add_up_housing_rent,
add_up_support_elderly,
add_up_enterprise_and_other,
add_up_other_deduction,
add_up_tax_exempt_income,
add_up_allowed_donation,
add_up_advance_tax,
create_time,
update_time,
creator,
tenant_key,
add_up_tax_savings,
add_up_illness_medical,
add_up_infant_care
)
VALUES
(
#{item.employeeId},
#{item.taxAgentId},
#{item.taxYearMonth},
#{item.year},
#{item.addUpIncome},
#{item.addUpSubtraction},
#{item.addUpSocialSecurityTotal},
#{item.addUpAccumulationFundTotal},
#{item.addUpChildEducation},
#{item.addUpContinuingEducation},
#{item.addUpHousingLoanInterest},
#{item.addUpHousingRent},
#{item.addUpSupportElderly},
#{item.addUpEnterpriseAndOther},
#{item.addUpOtherDeduction},
#{item.addUpTaxExemptIncome},
#{item.addUpAllowedDonation},
#{item.addUpAdvanceTax},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey},
#{item.addUpTaxSavings},
#{item.addUpIllnessMedical},
#{item.addUpInfantCare}
)
INSERT INTO hrsa_add_up_situation(
employee_id,
tax_agent_id,
tax_year_month,
year,
add_up_income,
add_up_subtraction,
add_up_social_security_total,
add_up_accumulation_fund_total,
add_up_child_education,
add_up_continuing_education,
add_up_housing_loan_interest,
add_up_housing_rent,
add_up_support_elderly,
add_up_enterprise_and_other,
add_up_other_deduction,
add_up_tax_exempt_income,
add_up_allowed_donation,
add_up_advance_tax,
create_time,
update_time,
creator,
tenant_key,
add_up_tax_savings,
add_up_illness_medical,
add_up_infant_care
)
select
#{item.employeeId},
#{item.taxAgentId},
#{item.taxYearMonth},
#{item.year},
#{item.addUpIncome},
#{item.addUpSubtraction},
#{item.addUpSocialSecurityTotal},
#{item.addUpAccumulationFundTotal},
#{item.addUpChildEducation},
#{item.addUpContinuingEducation},
#{item.addUpHousingLoanInterest},
#{item.addUpHousingRent},
#{item.addUpSupportElderly},
#{item.addUpEnterpriseAndOther},
#{item.addUpOtherDeduction},
#{item.addUpTaxExemptIncome},
#{item.addUpAllowedDonation},
#{item.addUpAdvanceTax},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey},
#{item.addUpTaxSavings},
#{item.addUpIllnessMedical},
#{item.addUpInfantCare}
from dual
INSERT INTO hrsa_add_up_situation(
employee_id,
tax_agent_id,
tax_year_month,
year,
add_up_income,
add_up_subtraction,
add_up_social_security_total,
add_up_accumulation_fund_total,
add_up_child_education,
add_up_continuing_education,
add_up_housing_loan_interest,
add_up_housing_rent,
add_up_support_elderly,
add_up_enterprise_and_other,
add_up_other_deduction,
add_up_tax_exempt_income,
add_up_allowed_donation,
add_up_advance_tax,
create_time,
update_time,
creator,
tenant_key,
add_up_tax_savings,
add_up_illness_medical,
add_up_infant_care
)
VALUES
(
#{item.employeeId},
#{item.taxAgentId},
#{item.taxYearMonth},
#{item.year},
#{item.addUpIncome},
#{item.addUpSubtraction},
#{item.addUpSocialSecurityTotal},
#{item.addUpAccumulationFundTotal},
#{item.addUpChildEducation},
#{item.addUpContinuingEducation},
#{item.addUpHousingLoanInterest},
#{item.addUpHousingRent},
#{item.addUpSupportElderly},
#{item.addUpEnterpriseAndOther},
#{item.addUpOtherDeduction},
#{item.addUpTaxExemptIncome},
#{item.addUpAllowedDonation},
#{item.addUpAdvanceTax},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey},
#{item.addUpTaxSavings},
#{item.addUpIllnessMedical},
#{item.addUpInfantCare}
)
update hrsa_add_up_situation
when id=#{item.id} then #{item.addUpIncome}
when id=#{item.id} then #{item.addUpSubtraction}
when id=#{item.id} then #{item.addUpSocialSecurityTotal}
when id=#{item.id} then #{item.addUpAccumulationFundTotal}
when id=#{item.id} then #{item.addUpChildEducation}
when id=#{item.id} then #{item.addUpContinuingEducation}
when id=#{item.id} then #{item.addUpHousingLoanInterest}
when id=#{item.id} then #{item.addUpHousingRent}
when id=#{item.id} then #{item.addUpSupportElderly}
when id=#{item.id} then #{item.addUpEnterpriseAndOther}
when id=#{item.id} then #{item.addUpOtherDeduction}
when id=#{item.id} then #{item.addUpTaxExemptIncome}
when id=#{item.id} then #{item.addUpAllowedDonation}
when id=#{item.id} then #{item.addUpAdvanceTax}
when id=#{item.id} then #{item.addUpTaxSavings}
when id=#{item.id} then #{item.addUpIllnessMedical}
when id=#{item.id} then #{item.addUpInfantCare}
where
id in
#{item.id}
UPDATE hrsa_add_up_situation
SET delete_type=1
WHERE delete_type = 0
AND tax_year_month = #{param.taxYearMonth}
AND employee_id IN
#{employeeId}
UPDATE hrsa_add_up_situation
SET delete_type=1
WHERE delete_type = 0
AND tax_year_month = #{param.taxYearMonth}
AND tax_agent_id IN
#{taxAgentId}