<iftest="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201'">
t_salary_account a
left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
</if>
<iftest="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() < '202201' ">
t_salary_account_hro_2021 a
left join t_salary_account_item_hro_2021 enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
left join t_salary_account_item_hro_2021 pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
case s.STATUS when 0 then '待提交' when 1 then '待审核' when 2 then '待推送明细' when 3 then '已推送待发放' when 4 then '已发放' when 5 then '审核不通过' when 6 then '确认不通过' when 7 then '财务退回' when 10 then '推送失败' when 11 then '已审核生成收入中' when 12 then '已审核生成收入失败' else '-' end as status
,phoneSubsidy.SALARY_MONEY as phoneSubsidy
,s.BUSINESS_PRIMARY_TYPE as businessPrimaryType
,s.BUSINESS_SECOND_TYPE as businessSecondType
,s.BUSINESS_THIRD_TYPE as businessThirdType
a.EMP_PHONE as empPhone,
a.TAX_MONTH as taxMonth,
a.SETTLEMENT_MONTH as settlementMonth,
a.SALARY_MONTH as salaryMonth,
a.DEPT_NAME as deptName,
a.DEPT_NO as deptNo,
a.EMP_NAME as empName,
a.EMP_IDCARD as empIdcard,
if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0, a.RELAY_SALARY_UNIT, ifnull(a.RELAY_SALARY,0)) as relaySalary,
a.ACTUAL_SALARY as actualSalary,
ifnull(a.SALARY_TAX,0) + ifnull(a.SALARY_TAX_UNIT,0) as salaryTax,
a.ANNUAL_BONUS_TAX as annualBonusTax,
a.PERSON_SOCIAL as personSocial,
a.PERSON_FUND as personFund,
enterpriseAnnuity.SALARY_MONEY as enterpriseAnnuity,
a.UNIT_SOCIAL as unitSocial,
a.UNIT_FUND as unitFund,
a.SUM_BABY_MONEY as sumBabyMoney,
a.SUM_CHILD_EDU_MONEY as sumChildEduMoney,
a.SUM_CONTINUING_EDUCATION_MONEY as sumContinuingEducationMoney,
a.SUM_HOUSING_LOAN_MONEY as sumHousingLoanMoney,
a.SUM_HOUSING_RENT_MONEY as sumHousingRentMoney,
a.SUM_PRIVATE_PENSION as sumPrivatePension,
a.SUM_SUPPORT_ELDERLY_MONEY as sumSupportElderlyMoney,
case s.STATUS when 0 then '待提交' when 1 then '待审核' when 2 then '待推送明细' when 3 then '已推送待发放' when 4 then '已发放' when 5 then '审核不通过' when 6 then '确认不通过' when 7 then '财务退回' when 10 then '推送失败' when 11 then '已审核生成收入中' when 12 then '已审核生成收入失败' else '-' end as status
,a.BANK_NO as bankNo
,a.BANK_NAME as bankName
,if(a.ANNUAL_BONUS_TYPE='1','单独','合并') as annualBonusType
,ap.AREA_NAME as bankProvince
,ac.AREA_NAME as bankCity
,a.BANK_SUB_NAME as bankSubName
,if(a.SALARY_STYLE='0','现金','银行') as salaryStyle
,if(a.SALARY_GIVE_TIME='1','暂停发','立即发') as salaryGiveTime
,a.DEDU_SOCIAL_MONTH as deduSocialMonth
,a.DEDU_PROVIDENT_MONTH as deduProvidentMonth
,if(a.SOCIAL_PRIORITY='1','缴纳月','生成月') as socialPriority
,if(a.FUND_PRIORITY='1','缴纳月','生成月') as fundPriority
,if(a.IS_DEDUCT_SOCIAL='0','否','是') as isDeductSocial
left join t_salary_standard s on a.SALARY_FORM_ID = s.id
left join t_salary_account_item annualBonus on annualBonus.SALARY_ACCOUNT_ID = a.id and annualBonus.JAVA_FIED_NAME = 'annualBonus'
left join t_salary_account_item exemptionPersionTax on exemptionPersionTax.SALARY_ACCOUNT_ID = a.id and exemptionPersionTax.JAVA_FIED_NAME='exemptionPersionTax'
left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
left join t_salary_account_item phoneSubsidy on phoneSubsidy.SALARY_ACCOUNT_ID = a.id and phoneSubsidy.JAVA_FIED_NAME='phoneSubsidy'
left join sys_area ap on ap.id=a.BANK_PROVINCE
left join sys_area ac on ac.id=a.BANK_CITY
where s.APPLY_NO = #{applyNo} and a.DELETE_FLAG = 0