<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TPaymentInfoMapper">
	<resultMap id="tPaymentInfoMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo">
		<id property="id" column="ID"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="empId" column="EMP_ID"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitId" column="UNIT_ID"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
		<result property="settleDomainId" column="SETTLE_DOMAIN_ID"/>
		<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
		<result property="socialSecurityNo" column="SOCIAL_SECURITY_NO"/>
		<result property="socialPayAddr" column="SOCIAL_PAY_ADDR"/>
		<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
		<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
		<result property="lockStatus" column="LOCK_STATUS"/>
		<result property="pushStatus" column="PUSH_STATUS"/>
		<result property="sumAll" column="SUM_ALL"/>
		<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
		<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
		<result property="providentHousehold" column="PROVIDENT_HOUSEHOLD"/>
		<result property="providentPayAddr" column="PROVIDENT_PAY_ADDR"/>
		<result property="fundProvince" column="FUND_PROVINCE"/>
		<result property="fundCity" column="FUND_CITY"/>
		<result property="fundTown" column="FUND_TOWN"/>
		<result property="socialProvince" column="SOCIAL_PROVINCE"/>
		<result property="socialCity" column="SOCIAL_CITY"/>
		<result property="socialTown" column="SOCIAL_TOWN"/>
		<result property="socialId" column="SOCIAL_ID"/>
		<result property="fundId" column="FUND_ID"/>
		<result property="socialSum" column="SOCIAL_SUM"/>
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="socialSecurityPersonalSum" column="SOCIAL_SECURITY_PERSONAL_SUM"/>
		<result property="providentSum" column="PROVIDENT_SUM"/>
		<result property="inauguralTeam" column="INAUGURAL_TEAM"/>
		<result property="companyAccrual" column="COMPANY_ACCRUAL"/>
		<result property="personalAccrual" column="PERSONAL_ACCRUAL"/>
		<result property="unitPensionSet" column="UNIT_PENSION_SET"/>
		<result property="unitMedicalSet" column="UNIT_MEDICAL_SET"/>
		<result property="unitUnemploymentSet" column="UNIT_UNEMPLOYMENT_SET"/>
		<result property="unitInjurySet" column="UNIT_INJURY_SET"/>
		<result property="unitBirthSet" column="UNIT_BIRTH_SET"/>
		<result property="unitPensionPer" column="UNIT_PENSION_PER"/>
		<result property="unitMedicalPer" column="UNIT_MEDICAL_PER"/>
		<result property="unitUnemploymentPer" column="UNIT_UNEMPLOYMENT_PER"/>
		<result property="unitInjuryPer" column="UNIT_INJURY_PER"/>
		<result property="unitBirthPer" column="UNIT_BIRTH_PER"/>
		<result property="personalPensionPer" column="PERSONAL_PENSION_PER"/>
		<result property="personalMedicalPer" column="PERSONAL_MEDICAL_PER"/>
		<result property="personalUnemploymentPer" column="PERSONAL_UNEMPLOYMENT_PER"/>
		<result property="unitBigailmentPer" column="UNIT_BIGAILMENT_PER"/>
		<result property="personalBigailmentPer" column="PERSONAL_BIGAILMENT_PER"/>
		<result property="unitPensionMoney" column="UNIT_PENSION_MONEY"/>
		<result property="unitMedicalMoney" column="UNIT_MEDICAL_MONEY"/>
		<result property="unitUnemploymentMoney" column="UNIT_UNEMPLOYMENT_MONEY"/>
		<result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
		<result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
		<result property="unitBigmailmentMoney" column="UNIT_BIGMAILMENT_MONEY"/>
		<result property="personalPensionMoney" column="PERSONAL_PENSION_MONEY"/>
		<result property="personalMedicalMoney" column="PERSONAL_MEDICAL_MONEY"/>
		<result property="personalUnemploymentMoney" column="PERSONAL_UNEMPLOYMENT_MONEY"/>
		<result property="personalBigmailmentMoney" column="PERSONAL_BIGMAILMENT_MONEY"/>
		<result property="providentNo" column="PROVIDENT_NO"/>
		<result property="salarySocialFlag" column="SALARY_SOCIAL_FLAG"/>
		<result property="salaryFundFlag" column="SALARY_FUND_FLAG"/>
		<result property="unitProvidentSet" column="UNIT_PROVIDENT_SET"/>
		<result property="providentPercent" column="PROVIDENT_PERCENT"/>
		<result property="unitProvidentSum" column="UNIT_PROVIDENT_SUM"/>
		<result property="personalProidentSet" column="PERSONAL_PROIDENT_SET"/>
		<result property="personalProvidentSum" column="PERSONAL_PROVIDENT_SUM"/>
		<result property="createBy" column="CREATE_BY"/>
		<result property="updateTime" column="UPDATE_TIME"/>
		<result property="updateBy" column="UPDATE_BY"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="createTime" column="CREATE_TIME"/>
		<result property="incomeStatus" column="INCOME_STATUS"/>
		<result property="isIncomeStatus" column="IS_INCOME_STATUS"/>
		<result property="incomeSettleFlag" column="INCOME_SETTLE_FLAG"/>
		<result property="incomeCollectFlag" column="INCOME_COLLECT_FLAG"/>
		<result property="paySettleFlag" column="PAY_SETTLE_FLAG"/>
		<result property="payCollectFlag" column="PAY_COLLECT_FLAG"/>
		<result property="bpoFlag" column="BPO_FLAG"/>
		<result property="secondIndicatorBelong" column="SECOND_INDICATOR_BELONG"/>
	</resultMap>
	<resultMap id="tPaymentInfoSumMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoExportVo">
		<result property="empName" column="EMP_NAME"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
		<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
		<result property="socialSecurityNo" column="SOCIAL_SECURITY_NO"/>
		<result property="socialPayAddr" column="SOCIAL_PAY_ADDR"/>
		<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
		<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
		<result property="sumAll" column="SUM_ALL"/>
		<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
		<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
		<result property="providentHousehold" column="PROVIDENT_HOUSEHOLD"/>
		<result property="providentPayAddr" column="PROVIDENT_PAY_ADDR"/>
		<result property="socialSum" column="SOCIAL_SUM"/>
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="socialSecurityPersonalSum" column="SOCIAL_SECURITY_PERSONAL_SUM"/>
		<result property="providentSum" column="PROVIDENT_SUM"/>
		<result property="inauguralTeam" column="INAUGURAL_TEAM"/>
		<result property="companyAccrual" column="COMPANY_ACCRUAL"/>
		<result property="personalAccrual" column="PERSONAL_ACCRUAL"/>
		<result property="unitPensionSet" column="UNIT_PENSION_SET"/>
		<result property="unitMedicalSet" column="UNIT_MEDICAL_SET"/>
		<result property="unitUnemploymentSet" column="UNIT_UNEMPLOYMENT_SET"/>
		<result property="unitInjurySet" column="UNIT_INJURY_SET"/>
		<result property="unitBirthSet" column="UNIT_BIRTH_SET"/>
		<result property="unitPensionMoney" column="UNIT_PENSION_MONEY"/>
		<result property="unitMedicalMoney" column="UNIT_MEDICAL_MONEY"/>
		<result property="unitUnemploymentMoney" column="UNIT_UNEMPLOYMENT_MONEY"/>
		<result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
		<result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
		<result property="unitBigmailmentMoney" column="UNIT_BIGMAILMENT_MONEY"/>
		<result property="personalPensionMoney" column="PERSONAL_PENSION_MONEY"/>
		<result property="personalMedicalMoney" column="PERSONAL_MEDICAL_MONEY"/>
		<result property="personalUnemploymentMoney" column="PERSONAL_UNEMPLOYMENT_MONEY"/>
		<result property="personalBigmailmentMoney" column="PERSONAL_BIGMAILMENT_MONEY"/>
		<result property="providentNo" column="PROVIDENT_NO"/>
		<result property="unitProvidentSet" column="UNIT_PROVIDENT_SET"/>
		<result property="providentPercent" column="PROVIDENT_PERCENT"/>
		<result property="unitProvidentSum" column="UNIT_PROVIDENT_SUM"/>
		<result property="personalProidentSet" column="PERSONAL_PROIDENT_SET"/>
		<result property="socialCreateName" column="SOCIAL_CREATE_NAME"/>
		<result property="socialCreateTime" column="SOCIAL_CREATE_TIME"/>
		<result property="fundCreateName" column="FUND_CREATE_NAME"/>
		<result property="fundCreateTime" column="FUND_CREATE_TIME"/>
		<result property="personalProvidentSum" column="PERSONAL_PROVIDENT_SUM"/>
		<result property="keyGroup" column="keyGroup"/>
	</resultMap>

	<resultMap id="tPaymentInfoSumPushMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoPushVo">
		<result property="ids" column="ids"/>
		<result property="id" column="ID"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
		<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
		<result property="socialPayAddr" column="SOCIAL_PAY_ADDR"/>
		<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
		<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
		<result property="sumAll" column="SUM_ALL"/>
		<result property="socialSum" column="SOCIAL_SUM"/>
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="socialSecurityPersonalSum" column="SOCIAL_SECURITY_PERSONAL_SUM"/>
		<result property="companyAccrual" column="COMPANY_ACCRUAL"/>
		<result property="personalAccrual" column="PERSONAL_ACCRUAL"/>
		<result property="unitPensionMoney" column="UNIT_PENSION_MONEY"/>
		<result property="unitMedicalMoney" column="UNIT_MEDICAL_MONEY"/>
		<result property="unitUnemploymentMoney" column="UNIT_UNEMPLOYMENT_MONEY"/>
		<result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
		<result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
		<result property="unitBigmailmentMoney" column="UNIT_BIGMAILMENT_MONEY"/>
		<result property="personalPensionMoney" column="PERSONAL_PENSION_MONEY"/>
		<result property="personalMedicalMoney" column="PERSONAL_MEDICAL_MONEY"/>
		<result property="personalUnemploymentMoney" column="PERSONAL_UNEMPLOYMENT_MONEY"/>
		<result property="personalBigmailmentMoney" column="PERSONAL_BIGMAILMENT_MONEY"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="createTime" column="CREATE_TIME"/>
		<result property="bpoFlag" column="BPO_FLAG"/>
	</resultMap>

	<resultMap id="tPaymentInfoBatchMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoBatchVo">
		<result property="empName" column="EMP_NAME"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
		<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
		<result property="socialSecurityNo" column="SOCIAL_SECURITY_NO"/>
		<result property="socialPayAddr" column="SOCIAL_PAY_ADDR"/>
		<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
		<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
		<result property="lockStatus" column="LOCK_STATUS"/>
		<result property="pushStatus" column="PUSH_STATUS"/>
		<result property="sumAll" column="SUM_ALL"/>
		<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
		<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
		<result property="providentHousehold" column="PROVIDENT_HOUSEHOLD"/>
		<result property="providentPayAddr" column="PROVIDENT_PAY_ADDR"/>
		<result property="socialSum" column="SOCIAL_SUM"/>
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="socialSecurityPersonalSum" column="SOCIAL_SECURITY_PERSONAL_SUM"/>
		<result property="providentSum" column="PROVIDENT_SUM"/>
		<result property="inauguralTeam" column="INAUGURAL_TEAM"/>
		<result property="companyAccrual" column="COMPANY_ACCRUAL"/>
		<result property="personalAccrual" column="PERSONAL_ACCRUAL"/>
		<result property="unitPensionSet" column="UNIT_PENSION_SET"/>
		<result property="unitMedicalSet" column="UNIT_MEDICAL_SET"/>
		<result property="unitUnemploymentSet" column="UNIT_UNEMPLOYMENT_SET"/>
		<result property="unitInjurySet" column="UNIT_INJURY_SET"/>
		<result property="unitBirthSet" column="UNIT_BIRTH_SET"/>
		<result property="unitPensionPer" column="UNIT_PENSION_PER"/>
		<result property="unitMedicalPer" column="UNIT_MEDICAL_PER"/>
		<result property="unitUnemploymentPer" column="UNIT_UNEMPLOYMENT_PER"/>
		<result property="unitInjuryPer" column="UNIT_INJURY_PER"/>
		<result property="unitBirthPer" column="UNIT_BIRTH_PER"/>
		<result property="personalPensionPer" column="PERSONAL_PENSION_PER"/>
		<result property="personalMedicalPer" column="PERSONAL_MEDICAL_PER"/>
		<result property="personalUnemploymentPer" column="PERSONAL_UNEMPLOYMENT_PER"/>
		<result property="unitBigailmentPer" column="UNIT_BIGAILMENT_PER"/>
		<result property="personalBigailmentPer" column="PERSONAL_BIGAILMENT_PER"/>
		<result property="unitPensionMoney" column="UNIT_PENSION_MONEY"/>
		<result property="unitMedicalMoney" column="UNIT_MEDICAL_MONEY"/>
		<result property="unitUnemploymentMoney" column="UNIT_UNEMPLOYMENT_MONEY"/>
		<result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
		<result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
		<result property="unitBigmailmentMoney" column="UNIT_BIGMAILMENT_MONEY"/>
		<result property="personalPensionMoney" column="PERSONAL_PENSION_MONEY"/>
		<result property="personalMedicalMoney" column="PERSONAL_MEDICAL_MONEY"/>
		<result property="personalUnemploymentMoney" column="PERSONAL_UNEMPLOYMENT_MONEY"/>
		<result property="personalBigmailmentMoney" column="PERSONAL_BIGMAILMENT_MONEY"/>
		<result property="providentNo" column="PROVIDENT_NO"/>
		<result property="unitProvidentSet" column="UNIT_PROVIDENT_SET"/>
		<result property="providentPercent" column="PROVIDENT_PERCENT"/>
		<result property="unitProvidentSum" column="UNIT_PROVIDENT_SUM"/>
		<result property="personalProidentSet" column="PERSONAL_PROIDENT_SET"/>
		<result property="personalProvidentSum" column="PERSONAL_PROVIDENT_SUM"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="createTime" column="CREATE_TIME"/>
	</resultMap>

	<resultMap id="tPaymentInfoNewMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoNewVo">
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
		<result property="socialSecurityNo" column="SOCIAL_SECURITY_NO"/>
		<result property="socialPayAddr" column="SOCIAL_PAY_ADDR"/>
		<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
		<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
		<result property="sumAll" column="SUM_ALL"/>
		<result property="providentHousehold" column="PROVIDENT_HOUSEHOLD"/>
		<result property="providentPayAddr" column="PROVIDENT_PAY_ADDR"/>
		<result property="socialSum" column="SOCIAL_SUM"/>
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="socialSecurityPersonalSum" column="SOCIAL_SECURITY_PERSONAL_SUM"/>
		<result property="providentSum" column="PROVIDENT_SUM"/>
		<result property="companyAccrual" column="COMPANY_ACCRUAL"/>
		<result property="personalAccrual" column="PERSONAL_ACCRUAL"/>
		<result property="unitPensionSet" column="UNIT_PENSION_SET"/>
		<result property="unitMedicalSet" column="UNIT_MEDICAL_SET"/>
		<result property="unitUnemploymentSet" column="UNIT_UNEMPLOYMENT_SET"/>
		<result property="unitInjurySet" column="UNIT_INJURY_SET"/>
		<result property="unitBirthSet" column="UNIT_BIRTH_SET"/>
		<result property="unitPensionMoney" column="UNIT_PENSION_MONEY"/>
		<result property="unitMedicalMoney" column="UNIT_MEDICAL_MONEY"/>
		<result property="unitUnemploymentMoney" column="UNIT_UNEMPLOYMENT_MONEY"/>
		<result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
		<result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
		<result property="unitBigmailmentMoney" column="UNIT_BIGMAILMENT_MONEY"/>
		<result property="personalPensionMoney" column="PERSONAL_PENSION_MONEY"/>
		<result property="personalMedicalMoney" column="PERSONAL_MEDICAL_MONEY"/>
		<result property="personalUnemploymentMoney" column="PERSONAL_UNEMPLOYMENT_MONEY"/>
		<result property="personalBigmailmentMoney" column="PERSONAL_BIGMAILMENT_MONEY"/>
		<result property="pensionMoneySum" column="PENSION_MONEY_SUM"/>
		<result property="medicalMoneySum" column="MEDICAL_MONEY_SUM"/>
		<result property="unemploymentMoneySum" column="UNEMPLOYMENT_MONEY_SUM"/>
		<result property="bigmailmentMoneySum" column="BIGMAILMENT_MONEY_SUM"/>
		<result property="accrualSum" column="ACCRUAL_SUM"/>
		<result property="providentNo" column="PROVIDENT_NO"/>
		<result property="unitProvidentSet" column="UNIT_PROVIDENT_SET"/>
		<result property="providentPercent" column="PROVIDENT_PERCENT"/>
		<result property="unitProvidentSum" column="UNIT_PROVIDENT_SUM"/>
		<result property="personalProidentSet" column="PERSONAL_PROIDENT_SET"/>
		<result property="personalProvidentSum" column="PERSONAL_PROVIDENT_SUM"/>
		<result property="unitSocialFundSum" column="UNIT_SOCIAL_FUND_SUM"/>
		<result property="socialFundPersonalSum" column="SOCIAL_FUND_PERSONAL_SUM"/>
		<result property="keyGroup" column="keyGroup"/>
		<result property="secondIndicatorBelong" column="SECOND_INDICATOR_BELONG"/>
		<result property="unitPensionPer" column="UNIT_PENSION_PER"/>
		<result property="unitMedicalPer" column="UNIT_MEDICAL_PER"/>
		<result property="unitUnemploymentPer" column="UNIT_UNEMPLOYMENT_PER"/>
		<result property="unitInjuryPer" column="UNIT_INJURY_PER"/>
		<result property="unitBirthPer" column="UNIT_BIRTH_PER"/>
		<result property="personalPensionPer" column="PERSONAL_PENSION_PER"/>
		<result property="personalMedicalPer" column="PERSONAL_MEDICAL_PER"/>
		<result property="personalUnemploymentPer" column="PERSONAL_UNEMPLOYMENT_PER"/>
	</resultMap>

	<resultMap id="tPaymentInfoNewExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoNewExportVo">
		<result property="empName" column="EMP_NAME"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
		<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
		<result property="socialSecurityNo" column="SOCIAL_SECURITY_NO"/>
		<result property="socialPayAddr" column="SOCIAL_PAY_ADDR"/>
		<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
		<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
		<result property="sumAll" column="SUM_ALL"/>
		<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
		<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
		<result property="providentHousehold" column="PROVIDENT_HOUSEHOLD"/>
		<result property="providentPayAddr" column="PROVIDENT_PAY_ADDR"/>
		<result property="socialSum" column="SOCIAL_SUM"/>
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="socialSecurityPersonalSum" column="SOCIAL_SECURITY_PERSONAL_SUM"/>
		<result property="providentSum" column="PROVIDENT_SUM"/>
		<result property="inauguralTeam" column="INAUGURAL_TEAM"/>
		<result property="companyAccrual" column="COMPANY_ACCRUAL"/>
		<result property="personalAccrual" column="PERSONAL_ACCRUAL"/>
		<result property="unitPensionSet" column="UNIT_PENSION_SET"/>
		<result property="unitMedicalSet" column="UNIT_MEDICAL_SET"/>
		<result property="unitUnemploymentSet" column="UNIT_UNEMPLOYMENT_SET"/>
		<result property="unitInjurySet" column="UNIT_INJURY_SET"/>
		<result property="unitBirthSet" column="UNIT_BIRTH_SET"/>
		<result property="unitPensionMoney" column="UNIT_PENSION_MONEY"/>
		<result property="unitMedicalMoney" column="UNIT_MEDICAL_MONEY"/>
		<result property="unitUnemploymentMoney" column="UNIT_UNEMPLOYMENT_MONEY"/>
		<result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
		<result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
		<result property="unitBigmailmentMoney" column="UNIT_BIGMAILMENT_MONEY"/>
		<result property="personalPensionMoney" column="PERSONAL_PENSION_MONEY"/>
		<result property="personalMedicalMoney" column="PERSONAL_MEDICAL_MONEY"/>
		<result property="personalUnemploymentMoney" column="PERSONAL_UNEMPLOYMENT_MONEY"/>
		<result property="personalBigmailmentMoney" column="PERSONAL_BIGMAILMENT_MONEY"/>
		<result property="providentNo" column="PROVIDENT_NO"/>
		<result property="unitProvidentSet" column="UNIT_PROVIDENT_SET"/>
		<result property="providentPercent" column="PROVIDENT_PERCENT"/>
		<result property="unitProvidentSum" column="UNIT_PROVIDENT_SUM"/>
		<result property="personalProidentSet" column="PERSONAL_PROIDENT_SET"/>
		<result property="personalProvidentSum" column="PERSONAL_PROVIDENT_SUM"/>
		<result property="keyGroup" column="keyGroup"/>
		<result property="secondIndicatorBelong" column="SECOND_INDICATOR_BELONG"/>
		<result property="unitPensionPer" column="UNIT_PENSION_PER"/>
		<result property="unitMedicalPer" column="UNIT_MEDICAL_PER"/>
		<result property="unitUnemploymentPer" column="UNIT_UNEMPLOYMENT_PER"/>
		<result property="unitInjuryPer" column="UNIT_INJURY_PER"/>
		<result property="unitBirthPer" column="UNIT_BIRTH_PER"/>
		<result property="personalPensionPer" column="PERSONAL_PENSION_PER"/>
		<result property="personalMedicalPer" column="PERSONAL_MEDICAL_PER"/>
		<result property="personalUnemploymentPer" column="PERSONAL_UNEMPLOYMENT_PER"/>
		<result property="pensionMoneySum" column="PENSION_MONEY_SUM"/>
		<result property="medicalMoneySum" column="MEDICAL_MONEY_SUM"/>
		<result property="unemploymentMoneySum" column="UNEMPLOYMENT_MONEY_SUM"/>
		<result property="injuryMoneySum" column="INJURY_MONEY_SUM"/>
		<result property="birthMoneySum" column="BIRTH_MONEY_SUM"/>
		<result property="bigmailmentMoneySum" column="BIGMAILMENT_MONEY_SUM"/>
	</resultMap>
	<sql id="Base_Column_List">
		a.ID,
                a.EMP_NAME,
                a.EMP_NO,
                a.EMP_ID,
                a.EMP_IDCARD,
                a.UNIT_ID,
                a.UNIT_NAME,
                a.SETTLE_DOMAIN_CODE,
                a.SETTLE_DOMAIN_NAME,
                a.SETTLE_DOMAIN_ID,
                a.SOCIAL_HOUSEHOLD,
                a.SOCIAL_SECURITY_NO,
                a.SOCIAL_PAY_ADDR,
                a.SOCIAL_PAY_MONTH,
                a.SOCIAL_CREATE_MONTH,
                a.LOCK_STATUS,
                a.PUSH_STATUS,
                a.SUM_ALL,
                a.PROVIDENT_PAY_MONTH,
                a.PROVIDENT_CREATE_MONTH,
                a.PROVIDENT_HOUSEHOLD,
                a.PROVIDENT_PAY_ADDR,
                a.FUND_PROVINCE,
                a.FUND_CITY,
                a.FUND_TOWN,
                a.SOCIAL_PROVINCE,
                a.SOCIAL_CITY,
                a.SOCIAL_TOWN,
                a.SOCIAL_ID,
                a.FUND_ID,
                a.SOCIAL_SUM,
                a.UNIT_SOCIAL_SUM,
                a.SOCIAL_SECURITY_PERSONAL_SUM,
                a.PROVIDENT_SUM,
                a.INAUGURAL_TEAM,
                a.SALARY_SOCIAL_FLAG,
        		a.SALARY_FUND_FLAG,
                a.COMPANY_ACCRUAL,
                a.PERSONAL_ACCRUAL,
                a.UNIT_PENSION_SET,
                a.UNIT_MEDICAL_SET,
                a.UNIT_UNEMPLOYMENT_SET,
                a.UNIT_INJURY_SET,
                a.UNIT_BIRTH_SET,
                a.UNIT_PENSION_PER,
                a.UNIT_MEDICAL_PER,
                a.UNIT_UNEMPLOYMENT_PER,
                a.UNIT_INJURY_PER,
                a.UNIT_BIRTH_PER,
                a.PERSONAL_PENSION_PER,
                a.PERSONAL_MEDICAL_PER,
                a.PERSONAL_UNEMPLOYMENT_PER,
                a.UNIT_BIGAILMENT_PER,
                a.PERSONAL_BIGAILMENT_PER,
                a.UNIT_PENSION_MONEY,
                a.UNIT_MEDICAL_MONEY,
                a.UNIT_UNEMPLOYMENT_MONEY,
                a.UNIT_INJURY_MONEY,
                a.UNIT_BIRTH_MONEY,
                a.UNIT_BIGMAILMENT_MONEY,
                a.PERSONAL_PENSION_MONEY,
                a.PERSONAL_MEDICAL_MONEY,
                a.PERSONAL_UNEMPLOYMENT_MONEY,
                a.PERSONAL_BIGMAILMENT_MONEY,
                a.PROVIDENT_NO,
                a.UNIT_PROVIDENT_SET,
                a.PROVIDENT_PERCENT,
                a.UNIT_PROVIDENT_SUM,
                a.PERSONAL_PROIDENT_SET,
                a.PERSONAL_PROVIDENT_SUM,
                a.CREATE_BY,
                a.UPDATE_TIME,
                a.UPDATE_BY,
                a.CREATE_NAME,
                a.BPO_FLAG,
                a.CREATE_TIME
	</sql>
	<sql id="tPaymentInfo_where">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.id != null and tPaymentInfo.id.trim() != ''">
				AND a.ID = #{tPaymentInfo.id}
			</if>
			<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
				AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
			</if>
			<if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''">
				AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%')
			</if>
			<if test="tPaymentInfo.empId != null and tPaymentInfo.empId.trim() != ''">
				AND a.EMP_ID = #{tPaymentInfo.empId}
			</if>
			<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
				AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
			</if>
			<if test="tPaymentInfo.unitId != null and tPaymentInfo.unitId.trim() != ''">
				AND a.UNIT_ID = #{tPaymentInfo.unitId}
			</if>
			<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
				AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
			</if>
			<if test="tPaymentInfo.settleDomainCode != null and tPaymentInfo.settleDomainCode.trim() != ''">
				AND a.SETTLE_DOMAIN_CODE = #{tPaymentInfo.settleDomainCode}
			</if>
			<if test="tPaymentInfo.unitName != null and tPaymentInfo.unitName.trim() != ''">
				AND a.UNIT_NAME = #{tPaymentInfo.unitName}
			</if>
			<if test="tPaymentInfo.settleDomainId != null and tPaymentInfo.settleDomainId.trim() != ''">
				AND a.SETTLE_DOMAIN_ID = #{tPaymentInfo.settleDomainId}
			</if>
			<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
				AND a.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
			</if>
			<if test="tPaymentInfo.socialSecurityNo != null and tPaymentInfo.socialSecurityNo.trim() != ''">
				AND a.SOCIAL_SECURITY_NO like CONCAT(#{tPaymentInfo.socialSecurityNo},'%')
			</if>
			<if test="tPaymentInfo.socialPayAddr != null and tPaymentInfo.socialPayAddr.trim() != ''">
				AND a.SOCIAL_PAY_ADDR = #{tPaymentInfo.socialPayAddr}
			</if>
			<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
				AND (a.SOCIAL_PAY_MONTH = '${tPaymentInfo.socialPayMonth}' or a.PROVIDENT_PAY_MONTH = '${tPaymentInfo.socialPayMonth}')
			</if>
			<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
				AND (a.SOCIAL_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}' or a.PROVIDENT_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}')
			</if>
			<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
				AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
			</if>
			<if test="tPaymentInfo.pushStatus != null and tPaymentInfo.pushStatus.trim() != ''">
				AND a.PUSH_STATUS = #{tPaymentInfo.pushStatus}
			</if>
			<if test="tPaymentInfo.sumAll != null">
				AND a.SUM_ALL = #{tPaymentInfo.sumAll}
			</if>
			<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
				AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
			</if>
			<if test="tPaymentInfo.providentPayAddr != null and tPaymentInfo.providentPayAddr.trim() != ''">
				AND a.PROVIDENT_PAY_ADDR = #{tPaymentInfo.providentPayAddr}
			</if>
			<!-- 区域 默认精准查询 0    包含下级查询 1 开始 2023-03-02 fxj -->
			<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
				<if test="tPaymentInfo.socialTown == null">
					<if test="tPaymentInfo.socialCity != null">
						AND (a.SOCIAL_CITY = '${tPaymentInfo.socialCity}' or a.FUND_CITY = '${tPaymentInfo.socialCity}')
					</if>
					<if test="tPaymentInfo.socialCity == null">
						<if test="tPaymentInfo.socialProvince != null">
							AND (a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' or a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}')
						</if>
					</if>
				</if>
				<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
					AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
				</if>
			</if>
			<if test='tPaymentInfo.areaFlag == "0"'>
				<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
					AND (
					(a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY =''))
					or
					(a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY =''))
					)
				</if>
				<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
					AND (
					(a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'  and (a.SOCIAL_TOWN is null  or a.SOCIAL_TOWN =''))
					or
					(a.FUND_CITY = '${tPaymentInfo.socialCity}' and  (a.FUND_TOWN is null or a.FUND_TOWN =''))
					)
				</if>
				<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
					AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
				</if>
			</if>
			<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->


			<if test="tPaymentInfo.socialId != null and tPaymentInfo.socialId.trim() != ''">
				AND a.SOCIAL_ID = #{tPaymentInfo.socialId}
			</if>
			<if test="tPaymentInfo.fundId != null and tPaymentInfo.fundId.trim() != ''">
				AND a.FUND_ID = #{tPaymentInfo.fundId}
			</if>
			<if test="tPaymentInfo.socialSum != null">
				AND a.SOCIAL_SUM = #{tPaymentInfo.socialSum}
			</if>
			<if test="tPaymentInfo.unitSocialSum != null">
				AND a.UNIT_SOCIAL_SUM = #{tPaymentInfo.unitSocialSum}
			</if>
			<if test="tPaymentInfo.socialSecurityPersonalSum != null">
				AND a.SOCIAL_SECURITY_PERSONAL_SUM = #{tPaymentInfo.socialSecurityPersonalSum}
			</if>
			<if test="tPaymentInfo.providentSum != null">
				AND a.PROVIDENT_SUM = #{tPaymentInfo.providentSum}
			</if>
			<if test="tPaymentInfo.inauguralTeam != null and tPaymentInfo.inauguralTeam.trim() != ''">
				AND a.INAUGURAL_TEAM = #{tPaymentInfo.inauguralTeam}
			</if>
			<if test="tPaymentInfo.companyAccrual != null">
				AND a.COMPANY_ACCRUAL = #{tPaymentInfo.companyAccrual}
			</if>
			<if test="tPaymentInfo.personalAccrual != null">
				AND a.PERSONAL_ACCRUAL = #{tPaymentInfo.personalAccrual}
			</if>
			<if test="tPaymentInfo.unitPensionSet != null">
				AND a.UNIT_PENSION_SET = #{tPaymentInfo.unitPensionSet}
			</if>
			<if test="tPaymentInfo.unitMedicalSet != null">
				AND a.UNIT_MEDICAL_SET = #{tPaymentInfo.unitMedicalSet}
			</if>
			<if test="tPaymentInfo.unitUnemploymentSet != null">
				AND a.UNIT_UNEMPLOYMENT_SET = #{tPaymentInfo.unitUnemploymentSet}
			</if>
			<if test="tPaymentInfo.unitInjurySet != null">
				AND a.UNIT_INJURY_SET = #{tPaymentInfo.unitInjurySet}
			</if>
			<if test="tPaymentInfo.unitBirthSet != null">
				AND a.UNIT_BIRTH_SET = #{tPaymentInfo.unitBirthSet}
			</if>
			<if test="tPaymentInfo.unitPensionPer != null">
				AND a.UNIT_PENSION_PER = #{tPaymentInfo.unitPensionPer}
			</if>
			<if test="tPaymentInfo.unitMedicalPer != null">
				AND a.UNIT_MEDICAL_PER = #{tPaymentInfo.unitMedicalPer}
			</if>
			<if test="tPaymentInfo.unitUnemploymentPer != null">
				AND a.UNIT_UNEMPLOYMENT_PER = #{tPaymentInfo.unitUnemploymentPer}
			</if>
			<if test="tPaymentInfo.unitInjuryPer != null">
				AND a.UNIT_INJURY_PER = #{tPaymentInfo.unitInjuryPer}
			</if>
			<if test="tPaymentInfo.unitBirthPer != null">
				AND a.UNIT_BIRTH_PER = #{tPaymentInfo.unitBirthPer}
			</if>
			<if test="tPaymentInfo.personalPensionPer != null">
				AND a.PERSONAL_PENSION_PER = #{tPaymentInfo.personalPensionPer}
			</if>
			<if test="tPaymentInfo.personalMedicalPer != null">
				AND a.PERSONAL_MEDICAL_PER = #{tPaymentInfo.personalMedicalPer}
			</if>
			<if test="tPaymentInfo.personalUnemploymentPer != null">
				AND a.PERSONAL_UNEMPLOYMENT_PER = #{tPaymentInfo.personalUnemploymentPer}
			</if>
			<if test="tPaymentInfo.unitBigailmentPer != null">
				AND a.UNIT_BIGAILMENT_PER = #{tPaymentInfo.unitBigailmentPer}
			</if>
			<if test="tPaymentInfo.personalBigailmentPer != null">
				AND a.PERSONAL_BIGAILMENT_PER = #{tPaymentInfo.personalBigailmentPer}
			</if>
			<if test="tPaymentInfo.unitPensionMoney != null">
				AND a.UNIT_PENSION_MONEY = #{tPaymentInfo.unitPensionMoney}
			</if>
			<if test="tPaymentInfo.unitMedicalMoney != null">
				AND a.UNIT_MEDICAL_MONEY = #{tPaymentInfo.unitMedicalMoney}
			</if>
			<if test="tPaymentInfo.unitUnemploymentMoney != null">
				AND a.UNIT_UNEMPLOYMENT_MONEY = #{tPaymentInfo.unitUnemploymentMoney}
			</if>
			<if test="tPaymentInfo.unitInjuryMoney != null">
				AND a.UNIT_INJURY_MONEY = #{tPaymentInfo.unitInjuryMoney}
			</if>
			<if test="tPaymentInfo.unitBirthMoney != null">
				AND a.UNIT_BIRTH_MONEY = #{tPaymentInfo.unitBirthMoney}
			</if>
			<if test="tPaymentInfo.unitBigmailmentMoney != null">
				AND a.UNIT_BIGMAILMENT_MONEY = #{tPaymentInfo.unitBigmailmentMoney}
			</if>
			<if test="tPaymentInfo.personalPensionMoney != null">
				AND a.PERSONAL_PENSION_MONEY = #{tPaymentInfo.personalPensionMoney}
			</if>
			<if test="tPaymentInfo.personalMedicalMoney != null">
				AND a.PERSONAL_MEDICAL_MONEY = #{tPaymentInfo.personalMedicalMoney}
			</if>
			<if test="tPaymentInfo.personalUnemploymentMoney != null">
				AND a.PERSONAL_UNEMPLOYMENT_MONEY = #{tPaymentInfo.personalUnemploymentMoney}
			</if>
			<if test="tPaymentInfo.personalBigmailmentMoney != null">
				AND a.PERSONAL_BIGMAILMENT_MONEY = #{tPaymentInfo.personalBigmailmentMoney}
			</if>
			<if test="tPaymentInfo.providentNo != null and tPaymentInfo.providentNo.trim() != ''">
				AND a.PROVIDENT_NO = #{tPaymentInfo.providentNo}
			</if>
			<if test="tPaymentInfo.unitProvidentSet != null">
				AND a.UNIT_PROVIDENT_SET = #{tPaymentInfo.unitProvidentSet}
			</if>
			<if test="tPaymentInfo.providentPercent != null">
				AND a.PROVIDENT_PERCENT = #{tPaymentInfo.providentPercent}
			</if>
			<if test="tPaymentInfo.unitProvidentSum != null">
				AND a.UNIT_PROVIDENT_SUM = #{tPaymentInfo.unitProvidentSum}
			</if>
			<if test="tPaymentInfo.personalProidentSet != null">
				AND a.PERSONAL_PROIDENT_SET = #{tPaymentInfo.personalProidentSet}
			</if>
			<if test="tPaymentInfo.personalProvidentSum != null">
				AND a.PERSONAL_PROVIDENT_SUM = #{tPaymentInfo.personalProvidentSum}
			</if>
			<if test="tPaymentInfo.createBy != null and tPaymentInfo.createBy.trim() != ''">
				AND a.CREATE_BY = #{tPaymentInfo.createBy}
			</if>
			<if test="tPaymentInfo.updateTime != null">
				AND a.UPDATE_TIME = #{tPaymentInfo.updateTime}
			</if>
			<if test="tPaymentInfo.updateBy != null and tPaymentInfo.updateBy.trim() != ''">
				AND a.UPDATE_BY = #{tPaymentInfo.updateBy}
			</if>
			<if test="tPaymentInfo.createName != null and tPaymentInfo.createName.trim() != ''">
				AND a.CREATE_NAME = #{tPaymentInfo.createName}
			</if>
			<if test="tPaymentInfo.createTimeStart != null and tPaymentInfo.createTimeEnd != null">
				AND a.CREATE_TIME BETWEEN #{tPaymentInfo.createTimeStart} AND #{tPaymentInfo.createTimeEnd}
			</if>
		</if>
	</sql>

	<sql id="tPaymentInfo_export_where">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList != null">
				AND a.id in
				<foreach item="idStr" index="index" collection="tPaymentInfo.idList" open="(" separator="," close=")">
					#{idStr}
				</foreach>
			</if>
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.pushStatus != null and tPaymentInfo.pushStatus.trim() != ''">
					AND a.PUSH_STATUS = #{tPaymentInfo.pushStatus}
				</if>
				<if test="tPaymentInfo.id != null and tPaymentInfo.id.trim() != ''">
					AND a.ID = #{tPaymentInfo.id}
				</if>
				<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
					AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
				</if>
				<if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''">
					AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%')
				</if>
				<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
				</if>
				<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
					AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
				</if>
				<if test="tPaymentInfo.settleDomainCode != null and tPaymentInfo.settleDomainCode.trim() != ''">
					AND a.SETTLE_DOMAIN_CODE = #{tPaymentInfo.settleDomainCode}
				</if>
				<if test="tPaymentInfo.unitName != null and tPaymentInfo.unitName.trim() != ''">
					AND a.UNIT_NAME = #{tPaymentInfo.unitName}
				</if>
				<if test="tPaymentInfo.settleDomainId != null and tPaymentInfo.settleDomainId.trim() != ''">
					AND a.SETTLE_DOMAIN_ID = #{tPaymentInfo.settleDomainId}
				</if>
				<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
					AND a.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
				</if>
				<if test="tPaymentInfo.socialSecurityNo != null and tPaymentInfo.socialSecurityNo.trim() != ''">
					AND a.SOCIAL_SECURITY_NO like CONCAT(#{tPaymentInfo.socialSecurityNo},'%')
				</if>
				<if test="tPaymentInfo.socialPayAddr != null and tPaymentInfo.socialPayAddr.trim() != ''">
					AND a.SOCIAL_PAY_ADDR = #{tPaymentInfo.socialPayAddr}
				</if>
				<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND (a.SOCIAL_PAY_MONTH = '${tPaymentInfo.socialPayMonth}' or a.PROVIDENT_PAY_MONTH = '${tPaymentInfo.socialPayMonth}')
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND (a.SOCIAL_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}' or a.PROVIDENT_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}')
				</if>
				<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
					AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
				</if>
				<if test="tPaymentInfo.providentPayAddr != null and tPaymentInfo.providentPayAddr.trim() != ''">
					AND a.PROVIDENT_PAY_ADDR = #{tPaymentInfo.providentPayAddr}
				</if>
				<if test="tPaymentInfo.fundProvince != null and tPaymentInfo.fundProvince.trim() != ''">
					AND a.FUND_PROVINCE = #{tPaymentInfo.fundProvince}
				</if>
				<if test="tPaymentInfo.fundCity != null and tPaymentInfo.fundCity.trim() != ''">
					AND a.FUND_CITY = #{tPaymentInfo.fundCity}
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 开始 2023-03-02 fxj -->
				<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
					<if test="tPaymentInfo.socialTown == null">
						<if test="tPaymentInfo.socialCity != null">
							AND (a.SOCIAL_CITY = '${tPaymentInfo.socialCity}' or a.FUND_CITY = '${tPaymentInfo.socialCity}')
						</if>
						<if test="tPaymentInfo.socialCity == null">
							<if test="tPaymentInfo.socialProvince != null">
								AND (a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' or a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}')
							</if>
						</if>
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
					</if>
				</if>
				<if test='tPaymentInfo.areaFlag == "0"'>
					<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
						AND (
						(a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY =''))
						or
						(a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY =''))
						)
					</if>
					<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
						AND (
						(a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'  and (a.SOCIAL_TOWN is null  or a.SOCIAL_TOWN =''))
						or
						(a.FUND_CITY = '${tPaymentInfo.socialCity}' and (a.FUND_TOWN is null or a.FUND_TOWN =''))
						)
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
					</if>
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->

				<if test="tPaymentInfo.providentNo != null and tPaymentInfo.providentNo.trim() != ''">
					AND a.PROVIDENT_NO = #{tPaymentInfo.providentNo}
				</if>
				<if test="tPaymentInfo.createName != null and tPaymentInfo.createName.trim() != ''">
					AND a.CREATE_NAME = #{tPaymentInfo.createName}
				</if>
				<if test="tPaymentInfo.createTimeStart != null and tPaymentInfo.createTimeEnd != null">
					AND a.CREATE_TIME BETWEEN #{tPaymentInfo.createTimeStart} AND #{tPaymentInfo.createTimeEnd}
				</if>
				<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
					AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
				</if>
				<if test="tPaymentInfo.createBy != null and tPaymentInfo.createBy.trim() != ''">
					AND a.CREATE_BY = #{tPaymentInfo.createBy}
				</if>
			</if>
		</if>
	</sql>
	<sql id="tPaymentInfo_export_count_where">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
					AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
				</if>
				<if test="tPaymentInfo.secondIndicatorBelong != null and tPaymentInfo.secondIndicatorBelong.trim() != ''">
					AND a.SECOND_INDICATOR_BELONG = #{tPaymentInfo.secondIndicatorBelong}
				</if>
				<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
				</if>
				<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
					AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
				</if>
				<if test="tPaymentInfo.unitName != null and tPaymentInfo.unitName.trim() != ''">
					AND a.UNIT_NAME = #{tPaymentInfo.unitName}
				</if>
				<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
					AND a.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
				</if>
				<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
					AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
				</if>
				<!--<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND a.SOCIAL_PAY_MONTH = #{tPaymentInfo.socialPayMonth}
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND a.SOCIAL_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
				</if>-->
				<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND (a.SOCIAL_PAY_MONTH = '${tPaymentInfo.socialPayMonth}' or a.PROVIDENT_PAY_MONTH = '${tPaymentInfo.socialPayMonth}')
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND (a.SOCIAL_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}' or a.PROVIDENT_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}')
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 开始 2023-03-02 fxj -->
				<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
					<if test="tPaymentInfo.socialTown == null">
						<if test="tPaymentInfo.socialCity != null">
							AND (a.SOCIAL_CITY = '${tPaymentInfo.socialCity}' or a.FUND_CITY = '${tPaymentInfo.socialCity}')
						</if>
						<if test="tPaymentInfo.socialCity == null">
							<if test="tPaymentInfo.socialProvince != null">
								AND (a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' or a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}')
							</if>
						</if>
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
					</if>
				</if>
				<if test='tPaymentInfo.areaFlag == "0"'>
					<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
						AND (
						(a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY =''))
						or
						(a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY =''))
						)
					</if>
					<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
						AND (
						(a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'  and (a.SOCIAL_TOWN is null  or a.SOCIAL_TOWN =''))
						or
						(a.FUND_CITY = '${tPaymentInfo.socialCity}' and (a.FUND_TOWN is null or a.FUND_TOWN =''))
						)
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
					</if>
				</if>
				<if test="tPaymentInfo.authSql != null and tPaymentInfo.authSql.trim() != ''">
					${tPaymentInfo.authSql}
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->
			</if>
		</if>
	</sql>
	<sql id="tPaymentInfo_export_social_where">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
					AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'%')
				</if>
				<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD = #{tPaymentInfo.empIdcard}
				</if>
				<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
					AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
				</if>
				<if test="tPaymentInfo.unitName != null and tPaymentInfo.unitName.trim() != ''">
					AND a.UNIT_NAME = #{tPaymentInfo.unitName}
				</if>
				<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
					AND a.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
				</if>
				<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND a.SOCIAL_PAY_MONTH = #{tPaymentInfo.socialPayMonth}
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND a.SOCIAL_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 开始 2023-03-02 fxj -->
				<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
					<if test="tPaymentInfo.socialTown == null">
						<if test="tPaymentInfo.socialCity != null">
							AND a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'
						</if>
						<if test="tPaymentInfo.socialCity == null">
							<if test="tPaymentInfo.socialProvince != null">
								AND a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}'
							</if>
						</if>
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}'
					</if>
				</if>
				<if test='tPaymentInfo.areaFlag == "0"'>
					<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
						AND a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY ='')
					</if>
					<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
						AND a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'  and (a.SOCIAL_TOWN is null  or a.SOCIAL_TOWN ='')
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}'
					</if>
				</if>
				<if test="tPaymentInfo.authSql != null and tPaymentInfo.authSql.trim() != ''">
					${tPaymentInfo.authSql}
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->
				<if test="tPaymentInfo.pushStatus != null and tPaymentInfo.pushStatus.trim() != ''">
					AND a.PUSH_STATUS = #{tPaymentInfo.pushStatus}
				</if>
				<if test="tPaymentInfo.createName != null and tPaymentInfo.createName.trim() != ''">
					AND a.CREATE_NAME = #{tPaymentInfo.createName}
				</if>
				<if test="tPaymentInfo.createTimeStart != null and tPaymentInfo.createTimeEnd != null">
					AND a.CREATE_TIME BETWEEN #{tPaymentInfo.createTimeStart} AND #{tPaymentInfo.createTimeEnd}
				</if>
				<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
					AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
				</if>
				<if test="tPaymentInfo.createBy != null and tPaymentInfo.createBy.trim() != ''">
					AND a.CREATE_BY = #{tPaymentInfo.createBy}
				</if>
			</if>
		</if>
	</sql>
	<sql id="tPaymentInfo_export_social_where_diy">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
					AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
				</if>
				<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
				</if>
				<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
					AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
				</if>
				<if test="tPaymentInfo.unitName != null and tPaymentInfo.unitName.trim() != ''">
					AND a.UNIT_NAME = #{tPaymentInfo.unitName}
				</if>
				<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
					AND a.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
				</if>
				<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
					AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
				</if>
				<if test="tPaymentInfo.secondIndicatorBelong != null and tPaymentInfo.secondIndicatorBelong.trim() != ''">
					AND a.SECOND_INDICATOR_BELONG = #{tPaymentInfo.secondIndicatorBelong}
				</if>
				<!--<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND a.SOCIAL_PAY_MONTH = #{tPaymentInfo.socialPayMonth}
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND a.SOCIAL_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
				</if>-->
				<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND (a.SOCIAL_PAY_MONTH = '${tPaymentInfo.socialPayMonth}' or a.PROVIDENT_PAY_MONTH = '${tPaymentInfo.socialPayMonth}')
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND (a.SOCIAL_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}' or a.PROVIDENT_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}')
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 开始 2023-03-02 fxj -->
				<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
					<if test="tPaymentInfo.socialTown == null">
						<if test="tPaymentInfo.socialCity != null">
							AND (a.SOCIAL_CITY = '${tPaymentInfo.socialCity}' or a.FUND_CITY = '${tPaymentInfo.socialCity}')
						</if>
						<if test="tPaymentInfo.socialCity == null">
							<if test="tPaymentInfo.socialProvince != null">
								AND (a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' or a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}')
							</if>
						</if>
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
					</if>
				</if>
				<if test='tPaymentInfo.areaFlag == "0"'>
					<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
						AND (
						(a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY =''))
						or
						(a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY =''))
						)
					</if>
					<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
						AND (
						(a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'  and (a.SOCIAL_TOWN is null  or a.SOCIAL_TOWN =''))
						or
						(a.FUND_CITY = '${tPaymentInfo.socialCity}' and (a.FUND_TOWN is null or a.FUND_TOWN =''))
						)
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
					</if>
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->
			</if>
		</if>
	</sql>

	<sql id="tPaymentInfo_export_socialFund_where2">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
					AND c.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
				</if>
				<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
					AND c.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
				</if>
				<if test="tPaymentInfo.secondIndicatorBelong != null and tPaymentInfo.secondIndicatorBelong.trim() != ''">
					AND c.SECOND_INDICATOR_BELONG = #{tPaymentInfo.secondIndicatorBelong}
				</if>
			</if>
		</if>
	</sql>

	<sql id="tPaymentInfo_export_socialFund_where1">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
					AND k.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
				</if>
				<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
					AND k.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND k.SOCIAL_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
				</if>
				<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND k.SOCIAL_PAY_MONTH = #{tPaymentInfo.socialPayMonth}
				</if>
				<if test="tPaymentInfo.secondIndicatorBelong != null and tPaymentInfo.secondIndicatorBelong.trim() != ''">
					AND k.SECOND_INDICATOR_BELONG = #{tPaymentInfo.secondIndicatorBelong}
				</if>
			</if>
		</if>
	</sql>

	<sql id="tPaymentInfo_export_fund_where">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
					AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
				</if>
				<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
				</if>
				<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
					AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
				</if>
				<if test="tPaymentInfo.unitName != null and tPaymentInfo.unitName.trim() != ''">
					AND a.UNIT_NAME = #{tPaymentInfo.unitName}
				</if>
				<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND a.PROVIDENT_PAY_MONTH = #{tPaymentInfo.socialPayMonth}
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND  a.PROVIDENT_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
				</if>
				<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
					AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 开始 2023-03-02 fxj -->
				<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
					<if test="tPaymentInfo.socialTown == null">
						<if test="tPaymentInfo.socialCity != null">
							AND a.FUND_CITY = '${tPaymentInfo.socialCity}'
						</if>
						<if test="tPaymentInfo.socialCity == null">
							<if test="tPaymentInfo.socialProvince != null">
								AND a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}'
							</if>
						</if>
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND a.FUND_TOWN = '${tPaymentInfo.socialTown}'
					</if>
				</if>
				<if test='tPaymentInfo.areaFlag == "0"'>
					<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
						AND a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY ='')
					</if>
					<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
						AND a.FUND_CITY = '${tPaymentInfo.socialCity}' and (a.FUND_TOWN is null or a.FUND_TOWN ='')
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND a.FUND_TOWN = '${tPaymentInfo.socialTown}'
					</if>
				</if>
				<if test="tPaymentInfo.authSql != null and tPaymentInfo.authSql.trim() != ''">
					${tPaymentInfo.authSql}
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->
				<if test="tPaymentInfo.pushStatus != null and tPaymentInfo.pushStatus.trim() != ''">
					AND a.PUSH_STATUS = #{tPaymentInfo.pushStatus}
				</if>
				<if test="tPaymentInfo.createName != null and tPaymentInfo.createName.trim() != ''">
					AND a.CREATE_NAME = #{tPaymentInfo.createName}
				</if>
				<if test="tPaymentInfo.createTimeStart != null and tPaymentInfo.createTimeEnd != null">
					AND a.CREATE_TIME BETWEEN #{tPaymentInfo.createTimeStart} AND #{tPaymentInfo.createTimeEnd}
				</if>
				<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
					AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
				</if>
				<if test="tPaymentInfo.createBy != null and tPaymentInfo.createBy.trim() != ''">
					AND a.CREATE_BY = #{tPaymentInfo.createBy}
				</if>
			</if>
		</if>
	</sql>

	<sql id="tPaymentInfo_export_push_where">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList != null">
				AND a.id in
				<foreach item="idStr" index="index" collection="tPaymentInfo.idList" open="(" separator="," close=")">
					#{idStr}
				</foreach>
			</if>
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.id != null and tPaymentInfo.id.trim() != ''">
					AND a.ID = #{tPaymentInfo.id}
				</if>
				<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
					AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
				</if>
				<if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''">
					AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%')
				</if>
				<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
				</if>
				<if test="tPaymentInfo.settleDomainName != null and tPaymentInfo.settleDomainName.trim() != ''">
					AND a.SETTLE_DOMAIN_NAME = #{tPaymentInfo.settleDomainName}
				</if>
				<if test="tPaymentInfo.settleDomainCode != null and tPaymentInfo.settleDomainCode.trim() != ''">
					AND a.SETTLE_DOMAIN_CODE = #{tPaymentInfo.settleDomainCode}
				</if>
				<if test="tPaymentInfo.unitName != null and tPaymentInfo.unitName.trim() != ''">
					AND a.UNIT_NAME = #{tPaymentInfo.unitName}
				</if>
				<if test="tPaymentInfo.settleDomainId != null and tPaymentInfo.settleDomainId.trim() != ''">
					AND a.SETTLE_DOMAIN_ID = #{tPaymentInfo.settleDomainId}
				</if>
				<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
					AND a.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
				</if>
				<if test="tPaymentInfo.socialSecurityNo != null and tPaymentInfo.socialSecurityNo.trim() != ''">
					AND a.SOCIAL_SECURITY_NO like CONCAT(#{tPaymentInfo.socialSecurityNo},'%')
				</if>
				<if test="tPaymentInfo.socialPayAddr != null and tPaymentInfo.socialPayAddr.trim() != ''">
					AND a.SOCIAL_PAY_ADDR = #{tPaymentInfo.socialPayAddr}
				</if>
				<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND (a.SOCIAL_PAY_MONTH = '${tPaymentInfo.socialPayMonth}' or a.PROVIDENT_PAY_MONTH = '${tPaymentInfo.socialPayMonth}')
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND (a.SOCIAL_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}' or a.PROVIDENT_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}')
				</if>
				<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
					AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
				</if>
				<if test="tPaymentInfo.providentPayAddr != null and tPaymentInfo.providentPayAddr.trim() != ''">
					AND a.PROVIDENT_PAY_ADDR = #{tPaymentInfo.providentPayAddr}
				</if>

				<!-- 区域 默认精准查询 0    包含下级查询 1 开始 2023-03-02 fxj -->
				<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
					<if test="tPaymentInfo.socialTown == null">
						<if test="tPaymentInfo.socialCity != null">
							AND (a.SOCIAL_CITY = '${tPaymentInfo.socialCity}' or a.FUND_CITY = '${tPaymentInfo.socialCity}')
						</if>
						<if test="tPaymentInfo.socialCity == null">
							<if test="tPaymentInfo.socialProvince != null">
								AND (a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' or a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}')
							</if>
						</if>
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
					</if>
				</if>
				<if test='tPaymentInfo.areaFlag == "0"'>
					<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
						AND (
						(a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY =''))
						or
						(a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY =''))
						)
					</if>
					<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
						AND (
						(a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'  and (a.SOCIAL_TOWN is null  or a.SOCIAL_TOWN =''))
						or
						(a.FUND_CITY = '${tPaymentInfo.socialCity}' and  (a.FUND_TOWN is null or a.FUND_TOWN =''))
						)
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
					</if>
				</if>
				<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->

				<if test="tPaymentInfo.providentNo != null and tPaymentInfo.providentNo.trim() != ''">
					AND a.PROVIDENT_NO = #{tPaymentInfo.providentNo}
				</if>
				<if test="tPaymentInfo.createName != null and tPaymentInfo.createName.trim() != ''">
					AND a.CREATE_NAME = #{tPaymentInfo.createName}
				</if>
				<if test="tPaymentInfo.createTimeStart != null and tPaymentInfo.createTimeEnd != null">
					AND a.CREATE_TIME BETWEEN #{tPaymentInfo.createTimeStart} AND #{tPaymentInfo.createTimeEnd}
				</if>
				<if test="tPaymentInfo.createBy != null and tPaymentInfo.createBy.trim() != ''">
					AND a.CREATE_BY = #{tPaymentInfo.createBy}
				</if>
			</if>
		</if>
	</sql>

	<resultMap id="tPaymentAllInfoMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo">

		<id property="id" column="ID"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="empId" column="EMP_ID"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitId" column="UNIT_ID"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
		<result property="settleDomainId" column="SETTLE_DOMAIN_ID"/>
		<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
		<result property="socialSecurityNo" column="SOCIAL_SECURITY_NO"/>
		<result property="socialPayAddr" column="SOCIAL_PAY_ADDR"/>
		<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
		<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
		<result property="lockStatus" column="LOCK_STATUS"/>
		<result property="sumAll" column="SUM_ALL"/>
		<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
		<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
		<result property="providentHousehold" column="PROVIDENT_HOUSEHOLD"/>
		<result property="providentPayAddr" column="PROVIDENT_PAY_ADDR"/>
		<result property="socialId" column="SOCIAL_ID"/>
		<result property="fundId" column="FUND_ID"/>
		<result property="socialSum" column="SOCIAL_SUM"/>
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="socialSecurityPersonalSum" column="SOCIAL_SECURITY_PERSONAL_SUM"/>
		<result property="providentSum" column="PROVIDENT_SUM"/>

		<result property="companyAccrual" column="COMPANY_ACCRUAL"/>
		<result property="personalAccrual" column="PERSONAL_ACCRUAL"/>
		<result property="unitPensionSet" column="UNIT_PENSION_SET"/>
		<result property="unitMedicalSet" column="UNIT_MEDICAL_SET"/>
		<result property="unitUnemploymentSet" column="UNIT_UNEMPLOYMENT_SET"/>
		<result property="unitInjurySet" column="UNIT_INJURY_SET"/>
		<result property="unitBirthSet" column="UNIT_BIRTH_SET"/>
		<result property="unitPensionPer" column="UNIT_PENSION_PER"/>
		<result property="unitMedicalPer" column="UNIT_MEDICAL_PER"/>
		<result property="unitUnemploymentPer" column="UNIT_UNEMPLOYMENT_PER"/>
		<result property="unitInjuryPer" column="UNIT_INJURY_PER"/>
		<result property="unitBirthPer" column="UNIT_BIRTH_PER"/>
		<result property="personalPensionPer" column="PERSONAL_PENSION_PER"/>
		<result property="personalMedicalPer" column="PERSONAL_MEDICAL_PER"/>
		<result property="personalUnemploymentPer" column="PERSONAL_UNEMPLOYMENT_PER"/>
		<result property="unitBigailmentPer" column="UNIT_BIGAILMENT_PER"/>
		<result property="personalBigailmentPer" column="PERSONAL_BIGAILMENT_PER"/>
		<result property="unitPensionMoney" column="UNIT_PENSION_MONEY"/>
		<result property="unitMedicalMoney" column="UNIT_MEDICAL_MONEY"/>
		<result property="unitUnemploymentMoney" column="UNIT_UNEMPLOYMENT_MONEY"/>
		<result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
		<result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
		<result property="unitBigmailmentMoney" column="UNIT_BIGMAILMENT_MONEY"/>
		<result property="personalPensionMoney" column="PERSONAL_PENSION_MONEY"/>
		<result property="personalMedicalMoney" column="PERSONAL_MEDICAL_MONEY"/>
		<result property="personalUnemploymentMoney" column="PERSONAL_UNEMPLOYMENT_MONEY"/>
		<result property="personalBigmailmentMoney" column="PERSONAL_BIGMAILMENT_MONEY"/>
		<result property="socialProvince" column="SOCIAL_PROVINCE"/>
		<result property="socialCity" column="SOCIAL_CITY"/>
		<result property="socialTown" column="SOCIAL_TOWN"/>
		<result property="createBy" column="CREATE_BY"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="createTime" column="CREATE_TIME"/>
		<result property="updateBy" column="UPDATE_BY"/>
		<result property="updateTime" column="UPDATE_TIME"/>

		<result property="providentNo" column="PROVIDENT_NO"/>
		<result property="unitProvidentSet" column="UNIT_PROVIDENT_SET"/>
		<result property="providentPercent" column="PROVIDENT_PERCENT"/>
		<result property="unitProvidentSum" column="UNIT_PROVIDENT_SUM"/>
		<result property="personalProidentSet" column="PERSONAL_PROIDENT_SET"/>
		<result property="personalProvidentSum" column="PERSONAL_PROVIDENT_SUM"/>
		<result property="fundProvince" column="FUND_PROVINCE"/>
		<result property="fundCity" column="FUND_CITY"/>
		<result property="fundTown" column="FUND_TOWN"/>
		<result property="inauguralTeam" column="INAUGURAL_TEAM"/>
	</resultMap>
	<!--tPaymentInfo简单分页查询-->
	<select id="getTPaymentInfoPage" resultMap="tPaymentInfoMap"
			resultType="com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo">
		SELECT
		a.ID,
		a.EMP_NAME,
		a.EMP_NO,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_SECURITY_NO,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		a.LOCK_STATUS,
		a.PUSH_STATUS,
		a.SUM_ALL,
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		a.SOCIAL_SUM,
		a.PROVIDENT_SUM,
		a.CREATE_NAME,
		a.CREATE_TIME
		FROM t_payment_info a
		<where>
			1=1
			<include refid="tPaymentInfo_where"/>
		</where>
		ORDER BY a.CREATE_TIME desc
	</select>

	<!--tPaymentInfo简单分页查询-->
	<select id="getTPaymentInfoNewPage" resultMap="tPaymentInfoNewMap">
		SELECT
		c.keyGroup,
		c.EMP_IDCARD,
		c.EMP_NAME,
		c.UNIT_NAME,
		c.SETTLE_DOMAIN_NAME,
		c.SECOND_INDICATOR_BELONG,
		c.SOCIAL_HOUSEHOLD,
		c.SOCIAL_PAY_ADDR,
		c.SOCIAL_PAY_MONTH,
		c.SOCIAL_CREATE_MONTH,
		c.SUM_ALL AS SUM_ALL,
		c.PROVIDENT_HOUSEHOLD AS PROVIDENT_HOUSEHOLD,
		c.PROVIDENT_PAY_ADDR  AS PROVIDENT_PAY_ADDR,
		c.SOCIAL_SUM,
		c.PROVIDENT_SUM  AS PROVIDENT_SUM
		from (
		select
		w.keyGroup,
		w.EMP_IDCARD,
		w.EMP_NAME,
		w.UNIT_NAME,
		w.SETTLE_DOMAIN_NAME,
		w.SECOND_INDICATOR_BELONG,
		w.SOCIAL_HOUSEHOLD,
		w.SOCIAL_PAY_ADDR,
		w.SOCIAL_PAY_MONTH,
		w.SOCIAL_CREATE_MONTH,
		SUM( w.SUM_ALL ) AS SUM_ALL,
		MAX( w.PROVIDENT_HOUSEHOLD ) AS PROVIDENT_HOUSEHOLD,
		MAX( w.PROVIDENT_PAY_ADDR ) AS PROVIDENT_PAY_ADDR,
		w.SOCIAL_SUM,
		SUM( w.PROVIDENT_SUM ) AS PROVIDENT_SUM
		FROM (
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.SECOND_INDICATOR_BELONG,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
		a.PROVIDENT_SUM
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1'
			<include refid="tPaymentInfo_export_social_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
		)
		union all
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.SECOND_INDICATOR_BELONG,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_PAY_ADDR,
		a.PROVIDENT_PAY_MONTH as SOCIAL_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH as SOCIAL_CREATE_MONTH,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		a.SOCIAL_SUM,
		SUM( a.PROVIDENT_SUM ) AS PROVIDENT_SUM
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
			<include refid="tPaymentInfo_export_fund_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
		)
		) w
		GROUP BY w.keyGroup ) c
		<where>
			1 = 1
			<include refid="tPaymentInfo_export_socialFund_where2"/>
		</where>

	</select>
	<!--tPaymentInfo简单分页查询 fxj 2024-08-08 调整-->
	<select id="getTPaymentInfoNewPageDiy" resultMap="tPaymentInfoNewMap">
		SELECT
		c.keyGroup,
		c.EMP_IDCARD,
		c.EMP_NAME,
		c.UNIT_NAME,
		c.SETTLE_DOMAIN_NAME,
		c.SECOND_INDICATOR_BELONG,
		c.SOCIAL_HOUSEHOLD,
		c.SOCIAL_PAY_ADDR,
		c.SOCIAL_PAY_MONTH,
		c.SOCIAL_CREATE_MONTH,
		c.SUM_ALL AS SUM_ALL,
		c.PROVIDENT_HOUSEHOLD AS PROVIDENT_HOUSEHOLD,
		c.PROVIDENT_PAY_ADDR  AS PROVIDENT_PAY_ADDR,
		c.SOCIAL_SUM,
		c.PROVIDENT_SUM  AS PROVIDENT_SUM
		from (
		select
		w.keyGroup,
		w.EMP_IDCARD,
		w.EMP_NAME,
		w.UNIT_NAME,
		w.SETTLE_DOMAIN_NAME,
		w.SECOND_INDICATOR_BELONG,
		w.SOCIAL_HOUSEHOLD,
		w.SOCIAL_PAY_ADDR,
		w.SOCIAL_PAY_MONTH,
		w.SOCIAL_CREATE_MONTH,
		SUM( w.SUM_ALL ) AS SUM_ALL,
		MAX( w.PROVIDENT_HOUSEHOLD ) AS PROVIDENT_HOUSEHOLD,
		MAX( w.PROVIDENT_PAY_ADDR ) AS PROVIDENT_PAY_ADDR,
		w.SOCIAL_SUM,
		SUM( w.PROVIDENT_SUM ) AS PROVIDENT_SUM
		FROM (
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.SECOND_INDICATOR_BELONG,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
		a.PROVIDENT_SUM
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1'
			<include refid="tPaymentInfo_export_social_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
		)
		union all
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.SECOND_INDICATOR_BELONG,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_PAY_ADDR,
		a.PROVIDENT_PAY_MONTH as SOCIAL_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH as SOCIAL_CREATE_MONTH,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		a.SOCIAL_SUM,
		SUM( a.PROVIDENT_SUM ) AS PROVIDENT_SUM
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
			<include refid="tPaymentInfo_export_fund_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
		)
		) w
		GROUP BY w.keyGroup ) c
		<where>
			1 = 1
			<include refid="tPaymentInfo_export_socialFund_where2"/>
		</where>
		<if test="null != page and null != size">
			limit #{page},#{size}
		</if>
	</select>

	<!--tPaymentInfo简单分页查询 fxj 2024-08-08 调整-->
	<select id="getTPaymentInfoNewPageSocial" resultMap="tPaymentInfoNewMap">
		SELECT
		<choose>
			<when test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''  and tPaymentInfo.socialHousehold == null">
				CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
				a.PROVIDENT_PAY_MONTH as SOCIAL_PAY_MONTH,
				a.PROVIDENT_CREATE_MONTH as SOCIAL_CREATE_MONTH,
			</when>
			<when test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
				CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
				a.SOCIAL_PAY_MONTH,
				a.SOCIAL_CREATE_MONTH,
			</when>
			<otherwise>
				CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
				a.SOCIAL_PAY_MONTH,
				a.SOCIAL_CREATE_MONTH,
			</otherwise>
		</choose>
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.SETTLE_DOMAIN_CODE,
		a.SECOND_INDICATOR_BELONG,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_PAY_ADDR,

		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
		a.PROVIDENT_SUM
		FROM t_payment_info a
		<where>
			<include refid="tPaymentInfo_export_social_where_diy"/>
		</where>
		<choose>
			<when test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''  and tPaymentInfo.socialHousehold == null">
				GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
			</when>
			<when test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
				GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
			</when>
			<otherwise>
				GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
			</otherwise>
		</choose>

		<if test="null != page and null != size">
			limit #{page},#{size}
		</if>
	</select>
	<!--tPaymentInfo简单分页查询-->
	<select id="getTPaymentInfoNewPageInfo" resultMap="tPaymentInfoNewMap">
		SELECT
		k.EMP_IDCARD,
		k.EMP_NAME,
		k.UNIT_NAME,
		k.SETTLE_DOMAIN_NAME,
		k.SECOND_INDICATOR_BELONG,
		k.SOCIAL_HOUSEHOLD,
		k.SOCIAL_SECURITY_NO,
		k.SOCIAL_PAY_ADDR,
		k.SOCIAL_PAY_MONTH,
		k.SOCIAL_CREATE_MONTH,
		k.PERSONAL_PROVIDENT_SUM,
		k.SUM_ALL,
		k.PROVIDENT_HOUSEHOLD,
		k.PROVIDENT_PAY_ADDR,
		k.SOCIAL_SUM,
		k.UNIT_SOCIAL_SUM,
		k.SOCIAL_SECURITY_PERSONAL_SUM,
		k.PROVIDENT_SUM,
		k.COMPANY_ACCRUAL,
		k.PERSONAL_ACCRUAL,
		k.UNIT_PENSION_SET,
		k.UNIT_MEDICAL_SET,
		k.UNIT_UNEMPLOYMENT_SET,
		k.UNIT_INJURY_SET,
		k.UNIT_BIRTH_SET,
		k.UNIT_PENSION_MONEY,
		k.UNIT_MEDICAL_MONEY,
		k.UNIT_UNEMPLOYMENT_MONEY,
		k.UNIT_INJURY_MONEY,
		k.UNIT_BIRTH_MONEY,
		k.UNIT_BIGMAILMENT_MONEY,
		k.PERSONAL_PENSION_MONEY,
		k.PERSONAL_MEDICAL_MONEY,
		k.PERSONAL_UNEMPLOYMENT_MONEY,
		k.PERSONAL_BIGMAILMENT_MONEY,
		k.PENSION_MONEY_SUM,
		k.MEDICAL_MONEY_SUM,
		k.UNEMPLOYMENT_MONEY_SUM,
		k.BIGMAILMENT_MONEY_SUM,
		k.ACCRUAL_SUM,
		k.PROVIDENT_NO,
		k.PERSONAL_PROIDENT_SET,
		k.UNIT_PROVIDENT_SET,
		k.PROVIDENT_PERCENT,
		k.SOCIAL_FUND_PERSONAL_SUM,
		k.UNIT_SOCIAL_FUND_SUM,
		k.UNIT_PROVIDENT_SUM,
		k.UNIT_PENSION_PER,
		k.UNIT_MEDICAL_PER,
		k.UNIT_UNEMPLOYMENT_PER,
		k.UNIT_INJURY_PER,
		k.UNIT_BIRTH_PER,
		k.PERSONAL_PENSION_PER,
		k.PERSONAL_MEDICAL_PER,
		k.PERSONAL_UNEMPLOYMENT_PER
		from (
		select
		w.keyGroup,
		w.EMP_IDCARD,
		w.EMP_NAME,
		w.UNIT_NAME,
		w.SETTLE_DOMAIN_NAME,
		w.SECOND_INDICATOR_BELONG,
		w.SOCIAL_HOUSEHOLD,
		MAX( w.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
		w.SOCIAL_PAY_ADDR,
		w.SOCIAL_PAY_MONTH,
		w.SOCIAL_CREATE_MONTH,
		SUM( w.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
		SUM( w.SUM_ALL ) AS SUM_ALL,
		MAX( w.PROVIDENT_HOUSEHOLD ) AS PROVIDENT_HOUSEHOLD,
		MAX( w.PROVIDENT_PAY_ADDR ) AS PROVIDENT_PAY_ADDR,
		w.SOCIAL_SUM,
		w.UNIT_SOCIAL_SUM,
		w.SOCIAL_SECURITY_PERSONAL_SUM,
		SUM( w.PROVIDENT_SUM ) AS PROVIDENT_SUM,
		w.COMPANY_ACCRUAL,
		w.PERSONAL_ACCRUAL,
		w.UNIT_PENSION_SET,
		w.UNIT_MEDICAL_SET,
		w.UNIT_UNEMPLOYMENT_SET,
		w.UNIT_INJURY_SET,
		w.UNIT_BIRTH_SET,
		w.UNIT_PENSION_MONEY,
		w.UNIT_MEDICAL_MONEY,
		w.UNIT_UNEMPLOYMENT_MONEY,
		w.UNIT_INJURY_MONEY,
		w.UNIT_BIRTH_MONEY,
		w.UNIT_BIGMAILMENT_MONEY,
		w.PERSONAL_PENSION_MONEY,
		w.PERSONAL_MEDICAL_MONEY,
		w.PERSONAL_UNEMPLOYMENT_MONEY,
		w.PERSONAL_BIGMAILMENT_MONEY,
		MAX(w.PENSION_MONEY_SUM ) as PENSION_MONEY_SUM,
		MAX(w.MEDICAL_MONEY_SUM ) as MEDICAL_MONEY_SUM,
		MAX(w.UNEMPLOYMENT_MONEY_SUM ) as UNEMPLOYMENT_MONEY_SUM,
		MAX(w.BIGMAILMENT_MONEY_SUM ) as BIGMAILMENT_MONEY_SUM,
		MAX(w.ACCRUAL_SUM )  as ACCRUAL_SUM,
		MAX( w.PROVIDENT_NO ) AS PROVIDENT_NO,
		MAX( w.PERSONAL_PROIDENT_SET ) AS PERSONAL_PROIDENT_SET,
		SUM( w.UNIT_PROVIDENT_SET ) AS UNIT_PROVIDENT_SET,
		SUM( w.PROVIDENT_PERCENT ) AS PROVIDENT_PERCENT,
		ifnull(SUM( w.SOCIAL_SECURITY_PERSONAL_SUM ),0) + ifnull(SUM( w.PERSONAL_PROVIDENT_SUM ),0) AS SOCIAL_FUND_PERSONAL_SUM,
		ifnull(SUM( w.UNIT_SOCIAL_SUM ),0) + ifnull(SUM( w.UNIT_PROVIDENT_SUM ),0) AS UNIT_SOCIAL_FUND_SUM,
		SUM( w.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM,
		MAX(w.UNIT_PENSION_PER) as UNIT_PENSION_PER,
		MAX(w.UNIT_MEDICAL_PER) as UNIT_MEDICAL_PER,
		MAX(w.UNIT_UNEMPLOYMENT_PER) as UNIT_UNEMPLOYMENT_PER,
		MAX(w.UNIT_INJURY_PER) as UNIT_INJURY_PER,
		MAX(w.UNIT_BIRTH_PER) as UNIT_BIRTH_PER,
		MAX(w.PERSONAL_PENSION_PER) as PERSONAL_PENSION_PER,
		MAX(w.PERSONAL_MEDICAL_PER) as PERSONAL_MEDICAL_PER,
		MAX(w.PERSONAL_UNEMPLOYMENT_PER) as PERSONAL_UNEMPLOYMENT_PER
		FROM (
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.SECOND_INDICATOR_BELONG,
		a.SOCIAL_HOUSEHOLD,
		MAX( a.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		a.PERSONAL_PROVIDENT_SUM,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
		SUM( a.UNIT_SOCIAL_SUM ) AS UNIT_SOCIAL_SUM,
		SUM( a.SOCIAL_SECURITY_PERSONAL_SUM ) AS SOCIAL_SECURITY_PERSONAL_SUM,
		a.PROVIDENT_SUM,
		SUM( a.COMPANY_ACCRUAL ) AS COMPANY_ACCRUAL,
		SUM( a.PERSONAL_ACCRUAL ) AS PERSONAL_ACCRUAL,
		MAX(a.UNIT_PENSION_SET ) AS UNIT_PENSION_SET,
		MAX(a.UNIT_MEDICAL_SET ) AS UNIT_MEDICAL_SET,
		MAX(a.UNIT_UNEMPLOYMENT_SET ) AS UNIT_UNEMPLOYMENT_SET,
		MAX(a.UNIT_INJURY_SET ) AS UNIT_INJURY_SET,
		MAX(a.UNIT_BIRTH_SET ) AS UNIT_BIRTH_SET,
		SUM( a.UNIT_PENSION_MONEY ) AS UNIT_PENSION_MONEY,
		SUM( a.UNIT_MEDICAL_MONEY ) AS UNIT_MEDICAL_MONEY,
		SUM( a.UNIT_UNEMPLOYMENT_MONEY ) AS UNIT_UNEMPLOYMENT_MONEY,
		SUM( a.UNIT_INJURY_MONEY ) AS UNIT_INJURY_MONEY,
		SUM( a.UNIT_BIRTH_MONEY ) AS UNIT_BIRTH_MONEY,
		SUM( a.UNIT_BIGMAILMENT_MONEY ) AS UNIT_BIGMAILMENT_MONEY,
		SUM( a.PERSONAL_PENSION_MONEY ) AS PERSONAL_PENSION_MONEY,
		SUM( a.PERSONAL_MEDICAL_MONEY ) AS PERSONAL_MEDICAL_MONEY,
		SUM( a.PERSONAL_UNEMPLOYMENT_MONEY ) AS PERSONAL_UNEMPLOYMENT_MONEY,
		SUM( a.PERSONAL_BIGMAILMENT_MONEY ) AS PERSONAL_BIGMAILMENT_MONEY,
		ifnull(SUM(a.UNIT_PENSION_MONEY),0)+ifnull(SUM(a.PERSONAL_PENSION_MONEY),0) as PENSION_MONEY_SUM,
		ifnull(SUM(a.UNIT_MEDICAL_MONEY),0)+ifnull(SUM(a.PERSONAL_MEDICAL_MONEY),0) as MEDICAL_MONEY_SUM,
		ifnull(SUM(a.UNIT_UNEMPLOYMENT_MONEY),0)+ifnull(SUM(a.PERSONAL_UNEMPLOYMENT_MONEY),0) as UNEMPLOYMENT_MONEY_SUM,
		ifnull(SUM(a.UNIT_BIGMAILMENT_MONEY),0)+ifnull(SUM(a.PERSONAL_BIGMAILMENT_MONEY),0) as BIGMAILMENT_MONEY_SUM,
		ifnull(SUM(a.COMPANY_ACCRUAL),0)+ifnull(SUM(a.PERSONAL_ACCRUAL),0) as ACCRUAL_SUM,
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.PERSONAL_PROIDENT_SET,
		a.UNIT_PROVIDENT_SUM,
		if(null = a.UNIT_PENSION_MONEY,'',round(SUM(a.UNIT_PENSION_MONEY)/MAX(a.UNIT_PENSION_SET),4)) as UNIT_PENSION_PER,
		if(null = a.UNIT_MEDICAL_MONEY,'',round(SUM(a.UNIT_MEDICAL_MONEY)/MAX(a.UNIT_MEDICAL_SET),4)) as UNIT_MEDICAL_PER,
		if(null = a.UNIT_UNEMPLOYMENT_MONEY,'',round(SUM(a.UNIT_UNEMPLOYMENT_MONEY)/MAX(a.UNIT_UNEMPLOYMENT_SET),4)) as UNIT_UNEMPLOYMENT_PER,
		if(null = a.UNIT_INJURY_MONEY,'',round(SUM(a.UNIT_INJURY_MONEY)/MAX(a.UNIT_INJURY_SET),4)) as UNIT_INJURY_PER,
		if(null = a.UNIT_BIRTH_MONEY,'',round(SUM(a.UNIT_BIRTH_MONEY)/MAX(a.UNIT_BIRTH_SET),4)) as UNIT_BIRTH_PER,
		if(null = a.PERSONAL_PENSION_MONEY,'',round(SUM(a.PERSONAL_PENSION_MONEY)/MAX(a.UNIT_PENSION_SET),4)) as PERSONAL_PENSION_PER,
		if(null = a.PERSONAL_MEDICAL_MONEY,'',round(SUM(a.PERSONAL_MEDICAL_MONEY)/MAX(a.UNIT_MEDICAL_SET),4)) as PERSONAL_MEDICAL_PER,
		if(null = a.PERSONAL_UNEMPLOYMENT_MONEY,'',round(SUM(a.PERSONAL_UNEMPLOYMENT_MONEY)/MAX(a.UNIT_UNEMPLOYMENT_SET),4)) as PERSONAL_UNEMPLOYMENT_PER
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1'
			<include refid="tPaymentInfo_export_social_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
		)
		union all
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.SECOND_INDICATOR_BELONG,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_SECURITY_NO,
		a.SOCIAL_PAY_ADDR,
		a.PROVIDENT_PAY_MONTH as SOCIAL_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH as SOCIAL_CREATE_MONTH,
		SUM(a.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		a.SOCIAL_SUM,
		a.UNIT_SOCIAL_SUM,
		a.SOCIAL_SECURITY_PERSONAL_SUM,
		SUM( a.PROVIDENT_SUM ) AS PROVIDENT_SUM,
		a.COMPANY_ACCRUAL,
		a.PERSONAL_ACCRUAL,
		a.UNIT_PENSION_SET,
		a.UNIT_MEDICAL_SET,
		a.UNIT_UNEMPLOYMENT_SET,
		a.UNIT_INJURY_SET,
		a.UNIT_BIRTH_SET,
		a.UNIT_PENSION_MONEY,
		a.UNIT_MEDICAL_MONEY,
		a.UNIT_UNEMPLOYMENT_MONEY,
		a.UNIT_INJURY_MONEY,
		a.UNIT_BIRTH_MONEY,
		a.UNIT_BIGMAILMENT_MONEY,
		a.PERSONAL_PENSION_MONEY,
		a.PERSONAL_MEDICAL_MONEY,
		a.PERSONAL_UNEMPLOYMENT_MONEY,
		a.PERSONAL_BIGMAILMENT_MONEY,
		null PENSION_MONEY_SUM,
		null MEDICAL_MONEY_SUM,
		null UNEMPLOYMENT_MONEY_SUM,
		null BIGMAILMENT_MONEY_SUM,
		null ACCRUAL_SUM,
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.PERSONAL_PROIDENT_SET,
		SUM( a.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM,
	    '' as UNIT_PENSION_PER,
		'' as UNIT_MEDICAL_PER,
		'' as UNIT_UNEMPLOYMENT_PER,
		'' as UNIT_INJURY_PER,
		'' as UNIT_BIRTH_PER,
		'' as PERSONAL_PENSION_PER,
		'' as PERSONAL_MEDICAL_PER,
		'' as PERSONAL_UNEMPLOYMENT_PER
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
			<include refid="tPaymentInfo_export_fund_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
		)
		) w
		GROUP BY w.keyGroup) k
		<where>
			1 = 1
			<include refid="tPaymentInfo_export_socialFund_where1"/>
		</where>
	</select>

	<!--tPaymentInfo数量查询-->
	<select id="selectCountPaymentSearchInfo" resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM (
		select w.SOCIAL_HOUSEHOLD,w.PROVIDENT_HOUSEHOLD,w.SECOND_INDICATOR_BELONG from (
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
		a.SOCIAL_HOUSEHOLD,
		a.PROVIDENT_HOUSEHOLD,
		a.SECOND_INDICATOR_BELONG
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1'
			<include refid="tPaymentInfo_export_social_where"/>
		</where>
		GROUP BY  a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
		)
		union all
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
		a.SOCIAL_HOUSEHOLD,
		a.PROVIDENT_HOUSEHOLD,
		a.SECOND_INDICATOR_BELONG
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
			<include refid="tPaymentInfo_export_fund_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
		<!-- 导出查询条数接口 fxj 2024-08-06 -->
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.limitEnd != null and tPaymentInfo.limitEnd > 0">
				limit 0,#{tPaymentInfo.limitEnd}
			</if>
		</if>
		)
		) w
		GROUP BY w.keyGroup) c
		<where>
			1 = 1
			<include refid="tPaymentInfo_export_socialFund_where2"/>
		</where>
	</select>

	<!--tPaymentInfo简单分页查询-->
	<select id="getTPaymentInfoNewExportInfo" resultMap="tPaymentInfoNewExportMap">
		SELECT
		c.keyGroup,
		c.EMP_IDCARD,
		c.EMP_NO,
		c.EMP_NAME,
		c.UNIT_NAME,
		c.SETTLE_DOMAIN_CODE,
		c.SECOND_INDICATOR_BELONG,
		c.SETTLE_DOMAIN_NAME,
		c.SOCIAL_HOUSEHOLD,
		c.SOCIAL_SECURITY_NO,
		c.SOCIAL_PAY_ADDR,
		c.SOCIAL_PAY_MONTH,
		c.SOCIAL_CREATE_MONTH,
		c.PERSONAL_PROVIDENT_SUM,
		c.SUM_ALL,
		c.PROVIDENT_PAY_MONTH,
		c.PROVIDENT_CREATE_MONTH,
		c.PROVIDENT_HOUSEHOLD,
		c.PROVIDENT_PAY_ADDR,
		c.SOCIAL_SUM,
		c.UNIT_SOCIAL_SUM,
		c.SOCIAL_SECURITY_PERSONAL_SUM,
		c.PROVIDENT_SUM,
		c.INAUGURAL_TEAM,
		c.COMPANY_ACCRUAL,
		c.PERSONAL_ACCRUAL,
		c.UNIT_PENSION_SET,
		c.UNIT_MEDICAL_SET,
		c.UNIT_UNEMPLOYMENT_SET,
		c.UNIT_INJURY_SET,
		c.UNIT_BIRTH_SET,
		c.UNIT_PENSION_MONEY,
		c.UNIT_MEDICAL_MONEY,
		c.UNIT_UNEMPLOYMENT_MONEY,
		c.UNIT_INJURY_MONEY,
		c.UNIT_BIRTH_MONEY,
		c.UNIT_BIGMAILMENT_MONEY,
		c.PERSONAL_PENSION_MONEY,
		c.PERSONAL_MEDICAL_MONEY,
		c.PERSONAL_UNEMPLOYMENT_MONEY,
		c.PERSONAL_BIGMAILMENT_MONEY,
		c.PENSION_MONEY_SUM,
		c.MEDICAL_MONEY_SUM,
		c.UNEMPLOYMENT_MONEY_SUM,
		c.INJURY_MONEY_SUM,
		c.BIRTH_MONEY_SUM,
		c.BIGMAILMENT_MONEY_SUM,
		c.UNIT_PENSION_PER,
		c.UNIT_MEDICAL_PER,
		c.UNIT_UNEMPLOYMENT_PER,
		c.UNIT_INJURY_PER,
		c.UNIT_BIRTH_PER,
		c.PERSONAL_PENSION_PER,
		c.PERSONAL_MEDICAL_PER,
		c.PERSONAL_UNEMPLOYMENT_PER,
		c.PROVIDENT_NO AS PROVIDENT_NO,
		c.PERSONAL_PROIDENT_SET,
		c.UNIT_PROVIDENT_SET,
		c.PROVIDENT_PERCENT,
		c.UNIT_PROVIDENT_SUM
		from (
		select
		w.keyGroup,
		w.EMP_IDCARD,
		w.EMP_NO,
		w.EMP_NAME,
		w.UNIT_NAME,
		w.SETTLE_DOMAIN_CODE,
		w.SECOND_INDICATOR_BELONG,
		w.SETTLE_DOMAIN_NAME,
		w.SOCIAL_HOUSEHOLD,
		MAX( w.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
		w.SOCIAL_PAY_ADDR,
		w.SOCIAL_PAY_MONTH,
		w.SOCIAL_CREATE_MONTH,
		SUM( w.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
		SUM( w.SUM_ALL ) AS SUM_ALL,
		MAX( w.PROVIDENT_PAY_MONTH ) AS PROVIDENT_PAY_MONTH,
		MAX( w.PROVIDENT_CREATE_MONTH ) AS PROVIDENT_CREATE_MONTH,
		MAX( w.PROVIDENT_HOUSEHOLD ) AS PROVIDENT_HOUSEHOLD,
		MAX( w.PROVIDENT_PAY_ADDR ) AS PROVIDENT_PAY_ADDR,
		w.SOCIAL_SUM,
		w.UNIT_SOCIAL_SUM,
		w.SOCIAL_SECURITY_PERSONAL_SUM,
		SUM( w.PROVIDENT_SUM ) AS PROVIDENT_SUM,
		w.INAUGURAL_TEAM,
		w.COMPANY_ACCRUAL,
		w.PERSONAL_ACCRUAL,
		w.UNIT_PENSION_SET,
		w.UNIT_MEDICAL_SET,
		w.UNIT_UNEMPLOYMENT_SET,
		w.UNIT_INJURY_SET,
		w.UNIT_BIRTH_SET,
		w.UNIT_PENSION_MONEY,
		w.UNIT_MEDICAL_MONEY,
		w.UNIT_UNEMPLOYMENT_MONEY,
		w.UNIT_INJURY_MONEY,
		w.UNIT_BIRTH_MONEY,
		w.UNIT_BIGMAILMENT_MONEY,
		w.PERSONAL_PENSION_MONEY,
		w.PERSONAL_MEDICAL_MONEY,
		w.PERSONAL_UNEMPLOYMENT_MONEY,
		w.PERSONAL_BIGMAILMENT_MONEY,
		w.PENSION_MONEY_SUM,
		w.MEDICAL_MONEY_SUM,
		w.UNEMPLOYMENT_MONEY_SUM,
		w.INJURY_MONEY_SUM,
		w.BIRTH_MONEY_SUM,
		w.BIGMAILMENT_MONEY_SUM,
		w.UNIT_PENSION_PER,
		w.UNIT_MEDICAL_PER,
		w.UNIT_UNEMPLOYMENT_PER,
		w.UNIT_INJURY_PER,
		w.UNIT_BIRTH_PER,
		w.PERSONAL_PENSION_PER,
		w.PERSONAL_MEDICAL_PER,
		w.PERSONAL_UNEMPLOYMENT_PER,
		MAX( w.PROVIDENT_NO ) AS PROVIDENT_NO,
		MAX( w.PERSONAL_PROIDENT_SET ) AS PERSONAL_PROIDENT_SET,
		SUM( w.UNIT_PROVIDENT_SET ) AS UNIT_PROVIDENT_SET,
		SUM( w.PROVIDENT_PERCENT ) AS PROVIDENT_PERCENT,
		SUM( w.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
		FROM (
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
		a.EMP_NAME,
		a.EMP_NO,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_CODE,
		a.SECOND_INDICATOR_BELONG,
		a.SETTLE_DOMAIN_NAME,
		a.SOCIAL_HOUSEHOLD,
		MAX( a.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		a.PERSONAL_PROVIDENT_SUM,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
		SUM( a.UNIT_SOCIAL_SUM ) AS UNIT_SOCIAL_SUM,
		SUM( a.SOCIAL_SECURITY_PERSONAL_SUM ) AS SOCIAL_SECURITY_PERSONAL_SUM,
		a.PROVIDENT_SUM,
		a.INAUGURAL_TEAM,
		SUM( a.COMPANY_ACCRUAL ) AS COMPANY_ACCRUAL,
		SUM( a.PERSONAL_ACCRUAL ) AS PERSONAL_ACCRUAL,
		MAX(a.UNIT_PENSION_SET ) AS UNIT_PENSION_SET,
		MAX(a.UNIT_MEDICAL_SET ) AS UNIT_MEDICAL_SET,
		MAX(a.UNIT_UNEMPLOYMENT_SET ) AS UNIT_UNEMPLOYMENT_SET,
		MAX(a.UNIT_INJURY_SET ) AS UNIT_INJURY_SET,
		MAX(a.UNIT_BIRTH_SET ) AS UNIT_BIRTH_SET,
		SUM( a.UNIT_PENSION_MONEY ) AS UNIT_PENSION_MONEY,
		SUM( a.UNIT_MEDICAL_MONEY ) AS UNIT_MEDICAL_MONEY,
		SUM( a.UNIT_UNEMPLOYMENT_MONEY ) AS UNIT_UNEMPLOYMENT_MONEY,
		SUM( a.UNIT_INJURY_MONEY ) AS UNIT_INJURY_MONEY,
		SUM( a.UNIT_BIRTH_MONEY ) AS UNIT_BIRTH_MONEY,
		SUM( a.UNIT_BIGMAILMENT_MONEY ) AS UNIT_BIGMAILMENT_MONEY,
		SUM( a.PERSONAL_PENSION_MONEY ) AS PERSONAL_PENSION_MONEY,
		SUM( a.PERSONAL_MEDICAL_MONEY ) AS PERSONAL_MEDICAL_MONEY,
		SUM( a.PERSONAL_UNEMPLOYMENT_MONEY ) AS PERSONAL_UNEMPLOYMENT_MONEY,
		SUM( a.PERSONAL_BIGMAILMENT_MONEY ) AS PERSONAL_BIGMAILMENT_MONEY,
		SUM( a.UNIT_PENSION_MONEY + a.PERSONAL_PENSION_MONEY) as PENSION_MONEY_SUM,
		SUM( a.UNIT_MEDICAL_MONEY + a.PERSONAL_MEDICAL_MONEY) as MEDICAL_MONEY_SUM,
		SUM( a.UNIT_UNEMPLOYMENT_MONEY + a.PERSONAL_UNEMPLOYMENT_MONEY) as UNEMPLOYMENT_MONEY_SUM,
		SUM( a.UNIT_INJURY_MONEY) as INJURY_MONEY_SUM,
		SUM( a.UNIT_BIRTH_MONEY) as BIRTH_MONEY_SUM,
		SUM( a.UNIT_BIGMAILMENT_MONEY + a.PERSONAL_BIGMAILMENT_MONEY) as BIGMAILMENT_MONEY_SUM,
		if(null = a.UNIT_PENSION_MONEY,'',round(SUM(a.UNIT_PENSION_MONEY)/MAX(a.UNIT_PENSION_SET),4)) as UNIT_PENSION_PER,
		if(null = a.UNIT_MEDICAL_MONEY,'',round(SUM(a.UNIT_MEDICAL_MONEY)/MAX(a.UNIT_MEDICAL_SET),4)) as UNIT_MEDICAL_PER,
		if(null = a.UNIT_UNEMPLOYMENT_MONEY,'',round(SUM(a.UNIT_UNEMPLOYMENT_MONEY)/MAX(a.UNIT_UNEMPLOYMENT_SET),4)) as UNIT_UNEMPLOYMENT_PER,
		if(null = a.UNIT_INJURY_MONEY,'',round(SUM(a.UNIT_INJURY_MONEY)/MAX(a.UNIT_INJURY_SET),4)) as UNIT_INJURY_PER,
		if(null = a.UNIT_BIRTH_MONEY,'',round(SUM(a.UNIT_BIRTH_MONEY)/MAX(a.UNIT_BIRTH_SET),4)) as UNIT_BIRTH_PER,
		if(null = a.PERSONAL_PENSION_MONEY,'',round(SUM(a.PERSONAL_PENSION_MONEY)/MAX(a.UNIT_PENSION_SET),4)) as PERSONAL_PENSION_PER,
		if(null = a.PERSONAL_MEDICAL_MONEY,'',round(SUM(a.PERSONAL_MEDICAL_MONEY)/MAX(a.UNIT_MEDICAL_SET),4)) as PERSONAL_MEDICAL_PER,
		if(null = a.PERSONAL_UNEMPLOYMENT_MONEY,'',round(SUM(a.PERSONAL_UNEMPLOYMENT_MONEY)/MAX(a.UNIT_UNEMPLOYMENT_SET),4)) as PERSONAL_UNEMPLOYMENT_PER,
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.PERSONAL_PROIDENT_SET,
		a.UNIT_PROVIDENT_SUM
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1'
			<include refid="tPaymentInfo_export_social_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
		)
		union all
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
		a.EMP_NAME,
		a.EMP_NO,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_CODE,
		a.SECOND_INDICATOR_BELONG,
		a.SETTLE_DOMAIN_NAME,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_SECURITY_NO,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		SUM(a.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		a.SOCIAL_SUM,
		a.UNIT_SOCIAL_SUM,
		a.SOCIAL_SECURITY_PERSONAL_SUM,
		SUM( a.PROVIDENT_SUM ) AS PROVIDENT_SUM,
		a.INAUGURAL_TEAM,
		a.COMPANY_ACCRUAL,
		a.PERSONAL_ACCRUAL,
		a.UNIT_PENSION_SET,
		a.UNIT_MEDICAL_SET,
		a.UNIT_UNEMPLOYMENT_SET,
		a.UNIT_INJURY_SET,
		a.UNIT_BIRTH_SET,
		a.UNIT_PENSION_MONEY,
		a.UNIT_MEDICAL_MONEY,
		a.UNIT_UNEMPLOYMENT_MONEY,
		a.UNIT_INJURY_MONEY,
		a.UNIT_BIRTH_MONEY,
		a.UNIT_BIGMAILMENT_MONEY,
		a.PERSONAL_PENSION_MONEY,
		a.PERSONAL_MEDICAL_MONEY,
		a.PERSONAL_UNEMPLOYMENT_MONEY,
		a.PERSONAL_BIGMAILMENT_MONEY,
		'' as PENSION_MONEY_SUM,
		'' as MEDICAL_MONEY_SUM,
		'' as UNEMPLOYMENT_MONEY_SUM,
		'' as INJURY_MONEY_SUM,
		'' as BIRTH_MONEY_SUM,
		'' as BIGMAILMENT_MONEY_SUM,
		'' as UNIT_PENSION_PER,
		'' as UNIT_MEDICAL_PER,
		'' as UNIT_UNEMPLOYMENT_PER,
		'' as UNIT_INJURY_PER,
		'' as UNIT_BIRTH_PER,
		'' as PERSONAL_PENSION_PER,
		'' as PERSONAL_MEDICAL_PER,
		'' as PERSONAL_UNEMPLOYMENT_PER,
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.PERSONAL_PROIDENT_SET,
		SUM( a.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
			<include refid="tPaymentInfo_export_fund_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
		)
		) w
		GROUP BY w.keyGroup) c
		<where>
			1 = 1
			<include refid="tPaymentInfo_export_socialFund_where2"/>
		</where>
		limit #{tPaymentInfo.limitStart},#{tPaymentInfo.limitEnd}
	</select>

	<!--tPaymentInfo不分页查询-->
	<select id="getTPaymentInfoNoPage" resultMap="tPaymentInfoBatchMap">
		SELECT
		a.EMP_NAME,
		a.EMP_NO,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_SECURITY_NO,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		a.SUM_ALL,
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
		a.PROVIDENT_HOUSEHOLD,
		a.SOCIAL_SUM,
		a.UNIT_SOCIAL_SUM,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_SECURITY_PERSONAL_SUM,
		a.PROVIDENT_SUM,
		a.INAUGURAL_TEAM,
		a.COMPANY_ACCRUAL,
		a.PERSONAL_ACCRUAL,
		a.UNIT_PENSION_SET,
		a.UNIT_MEDICAL_SET,
		a.UNIT_UNEMPLOYMENT_SET,
		a.UNIT_INJURY_SET,
		a.UNIT_BIRTH_SET,
		a.PROVIDENT_PAY_ADDR,
		a.UNIT_PENSION_MONEY,
		a.UNIT_MEDICAL_MONEY,
		a.UNIT_UNEMPLOYMENT_MONEY,
		a.UNIT_INJURY_MONEY,
		a.UNIT_BIRTH_MONEY,
		a.UNIT_BIGMAILMENT_MONEY,
		a.PERSONAL_PENSION_MONEY,
		a.PERSONAL_MEDICAL_MONEY,
		a.PERSONAL_UNEMPLOYMENT_MONEY,
		a.PERSONAL_BIGMAILMENT_MONEY,
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.UNIT_PROVIDENT_SUM,
		a.PERSONAL_PROIDENT_SET,
		a.PERSONAL_PROVIDENT_SUM,
		CASE WHEN a.PUSH_STATUS=0 THEN "已推送"
		WHEN a.PUSH_STATUS =1 THEN "未推送"
		ELSE a.PUSH_STATUS END as "PUSH_STATUS",
		CASE WHEN a.LOCK_STATUS=0 THEN "未打标"
		WHEN a.LOCK_STATUS =1 THEN "已打标"
		ELSE a.LOCK_STATUS END as "LOCK_STATUS",
		a.CREATE_NAME,
		a.CREATE_TIME
		FROM t_payment_info a
		<where>
			1=1
			<include refid="tPaymentInfo_export_where"/>
		</where>
		ORDER BY a.CREATE_TIME desc
		limit #{tPaymentInfo.limitStart},#{tPaymentInfo.limitEnd}
	</select>

	<!--tPaymentInfo不分页查询-->
	<select id="getTPaymentInfoList" resultType="java.lang.String">
		SELECT
		a.ID
		FROM t_payment_info a
		<where>
			a.LOCK_STATUS = '0'
			<include refid="tPaymentInfo_export_where"/>
		</where>
	</select>

	<!--tPaymentInfo数量查询-->
	<select id="selectCountTPaymentInfo" resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM t_payment_info a
		<where>
			1=1
			<include refid="tPaymentInfo_export_where"/>
		</where>
	</select>

	<!--tPaymentInfo合并查询-->
	<select id="getTPaymentInfoSumNoPage" resultMap="tPaymentInfoSumMap">
		SELECT
		w.keyGroup,
		w.EMP_IDCARD,
		w.EMP_NO,
		w.EMP_NAME,
		w.UNIT_NAME,
		w.SETTLE_DOMAIN_CODE,
		w.SETTLE_DOMAIN_NAME,
		w.SOCIAL_HOUSEHOLD,
		MAX( w.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
		w.SOCIAL_PAY_ADDR,
		w.SOCIAL_PAY_MONTH,
		w.SOCIAL_CREATE_MONTH,
		SUM( w.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
		SUM( w.SUM_ALL ) AS SUM_ALL,
		MAX( w.PROVIDENT_PAY_MONTH ) AS PROVIDENT_PAY_MONTH,
		MAX( w.PROVIDENT_CREATE_MONTH ) AS PROVIDENT_CREATE_MONTH,
		MAX( w.PROVIDENT_HOUSEHOLD ) AS PROVIDENT_HOUSEHOLD,
		MAX( w.PROVIDENT_PAY_ADDR ) AS PROVIDENT_PAY_ADDR,
		w.SOCIAL_SUM,
		w.UNIT_SOCIAL_SUM,
		w.SOCIAL_SECURITY_PERSONAL_SUM,
		SUM( w.PROVIDENT_SUM ) AS PROVIDENT_SUM,
		w.INAUGURAL_TEAM,
		w.COMPANY_ACCRUAL,
		w.PERSONAL_ACCRUAL,
		w.UNIT_PENSION_SET,
		w.UNIT_MEDICAL_SET,
		w.UNIT_UNEMPLOYMENT_SET,
		w.UNIT_INJURY_SET,
		w.UNIT_BIRTH_SET,
		w.UNIT_PENSION_MONEY,
		w.UNIT_MEDICAL_MONEY,
		w.UNIT_UNEMPLOYMENT_MONEY,
		w.UNIT_INJURY_MONEY,
		w.UNIT_BIRTH_MONEY,
		w.UNIT_BIGMAILMENT_MONEY,
		w.PERSONAL_PENSION_MONEY,
		w.PERSONAL_MEDICAL_MONEY,
		w.PERSONAL_UNEMPLOYMENT_MONEY,
		w.PERSONAL_BIGMAILMENT_MONEY,
		MAX( w.PROVIDENT_NO ) AS PROVIDENT_NO,
		MAX( w.PERSONAL_PROIDENT_SET ) AS PERSONAL_PROIDENT_SET,
		SUM( w.UNIT_PROVIDENT_SET ) AS UNIT_PROVIDENT_SET,
		SUM( w.PROVIDENT_PERCENT ) AS PROVIDENT_PERCENT,
		w.SOCIAL_CREATE_NAME,
		w.SOCIAL_CREATE_TIME,
		MAX( w.FUND_CREATE_NAME ) AS FUND_CREATE_NAME,
		MAX( w.FUND_CREATE_TIME ) AS FUND_CREATE_TIME,
		SUM( w.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
		FROM (
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
		a.EMP_NAME,
		a.EMP_NO,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_CODE,
		a.SETTLE_DOMAIN_NAME,
		a.SOCIAL_HOUSEHOLD,
		MAX( a.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		a.PERSONAL_PROVIDENT_SUM,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
		SUM( a.UNIT_SOCIAL_SUM ) AS UNIT_SOCIAL_SUM,
		SUM( a.SOCIAL_SECURITY_PERSONAL_SUM ) AS SOCIAL_SECURITY_PERSONAL_SUM,
		a.PROVIDENT_SUM,
		a.INAUGURAL_TEAM,
		SUM( a.COMPANY_ACCRUAL ) AS COMPANY_ACCRUAL,
		SUM( a.PERSONAL_ACCRUAL ) AS PERSONAL_ACCRUAL,
		MAX(a.UNIT_PENSION_SET ) AS UNIT_PENSION_SET,
		MAX(a.UNIT_MEDICAL_SET ) AS UNIT_MEDICAL_SET,
		MAX(a.UNIT_UNEMPLOYMENT_SET ) AS UNIT_UNEMPLOYMENT_SET,
		MAX(a.UNIT_INJURY_SET ) AS UNIT_INJURY_SET,
		MAX(a.UNIT_BIRTH_SET ) AS UNIT_BIRTH_SET,
		SUM( a.UNIT_PENSION_MONEY ) AS UNIT_PENSION_MONEY,
		SUM( a.UNIT_MEDICAL_MONEY ) AS UNIT_MEDICAL_MONEY,
		SUM( a.UNIT_UNEMPLOYMENT_MONEY ) AS UNIT_UNEMPLOYMENT_MONEY,
		SUM( a.UNIT_INJURY_MONEY ) AS UNIT_INJURY_MONEY,
		SUM( a.UNIT_BIRTH_MONEY ) AS UNIT_BIRTH_MONEY,
		SUM( a.UNIT_BIGMAILMENT_MONEY ) AS UNIT_BIGMAILMENT_MONEY,
		SUM( a.PERSONAL_PENSION_MONEY ) AS PERSONAL_PENSION_MONEY,
		SUM( a.PERSONAL_MEDICAL_MONEY ) AS PERSONAL_MEDICAL_MONEY,
		SUM( a.PERSONAL_UNEMPLOYMENT_MONEY ) AS PERSONAL_UNEMPLOYMENT_MONEY,
		SUM( a.PERSONAL_BIGMAILMENT_MONEY ) AS PERSONAL_BIGMAILMENT_MONEY,
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.PERSONAL_PROIDENT_SET,
		a.CREATE_NAME AS SOCIAL_CREATE_NAME,
		DATE_FORMAT(a.CREATE_TIME,'%Y-%m-%d') AS SOCIAL_CREATE_TIME,
		NULL AS FUND_CREATE_NAME,
		NULL AS FUND_CREATE_TIME,
		a.UNIT_PROVIDENT_SUM
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1'
			<include refid="tPaymentInfo_export_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
		)
		union all
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH ) AS keyGroup,
		a.EMP_NAME,
		a.EMP_NO,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_CODE,
		a.SETTLE_DOMAIN_NAME,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_SECURITY_NO,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		SUM(a.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		a.SOCIAL_SUM,
		a.UNIT_SOCIAL_SUM,
		a.SOCIAL_SECURITY_PERSONAL_SUM,
		SUM( a.PROVIDENT_SUM ) AS PROVIDENT_SUM,
		a.INAUGURAL_TEAM,
		a.COMPANY_ACCRUAL,
		a.PERSONAL_ACCRUAL,
		a.UNIT_PENSION_SET,
		a.UNIT_MEDICAL_SET,
		a.UNIT_UNEMPLOYMENT_SET,
		a.UNIT_INJURY_SET,
		a.UNIT_BIRTH_SET,
		a.UNIT_PENSION_MONEY,
		a.UNIT_MEDICAL_MONEY,
		a.UNIT_UNEMPLOYMENT_MONEY,
		a.UNIT_INJURY_MONEY,
		a.UNIT_BIRTH_MONEY,
		a.UNIT_BIGMAILMENT_MONEY,
		a.PERSONAL_PENSION_MONEY,
		a.PERSONAL_MEDICAL_MONEY,
		a.PERSONAL_UNEMPLOYMENT_MONEY,
		a.PERSONAL_BIGMAILMENT_MONEY,
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.PERSONAL_PROIDENT_SET,
		NULL AS SOCIAL_CREATE_NAME,
		NULL AS SOCIAL_CREATE_TIME,
		a.CREATE_NAME AS FUND_CREATE_NAME,
		DATE_FORMAT(a.CREATE_TIME,'%Y-%m-%d') AS FUND_CREATE_TIME,
		SUM( a.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
			<include refid="tPaymentInfo_export_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
		)
		) w
		GROUP BY w.keyGroup
		limit #{tPaymentInfo.limitStart},#{tPaymentInfo.limitEnd}
	</select>

	<!--tPaymentInfo数量查询-->
	<select id="selectCountSumPaymentInfo" resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM (
		select * from (
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1'
			<include refid="tPaymentInfo_export_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
		<!-- 导出查询条数接口 fxj 2024-08-06 -->
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.limitEnd != null and tPaymentInfo.limitEnd > 0">
				limit 0,#{tPaymentInfo.limitEnd}
			</if>
		</if>
		)
		union all
		(SELECT
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH ) AS keyGroup
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
			<include refid="tPaymentInfo_export_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
		<!-- 导出查询条数接口 fxj 2024-08-06 -->
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.limitEnd != null and tPaymentInfo.limitEnd > 0">
				limit 0,#{tPaymentInfo.limitEnd}
			</if>
		</if>
		)
		) w
		GROUP BY w.keyGroup) c
	</select>

	<!--tPaymentInfo合并查询-->
	<select id="getTPaymentInfoSumPushList" resultMap="tPaymentInfoSumPushMap">
		SELECT
		a.ID,
		GROUP_CONCAT("'",a.ID,"'") as ids,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_CODE,
		a.SETTLE_DOMAIN_NAME,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		SUM( a.SUM_ALL ) AS SUM_ALL,
		SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
		SUM( a.UNIT_SOCIAL_SUM ) AS UNIT_SOCIAL_SUM,
		SUM( a.SOCIAL_SECURITY_PERSONAL_SUM ) AS SOCIAL_SECURITY_PERSONAL_SUM,
		SUM( a.COMPANY_ACCRUAL ) AS COMPANY_ACCRUAL,
		SUM( a.PERSONAL_ACCRUAL ) AS PERSONAL_ACCRUAL,
		SUM( a.UNIT_PENSION_MONEY ) AS UNIT_PENSION_MONEY,
		SUM( a.UNIT_MEDICAL_MONEY ) AS UNIT_MEDICAL_MONEY,
		SUM( a.UNIT_UNEMPLOYMENT_MONEY ) AS UNIT_UNEMPLOYMENT_MONEY,
		SUM( a.UNIT_INJURY_MONEY ) AS UNIT_INJURY_MONEY,
		SUM( a.UNIT_BIRTH_MONEY ) AS UNIT_BIRTH_MONEY,
		SUM( a.UNIT_BIGMAILMENT_MONEY ) AS UNIT_BIGMAILMENT_MONEY,
		SUM( a.PERSONAL_PENSION_MONEY ) AS PERSONAL_PENSION_MONEY,
		SUM( a.PERSONAL_MEDICAL_MONEY ) AS PERSONAL_MEDICAL_MONEY,
		SUM( a.PERSONAL_UNEMPLOYMENT_MONEY ) AS PERSONAL_UNEMPLOYMENT_MONEY,
		SUM( a.PERSONAL_BIGMAILMENT_MONEY ) AS PERSONAL_BIGMAILMENT_MONEY,
		a.BPO_FLAG,
		a.CREATE_NAME,
		DATE_FORMAT(a.CREATE_TIME,'%Y-%m-%d') AS CREATE_NAME
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1' and a.PUSH_STATUS = '1' and a.LOCK_STATUS = '1'
			<include refid="tPaymentInfo_export_push_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SOCIAL_PAY_ADDR
	</select>

	<!--tPaymentInfo合并查询-->
	<select id="getTPaymentInfoSumPushCount" resultType="java.lang.Integer">
		SELECT
		count(1) FROM(
		SELECT 1
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1' and a.PUSH_STATUS = '1' and a.LOCK_STATUS = '1'
			<include refid="tPaymentInfo_export_push_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SOCIAL_PAY_ADDR) c
	</select>

	<update id="updateDeleteInfo">
		update t_payment_info
		<trim prefix="SET" suffixOverrides=",">
			<if test="tPaymentInfo != null">
				<if test="tPaymentInfo.sumAll != null">
					SUM_ALL = #{tPaymentInfo.sumAll},
				</if>
				<if test="tPaymentInfo.socialSum != null">
					SOCIAL_SUM = #{tPaymentInfo.socialSum},
				</if>
				<if test="tPaymentInfo.unitSocialSum != null">
					UNIT_SOCIAL_SUM = #{tPaymentInfo.unitSocialSum},
				</if>
				<if test="tPaymentInfo.socialSecurityPersonalSum != null">
					SOCIAL_SECURITY_PERSONAL_SUM = #{tPaymentInfo.socialSecurityPersonalSum},
				</if>
				<if test="tPaymentInfo.socialHousehold != null">
					SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold},
				</if>
				<if test="tPaymentInfo.socialHousehold == null">
					SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold},
				</if>
				<if test="tPaymentInfo.providentSum != null ">
					PROVIDENT_SUM = #{tPaymentInfo.providentSum},
				</if>
				<if test="tPaymentInfo.providentHousehold != null">
					PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold},
				</if>
				<if test="tPaymentInfo.providentHousehold == null">
					PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold},
				</if>
				<if test="tPaymentInfo.socialId != ''">
					SOCIAL_ID = #{tPaymentInfo.socialId},
				</if>
				<if test="tPaymentInfo.fundId != ''">
					FUND_ID = #{tPaymentInfo.fundId},
				</if>
				<if test="tPaymentInfo.unitId != null">
					UNIT_ID = #{tPaymentInfo.unitId},
				</if>
				<if test="tPaymentInfo.settleDomainId != null">
					SETTLE_DOMAIN_ID = #{tPaymentInfo.settleDomainId},
				</if>
			</if>
		</trim>
		where ID = #{tPaymentInfo.id}
	</update>
	<update id="updateStatusById">
		update t_payment_info
		<trim prefix="SET" suffixOverrides=",">
			<if test="tPaymentInfo != null">
				<if test="tPaymentInfo.incomeSettleFlag != null and tPaymentInfo.incomeSettleFlag.trim() != ''">
					INCOME_SETTLE_FLAG = #{tPaymentInfo.incomeSettleFlag},
				</if>
				<if test="tPaymentInfo.incomeCollectFlag != null and tPaymentInfo.incomeCollectFlag.trim() != ''">
					INCOME_COLLECT_FLAG = #{tPaymentInfo.incomeCollectFlag},
				</if>
				<if test="tPaymentInfo.paySettleFlag != null and tPaymentInfo.paySettleFlag.trim() != ''">
					PAY_SETTLE_FLAG = #{tPaymentInfo.paySettleFlag},
				</if>
				<if test="tPaymentInfo.payCollectFlag != null and tPaymentInfo.payCollectFlag.trim() != ''">
					PAY_COLLECT_FLAG = #{tPaymentInfo.payCollectFlag},
				</if>
			</if>
		</trim>
		where ID = #{tPaymentInfo.id}
	</update>

	<update id="updateBatchByIdList">
		<foreach collection="details" index="index" item="item" separator=";">
			update t_payment_info set INCOME_SETTLE_FLAG = #{item.incomeSettleFlag},
			INCOME_COLLECT_FLAG = #{item.incomeCollectFlag}
			where ID = #{item.id}
		</foreach>
	</update>

	<update id="updateBatchByIdList1">
		<foreach collection="details" index="index" item="item" separator=";">
			update t_payment_info set PAY_SETTLE_FLAG = #{item.paySettleFlag},
			PAY_COLLECT_FLAG = #{item.payCollectFlag}
			where ID = #{item.id}
		</foreach>
	</update>

	<!--tPaymentInfo 按ID查收缴费库包含社保和公积金明细的数据查询-->
	<select id="getAllInfoById" resultMap="tPaymentAllInfoMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_payment_info a
		where a.ID = #{id}
	</select>

	<!--tPaymentInfo 按ID查收缴费库包含社保和公积金明细的数据查询-->
	<select id="getAllPushInfoById" resultMap="tPaymentInfoMap">
		SELECT
			ID,
			INCOME_SETTLE_FLAG,
			INCOME_COLLECT_FLAG,
			PAY_COLLECT_FLAG,
			PAY_SETTLE_FLAG
		FROM t_payment_info a
		where a.ID in (${idStr})
	</select>

	<select id="selectListForPaymentImport" resultMap="tPaymentInfoMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_payment_info a
		where 1=1
		<if test="months != null and months.size > 0">
			AND a.SOCIAL_PAY_MONTH in
			<foreach item="item" index="index" collection="months" open="(" separator="," close=")">
				#{item}
			</foreach>
		</if>
		<if test="idcards != null and idcards.size > 0">
			AND a.EMP_IDCARD IN
			<foreach item="item" index="index" collection="idcards" open="(" separator="," close=")">
				#{item}
			</foreach>
		</if>
	</select>

	<select id="selectListForPaymentImport1" resultMap="tPaymentInfoMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_payment_info a
		where 1=1
		<if test="months != null and months.size > 0">
			AND a.PROVIDENT_PAY_MONTH in
			<foreach item="item" index="index" collection="months" open="(" separator="," close=")">
				#{item}
			</foreach>
		</if>
		<if test="idcards != null and idcards.size > 0">
			AND a.EMP_IDCARD IN
			<foreach item="item" index="index" collection="idcards" open="(" separator="," close=")">
				#{item}
			</foreach>
		</if>
	</select>

	<!--洪光武2022-8-10 18:05:42-->
	<resultMap id="tPaymentBySalaryMap" type="com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo">
		<id property="id" column="ID"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitBitmailmentFee" column="UNIT_BIGMAILMENT_MONEY"/>
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="personalSocialSum" column="SOCIAL_SECURITY_PERSONAL_SUM"/>
		<result property="unitFundSum" column="UNIT_PROVIDENT_SUM"/>
		<result property="personalFundSum" column="PERSONAL_PROVIDENT_SUM"/>
		<result property="salarySocialFlag" column="SALARY_SOCIAL_FLAG"/>
		<result property="salaryFundFlag" column="SALARY_FUND_FLAG"/>
		<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
		<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
		<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
		<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
		<result property="settleDomainId" column="SETTLE_DOMAIN_ID"/>
	</resultMap>

	<!-- 薪资获取缴费库 -->
	<select id="selectTPaymentBySalaryVo" resultMap="tPaymentBySalaryMap">
		SELECT
		a.id,
		a.EMP_IDCARD,
		ifnull(a.UNIT_BIGMAILMENT_MONEY,0) UNIT_BIGMAILMENT_MONEY,
		ifnull(a.UNIT_SOCIAL_SUM,0) UNIT_SOCIAL_SUM,
		ifnull(a.SOCIAL_SECURITY_PERSONAL_SUM,0) SOCIAL_SECURITY_PERSONAL_SUM,
		ifnull(a.UNIT_PROVIDENT_SUM,0) UNIT_PROVIDENT_SUM,
		ifnull(a.PERSONAL_PROVIDENT_SUM,0) PERSONAL_PROVIDENT_SUM,
		a.SALARY_SOCIAL_FLAG,
		a.SALARY_FUND_FLAG,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
		a.SETTLE_DOMAIN_ID
		FROM t_payment_info a
		<where>
			1=1
			<if test="tPaymentInfo != null">
				<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND a.SOCIAL_PAY_MONTH = #{tPaymentInfo.socialPayMonth}
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND a.SOCIAL_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
				</if>
				<if test="tPaymentInfo.providentPayMonth != null and tPaymentInfo.providentPayMonth.trim() != ''">
					AND a.PROVIDENT_PAY_MONTH = #{tPaymentInfo.providentPayMonth}
				</if>
				<if test="tPaymentInfo.providentCreateMonth != null and tPaymentInfo.providentCreateMonth.trim() != ''">
					AND a.PROVIDENT_CREATE_MONTH = #{tPaymentInfo.providentCreateMonth}
				</if>
				<if test="tPaymentInfo.settleDomainId != null and tPaymentInfo.settleDomainId.trim() != ''">
					AND a.SETTLE_DOMAIN_ID = #{tPaymentInfo.settleDomainId}
				</if>
			</if>
		</where>
	</select>

	<!-- 更改薪资社保结算状态 -->
	<update id="updatePaymentSocialStatusByIdList">
		update t_payment_info set SALARY_SOCIAL_FLAG = #{status}
		where
		ID in
		<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
			#{item}
		</foreach>
	</update>

	<!-- 更改薪资公积金结算状态 -->
	<update id="updatePaymentFundStatusByIdList">
		update t_payment_info
		set SALARY_FUND_FLAG = #{status}
		where
		ID in
		<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
			#{item}
		</foreach>
	</update>

	<!-- 更改薪资公积金结算状态 -->
	<update id="updatePaymentSocialAndFound">
		update t_payment_info
		set UNIT_ID = #{infoVo.unitId},
			UNIT_NAME = #{infoVo.unitName},
			SETTLE_DOMAIN_NAME = #{infoVo.settleDomainName},
			SETTLE_DOMAIN_CODE = #{infoVo.settleDomainCode},
			SETTLE_DOMAIN_ID = #{infoVo.settleDomainId}
		where
			((SALARY_SOCIAL_FLAG = '0' and SOCIAL_CREATE_MONTH >= #{infoVo.socialCreateMonth}) or
			 (SALARY_FUND_FLAG = '0' and PROVIDENT_CREATE_MONTH >= #{infoVo.socialCreateMonth}))
		  and PUSH_STATUS = '1' and EMP_IDCARD = #{infoVo.empIdcard}
	</update>

	<!-- 更改薪资公积金结算状态 -->
	<update id="updateByIncome">
		update t_payment_info
		set INCOME_STATUS = '0'
		where
			ID = #{id}
	</update>

	<!-- 更改社保推送结算状态 -->
	<update id="updatePushStatus">
		update t_payment_info
		set PUSH_STATUS = 0
		where
		ID in
		<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
			#{item}
		</foreach>
	</update>

	<!-- 校验缴费库是否有已结算的数据,有,则不允许ekp费用划转 -->
	<select id="checkPaymentChange" resultType="java.lang.String">
		select p.EMP_IDCARD from t_payment_info p
		where (p.SALARY_SOCIAL_FLAG = '1' or p.SALARY_FUND_FLAG = '1') and p.id in
		<foreach item="item" index="index" collection="idSet" open="(" separator="," close=")">
			#{item}
		</foreach>
	</select>

	<!-- ekp费用划转-->
	<update id="changePaymentDept">
		update t_payment_info p
		set
		p.SETTLE_DOMAIN_ID = #{dept.id}
		,p.SETTLE_DOMAIN_NAME = #{dept.departName}
		,p.SETTLE_DOMAIN_CODE = #{dept.departNo}
		,p.UNIT_ID = #{dept.customerId}
		,p.UNIT_NAME = #{dept.customerName}
		,p.SECOND_INDICATOR_BELONG = #{dept.secondIndicatorBelong}
		where (p.SALARY_SOCIAL_FLAG = '0' and p.SALARY_FUND_FLAG = '0') and p.id in
		<foreach item="item" index="index" collection="idSet" open="(" separator="," close=")">
			#{item}
		</foreach>
	</update>

	<!--tPaymentInfo公积金推送查询-->
	<select id="getTPaymentFundPushInfo" resultMap="tPaymentInfoMap">
		SELECT
		a.BPO_FLAG,
		<include refid="Base_Column_List"/>
		FROM t_payment_info a
		<where>
			a.PUSH_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId}
			<include refid="tPaymentInfo_export_where"/>
		</where>
	</select>

	<!--tPaymentInfo公积金推送查询-->
	<select id="getTPaymentFundAllPushInfo" resultMap="tPaymentInfoMap">
		SELECT
		a.BPO_FLAG,
		<include refid="Base_Column_List"/>
		FROM t_payment_info a
		where
			a.PUSH_STATUS = '1' AND a.FUND_ID IS NOT NULL AND lOCK_STATUS = '1'
	</select>

	<!--tPaymentInfo社保收入推送查询-->
	<select id="getTPaymentSocialIncomeInfo" resultMap="tPaymentInfoMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_payment_info a
		<where>
			a.INCOME_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId} AND a.IS_INCOME_STATUS = '0'
			<include refid="tPaymentInfo_export_where"/>
		</where>
		limit 0,10000
	</select>

	<!--tPaymentInfo公积金收入推送查询-->
	<select id="getTPaymentFundIncomeInfo" resultMap="tPaymentInfoMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_payment_info a
		<where>
			a.INCOME_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId} AND a.IS_INCOME_STATUS = '0'
			<include refid="tPaymentInfo_export_where"/>
		</where>
		limit 0,10000
	</select>

	<!-- 更改社保公积金推送状态 -->
	<update id="updateBySocialPayment">
		update t_payment_info
		set PUSH_STATUS = '0',UPDATE_TIME = NOW()
		where
			ID = #{id}
	</update>

	<!-- 更改社保公积金推送状态 -->
	<update id="updateBySocialPaymentList">
		update t_payment_info
		set PUSH_STATUS = '0',UPDATE_TIME = NOW()
		where
			ID in (${idStr})
	</update>

	<!-- 批量更改社保公积金推送状态 -->
	<update id="batchUpdateSocialPaymentByList">
		<foreach collection="details" index="index" item="item" separator=";">
			update t_payment_info a set a.PUSH_STATUS = '0',a.UPDATE_TIME = NOW() where
			FIND_IN_SET(a.id,#{item})
		</foreach>
	</update>

	<!-- 批量更改社保公积金推送状态 -->
	<update id="batchUpdateFundPaymentByList">
		update t_payment_info a set a.PUSH_STATUS = '0',a.UPDATE_TIME = NOW() where a.id in
		<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
			#{item}
		</foreach>
	</update>


	<!-- 更改社保公积金推送状态 -->
	<update id="updateBySocialIncomePayment">
		update t_payment_info
		set INCOME_STATUS = '0',UPDATE_TIME = NOW()
		where
			ID = #{id}
	</update>

	<update id="updateBySocialIncomeFlag">
		update t_payment_info
		set IS_INCOME_STATUS = '1',UPDATE_TIME = NOW()
		where
			ID = #{id}
	</update>

	<!--<select id="getTPaymentSocialPushCount" resultType="java.lang.Long">
		SELECT
		count(1)
		FROM t_payment_info a
		<where>
			a.PUSH_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId}
			<include refid="tPaymentInfo_export_where"/>
		</where>
	</select>-->

	<!--tPaymentInfo公积金推送查询-->
	<select id="getTPaymentFundPushCount" resultType="java.lang.Long">
		SELECT
		count(1)
		FROM t_payment_info a
		<where>
			a.PUSH_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId}
			<include refid="tPaymentInfo_export_where"/>
		</where>
	</select>

	<!--tPaymentInfo社保收入推送查询-->
	<select id="getTPaymentSocialIncomeCount" resultType="java.lang.Long">
		SELECT
		count(1)
		FROM t_payment_info a
		<where>
			a.INCOME_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId} AND a.IS_INCOME_STATUS = '0'
			<include refid="tPaymentInfo_export_where"/>
		</where>
	</select>

	<!--tPaymentInfo公积金收入推送查询-->
	<select id="getTPaymentFundIncomeCount" resultType="java.lang.Long">
		SELECT
		count(1)
		FROM t_payment_info a
		<where>
			a.INCOME_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId} AND a.IS_INCOME_STATUS = '0'
			<include refid="tPaymentInfo_export_where"/>
		</where>
	</select>

	<!--tPaymentInfo 缴费库包含明细的数据查询查询 核准表生成查询专用-->
	<select id="getPaymentAllInfoList" resultMap="tPaymentAllInfoMap">
		SELECT
		a.ID,
		a.EMP_NAME,
		a.EMP_NO,
		a.EMP_ID,
		a.EMP_IDCARD,
		a.UNIT_ID,
		a.SETTLE_DOMAIN_ID,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_SECURITY_NO,
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		a.CREATE_BY,
		a.CREATE_TIME,
		a.UPDATE_BY,
		a.UPDATE_TIME,
		a.LOCK_STATUS,
		a.SUM_ALL,
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		a.FUND_PROVINCE,
		a.FUND_CITY,
		a.FUND_TOWN,
		a.SOCIAL_PROVINCE,
		a.SOCIAL_CITY,
		a.SOCIAL_TOWN,
		a.SOCIAL_ID,
		a.FUND_ID,
		a.SOCIAL_SUM,
		a.UNIT_SOCIAL_SUM,
		a.SOCIAL_SECURITY_PERSONAL_SUM,
		a.PROVIDENT_SUM,
		a.INAUGURAL_TEAM,
		a.SALARY_SOCIAL_FLAG,
		a.SALARY_FUND_FLAG,

		a.COMPANY_ACCRUAL,
		a.PERSONAL_ACCRUAL,
		a.UNIT_PENSION_SET,
		a.UNIT_MEDICAL_SET,
		a.UNIT_UNEMPLOYMENT_SET,
		a.UNIT_INJURY_SET,
		a.UNIT_BIRTH_SET,
		a.UNIT_PENSION_SET as PERSONAL_PENSION_SET,
		a.UNIT_MEDICAL_SET as PERSONAL_MEDICAL_SET,
		a.UNIT_UNEMPLOYMENT_SET as PERSONAL_UNEMPLOYMENT_SET,
		a.UNIT_PENSION_PER,
		a.UNIT_MEDICAL_PER,
		a.UNIT_UNEMPLOYMENT_PER,
		a.UNIT_INJURY_PER,
		a.UNIT_BIRTH_PER,
		a.PERSONAL_PENSION_PER,
		a.PERSONAL_MEDICAL_PER,
		a.PERSONAL_UNEMPLOYMENT_PER,
		a.UNIT_BIGAILMENT_PER,
		a.PERSONAL_BIGAILMENT_PER,
		a.UNIT_PENSION_MONEY,
		a.UNIT_MEDICAL_MONEY,
		a.UNIT_UNEMPLOYMENT_MONEY,
		a.UNIT_INJURY_MONEY,
		a.UNIT_BIRTH_MONEY,
		a.UNIT_BIGMAILMENT_MONEY,
		a.PERSONAL_PENSION_MONEY,
		a.PERSONAL_MEDICAL_MONEY,
		a.PERSONAL_UNEMPLOYMENT_MONEY,
		a.PERSONAL_BIGMAILMENT_MONEY,

		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.UNIT_PROVIDENT_SUM,
		a.PERSONAL_PROIDENT_SET,
		a.PERSONAL_PROVIDENT_SUM
		FROM t_payment_info a
		<where>
			1=1
			<if test="idsStr != null and idsStr.size > 0">
				AND a.ID in
				<foreach item="item" index="index" collection="idsStr" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			<if test="tPaymentInfo != null">
				<!-- 按年模糊查询B端查询个人指定年费的缴费库数据 -->
				<if test="tPaymentInfo.likeYear != null and tPaymentInfo.likeYear.trim() != ''">
					AND (
					a.SOCIAL_PAY_MONTH like CONCAT(#{tPaymentInfo.likeYear},'%')
					or a.PROVIDENT_PAY_MONTH like CONCAT(#{tPaymentInfo.likeYear},'%')
					)
				</if>
				<if test="tPaymentInfo.id != null and tPaymentInfo.id.trim() != ''">
					AND a.ID = #{tPaymentInfo.id}
				</if>
				<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
					AND a.EMP_NAME like CONCAT(#{tPaymentInfo.empName},'%')
				</if>
				<if test="tPaymentInfo.empNo != null and tPaymentInfo.empNo.trim() != ''">
					AND a.EMP_NO like CONCAT(#{tPaymentInfo.empNo},'%')
				</if>
				<if test="tPaymentInfo.empId != null and tPaymentInfo.empId.trim() != ''">
					AND a.EMP_ID = #{tPaymentInfo.empId}
				</if>
				<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
				</if>
				<if test="tPaymentInfo.unitId != null and tPaymentInfo.unitId.trim() != ''">
					AND a.UNIT_ID = #{tPaymentInfo.unitId}
				</if>
				<if test="tPaymentInfo.settleDomainId != null and tPaymentInfo.settleDomainId.trim() != ''">
					AND a.SETTLE_DOMAIN_ID = #{tPaymentInfo.settleDomainId}
				</if>
				<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
					AND a.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
				</if>
				<if test="tPaymentInfo.socialSecurityNo != null and tPaymentInfo.socialSecurityNo.trim() != ''">
					AND a.SOCIAL_SECURITY_NO like CONCAT(#{tPaymentInfo.socialSecurityNo},'%')
				</if>
				<if test="tPaymentInfo.socialPayAddr != null and tPaymentInfo.socialPayAddr.trim() != ''">
					AND a.SOCIAL_PAY_ADDR = #{tPaymentInfo.socialPayAddr}
				</if>
				<if test="tPaymentInfo.socialPayMonth != null and tPaymentInfo.socialPayMonth.trim() != ''">
					AND (a.SOCIAL_PAY_MONTH = #{tPaymentInfo.socialPayMonth} or a.PROVIDENT_PAY_MONTH = #{tPaymentInfo.socialPayMonth})
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND a.SOCIAL_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
				</if>
				<if test="tPaymentInfo.createBy != null and tPaymentInfo.createBy.trim() != ''">
					AND a.CREATE_BY = #{tPaymentInfo.createBy}
				</if>
				<if test="tPaymentInfo.createTime != null">
					AND a.CREATE_TIME = #{tPaymentInfo.createTime}
				</if>
				<!--<if test="tPaymentInfo.lastUpdateUser != null and tPaymentInfo.lastUpdateUser.trim() != ''">
					AND a.UPDATE_BY = #{tPaymentInfo.lastUpdateUser}
				</if>
				<if test="tPaymentInfo.lastUpdateTime != null">
					AND a.UPDATE_TIME = #{tPaymentInfo.lastUpdateTime}
				</if>-->
				<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
					AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
				</if>
				<if test="tPaymentInfo.sumAll != null">
					AND a.SUM_ALL = #{tPaymentInfo.sumAll}
				</if>
				<if test="tPaymentInfo.providentPayMonth != null and tPaymentInfo.providentPayMonth.trim() != ''">
					AND a.PROVIDENT_PAY_MONTH = #{tPaymentInfo.providentPayMonth}
				</if>
				<if test="tPaymentInfo.providentCreateMonth != null and tPaymentInfo.providentCreateMonth.trim() != ''">
					AND a.PROVIDENT_CREATE_MONTH = #{tPaymentInfo.providentCreateMonth}
				</if>
				<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
					AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
				</if>
				<if test="tPaymentInfo.providentPayAddr != null and tPaymentInfo.providentPayAddr.trim() != ''">
					AND a.PROVIDENT_PAY_ADDR = #{tPaymentInfo.providentPayAddr}
				</if>
				<if test="tPaymentInfo.socialProvince != null">
					AND a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}'
				</if>
				<if test="tPaymentInfo.socialCity != null">
					AND a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'
					<if test="tPaymentInfo.socialTown == null">
						<if test="tPaymentInfo.haveContain != null and tPaymentInfo.haveContain == 1">
							AND a.SOCIAL_TOWN  is  null
						</if>
					</if>
				</if>
				<if test="tPaymentInfo.socialTown != null">
					AND a.SOCIAL_TOWN =  '${tPaymentInfo.socialTown}'
				</if>
				<if test="tPaymentInfo.fundProvince != null">
					AND a.FUND_PROVINCE = '${tPaymentInfo.fundProvince}'
				</if>
				<if test="tPaymentInfo.fundCity != null">
					AND (a.FUND_CITY = #{tPaymentInfo.fundCity}
					<if test="tPaymentInfo.settleProvince != null and tPaymentInfo.settleProvince == 0">
						or  a.FUND_CITY is null
					</if>
					)
					<if test="tPaymentInfo.fundTown == null">
						<if test="tPaymentInfo.haveContain != null and tPaymentInfo.haveContain == 1">
							AND a.FUND_TOWN  is  null
						</if>
					</if>
				</if>
				<if test="tPaymentInfo.fundTown != null">
					AND a.FUND_TOWN = '${tPaymentInfo.fundTown}'
				</if>
				<if test="tPaymentInfo.socialId != null">
					AND a.SOCIAL_ID = #{tPaymentInfo.socialId}
				</if>
				<if test="tPaymentInfo.fundId != null">
					AND a.FUND_ID = #{tPaymentInfo.fundId}
				</if>
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND a.SETTLE_DOMAIN_ID in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			<if test="empIds != null and empIds.size > 0">
				AND a.EMP_ID in
				<foreach item="item" index="index" collection="empIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
		</where>
		ORDER BY a.SOCIAL_CREATE_MONTH DESC,a.PROVIDENT_CREATE_MONTH DESC
	</select>

	<!--***********************************************B端查询社保和公积金列表*****************************************************************-->
	<!--tEmployeeInfo B端简单分页查询-->
	<select id="getSocialAndFundBusinessDataPage" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialAndFundBusinessPageVo">

		SELECT
		ifnull(a.SOCIAL_PAY_MONTH,a.PROVIDENT_PAY_MONTH) as 'month',
		a.SETTLE_DOMAIN_ID as 'settleDomainId',
		SUM(
		IF(a.PERSONAL_ACCRUAL,a.PERSONAL_ACCRUAL,0) +
		IF(a.PERSONAL_BIGMAILMENT_MONEY,a.PERSONAL_BIGMAILMENT_MONEY,0) +
		IF(a.PERSONAL_MEDICAL_MONEY,a.PERSONAL_MEDICAL_MONEY,0) +
		IF(a.PERSONAL_UNEMPLOYMENT_MONEY,a.PERSONAL_UNEMPLOYMENT_MONEY,0) +
		IF(a.PERSONAL_PENSION_MONEY,a.PERSONAL_PENSION_MONEY,0) +
		IF(a.PERSONAL_PROVIDENT_SUM,a.PERSONAL_PROVIDENT_SUM,0)
		) AS "personalSum",
		SUM(
		IF(a.UNIT_BIGMAILMENT_MONEY,a.UNIT_BIGMAILMENT_MONEY,0) +
		IF(a.COMPANY_ACCRUAL,a.COMPANY_ACCRUAL,0) +
		IF(a.UNIT_PENSION_MONEY,a.UNIT_PENSION_MONEY,0) +
		IF(a.UNIT_MEDICAL_MONEY,a.UNIT_MEDICAL_MONEY,0) +
		IF(a.UNIT_INJURY_MONEY,a.UNIT_INJURY_MONEY,0) +
		IF(a.UNIT_UNEMPLOYMENT_MONEY,a.UNIT_UNEMPLOYMENT_MONEY,0) +
		IF(a.UNIT_BIRTH_MONEY,a.UNIT_BIRTH_MONEY,0) +
		IF(a.UNIT_PROVIDENT_SUM,a.UNIT_PROVIDENT_SUM,0)
		) AS "unitSum"
		FROM t_payment_info a
		<where>
			1=1
			<if test="socialAndFundBusinessPageVo != null">
				<if test="socialAndFundBusinessPageVo.settleDomainId != null and socialAndFundBusinessPageVo.settleDomainId.trim() != ''">
					AND a.SETTLE_DOMAIN_ID = #{socialAndFundBusinessPageVo.settleDomainId}
				</if>
				<if test="socialAndFundBusinessPageVo.year != null and socialAndFundBusinessPageVo.year.trim() != ''">
					AND (
					(
					a.SOCIAL_PAY_MONTH in(
					CONCAT(#{socialAndFundBusinessPageVo.year},'01'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'02'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'03'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'04'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'05'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'06'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'07'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'08'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'09'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'10'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'11'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'12')
					)
					AND a.SOCIAL_PAY_MONTH >= CONCAT(#{socialAndFundBusinessPageVo.year},'01')
					) or
					(
					a.PROVIDENT_PAY_MONTH in (
					CONCAT(#{socialAndFundBusinessPageVo.year},'01'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'02'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'03'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'04'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'05'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'06'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'07'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'08'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'09'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'10'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'11'),
					CONCAT(#{socialAndFundBusinessPageVo.year},'12')
					)
					AND a.PROVIDENT_PAY_MONTH >= CONCAT(#{socialAndFundBusinessPageVo.year},'01')
					)
					)
				</if>
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND a.SETTLE_DOMAIN_ID in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			GROUP BY
			ifnull(a.SOCIAL_PAY_MONTH,a.PROVIDENT_PAY_MONTH) desc
		</where>
	</select>

	<!--tEmployeeInfo B端简单分页查询-->
	<select id="getSocialAndFundBusinessDataCount" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialAndFundBusinessPageVo">

		SELECT  x.SOCIAL_PAY_MONTH  as 'month',COUNT(DISTINCT x.EMP_IDCARD) as 'peopleCount' FROM
		(
		SELECT
		ifnull(a.SOCIAL_PAY_MONTH,a.PROVIDENT_PAY_MONTH) SOCIAL_PAY_MONTH,
		a.EMP_IDCARD
		FROM
		t_payment_info a
		<where>
			1=1
			<if test="socialAndFundBusinessPageVo != null">
				<if test="socialAndFundBusinessPageVo.settleDomainId != null and socialAndFundBusinessPageVo.settleDomainId.trim() != ''">
					AND a.SETTLE_DOMAIN_ID = #{socialAndFundBusinessPageVo.settleDomainId}
				</if>
				<if test="socialAndFundBusinessPageVo.year != null and socialAndFundBusinessPageVo.year.trim() != ''">
					AND (a.SOCIAL_PAY_MONTH like CONCAT(#{socialAndFundBusinessPageVo.year},'%')
					or a.PROVIDENT_PAY_MONTH like CONCAT(#{socialAndFundBusinessPageVo.year},'%'))
				</if>
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND a.SETTLE_DOMAIN_ID in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			) x
		</where>
		GROUP BY x.SOCIAL_PAY_MONTH;
	</select>

	<!-- B端 -->
	<select id="getSocialOrFundAddEmpIds" resultType="java.lang.String">
		select x.EMP_ID from (
		SELECT a.EMP_ID FROM t_social_info a
		<where>
			a.DELETE_FLAG=0 and a.HANDLE_STATUS=1
			<if test="month != null and month.trim() != ''">
				AND a.HANDLE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
				AND a.HANDLE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
			</if>
			<if test="settleDomainId != null and settleDomainId.trim() != ''">
				AND a.SETTLE_DOMAIN = #{settleDomainId}
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND a.SETTLE_DOMAIN in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
		</where>
		UNION
		SELECT b.EMP_ID FROM t_provident_fund b
		<where>
			b.DELETE_FLAG=0 and b.HANDLE_STATUS=1
			<!--type 0 获取所有办理成功的社保或公积金  1 获取对应月份的办理成功的社保或公积金-->
			<if test="month != null and month.trim() != ''">
				AND b.HANDLE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
				AND b.HANDLE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
			</if>
			<if test="settleDomainId != null and settleDomainId.trim() != ''">
				AND b.SETTLE_DOMAIN = #{settleDomainId}
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND b.SETTLE_DOMAIN in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
		</where>
		) x
	</select>

	<!--缴费库列表B端查询接口-->
	<select id="getPaymentBusinessPageVo" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.PaymentBusinessPageVo">

		SELECT
		a.EMP_NAME as  'empName',
		a.EMP_ID as 'empId',
		ifnull(a.SOCIAL_PAY_MONTH,a.PROVIDENT_PAY_MONTH) as 'month',
		SUM(
		IF(a.PERSONAL_ACCRUAL,a.PERSONAL_ACCRUAL,0) +
		IF(a.PERSONAL_BIGMAILMENT_MONEY,a.PERSONAL_BIGMAILMENT_MONEY,0) +
		IF(a.PERSONAL_MEDICAL_MONEY,a.PERSONAL_MEDICAL_MONEY,0) +
		IF(a.PERSONAL_UNEMPLOYMENT_MONEY,a.PERSONAL_UNEMPLOYMENT_MONEY,0) +
		IF(a.PERSONAL_PENSION_MONEY,a.PERSONAL_PENSION_MONEY,0) +
		IF(a.PERSONAL_PROVIDENT_SUM,a.PERSONAL_PROVIDENT_SUM,0)
		) AS "personalSum",
		SUM(
		IF(a.UNIT_BIGMAILMENT_MONEY,a.UNIT_BIGMAILMENT_MONEY,0) +
		IF(a.COMPANY_ACCRUAL,a.COMPANY_ACCRUAL,0) +
		IF(a.UNIT_PENSION_MONEY,a.UNIT_PENSION_MONEY,0) +
		IF(a.UNIT_MEDICAL_MONEY,a.UNIT_MEDICAL_MONEY,0) +
		IF(a.UNIT_INJURY_MONEY,a.UNIT_INJURY_MONEY,0) +
		IF(a.UNIT_UNEMPLOYMENT_MONEY,a.UNIT_UNEMPLOYMENT_MONEY,0) +
		IF(a.UNIT_BIRTH_MONEY,a.UNIT_BIRTH_MONEY,0) +
		IF(a.UNIT_PROVIDENT_SUM,a.UNIT_PROVIDENT_SUM,0)
		) AS "unitSum",
		SUM(
		IF(a.PERSONAL_PROVIDENT_SUM,a.PERSONAL_PROVIDENT_SUM,0)
		) AS "fundPersonalSum",
		SUM(
		IF(a.UNIT_PROVIDENT_SUM,a.UNIT_PROVIDENT_SUM,0)
		) AS "fundUnitSum",
		SUM(
		IF(a.PERSONAL_ACCRUAL,a.PERSONAL_ACCRUAL,0) +
		IF(a.PERSONAL_BIGMAILMENT_MONEY,a.PERSONAL_BIGMAILMENT_MONEY,0) +
		IF(a.PERSONAL_MEDICAL_MONEY,a.PERSONAL_MEDICAL_MONEY,0) +
		IF(a.PERSONAL_UNEMPLOYMENT_MONEY,a.PERSONAL_UNEMPLOYMENT_MONEY,0) +
		IF(a.PERSONAL_PENSION_MONEY,a.PERSONAL_PENSION_MONEY,0)
		) AS "socialPersonalSum",
		SUM(
		IF(a.UNIT_BIGMAILMENT_MONEY,a.UNIT_BIGMAILMENT_MONEY,0) +
		IF(a.COMPANY_ACCRUAL,a.COMPANY_ACCRUAL,0) +
		IF(a.UNIT_PENSION_MONEY,a.UNIT_PENSION_MONEY,0) +
		IF(a.UNIT_MEDICAL_MONEY,a.UNIT_MEDICAL_MONEY,0) +
		IF(a.UNIT_INJURY_MONEY,a.UNIT_INJURY_MONEY,0) +
		IF(a.UNIT_UNEMPLOYMENT_MONEY,a.UNIT_UNEMPLOYMENT_MONEY,0) +
		IF(a.UNIT_BIRTH_MONEY,a.UNIT_BIRTH_MONEY,0)
		) AS "socialUnitSum"
		FROM t_payment_info a
		<where>
			1=1
			<if test="paymentBusinessPageVo != null">
				<if test="paymentBusinessPageVo.settleDomainId != null and paymentBusinessPageVo.settleDomainId.trim() != ''">
					AND a.SETTLE_DOMAIN_ID = #{paymentBusinessPageVo.settleDomainId}
				</if>
				<if test="paymentBusinessPageVo.month != null and paymentBusinessPageVo.month.trim() != ''">
					AND (a.SOCIAL_PAY_MONTH = #{paymentBusinessPageVo.month} or a.PROVIDENT_PAY_MONTH = #{paymentBusinessPageVo.month})
				</if>
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND a.SETTLE_DOMAIN_ID in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			<if test="empIds != null and empIds.size > 0">
				AND a.EMP_ID in
				<foreach item="item" index="index" collection="empIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			GROUP BY
			a.SOCIAL_PAY_MONTH,a.EMP_ID
		</where>
	</select>

	<select id="getSocialOrFundAddCount" resultType="java.lang.Integer">
		select count(DISTINCT x.EMP_ID) from (
		SELECT a.EMP_ID FROM t_social_info a
		<where>
			a.DELETE_FLAG=0 and a.HANDLE_STATUS in ('1','3')
			<!--type 0 获取所有办理成功的社保或公积金  1 获取对应月份的办理成功的社保或公积金 -->
			<if test="type != null and type == 1">

				<if test="month != null and month.trim() != ''">
					AND a.HANDLE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
					AND a.HANDLE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
				</if>
			</if>
			<if test="settleDomainId != null and settleDomainId.trim() != ''">
				AND a.SETTLE_DOMAIN = #{settleDomainId}
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND a.SETTLE_DOMAIN in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
		</where>
		UNION
		SELECT b.EMP_ID FROM t_provident_fund b
		<where>
			b.DELETE_FLAG=0 and b.HANDLE_STATUS in ('1','3')
			<!--type 0 获取所有办理成功的社保或公积金  1 获取对应月份的办理成功的社保或公积金-->
			<if test="type != null and type == 1">
				<if test="month != null and month.trim() != ''">
					AND b.HANDLE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
					AND b.HANDLE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
				</if>
			</if>
			<if test="settleDomainId != null and settleDomainId.trim() != ''">
				AND b.SETTLE_DOMAIN = #{settleDomainId}
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND b.SETTLE_DOMAIN in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
		</where>
		) x
	</select>

	<select id="getSocialOrFundReduceCount" resultType="java.lang.Integer">
		select count(DISTINCT x.EMP_ID) from (
		SELECT a.EMP_ID FROM t_dispatch_info a
		<where>
			a.DELETE_FLAG=0
			AND a.TYPE =1
			AND a.SOCIAL_ID is not NULL
			AND a.SOCIAL_HANDLE_STATUS=1
			<if test="month != null and month.trim() != ''">
				AND a.CREATE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
				AND a.CREATE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
			</if>
			<if test="settleDomainId != null and settleDomainId.trim() != ''">
				AND a.SETTLE_DOMAIN = #{settleDomainId}
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND a.SETTLE_DOMAIN in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
		</where>
		UNION
		SELECT b.EMP_ID FROM t_dispatch_info b
		<where>
			b.DELETE_FLAG=0 and b.TYPE=1
			AND b.FUND_ID is not NULL
			AND b.FUND_HANDLE_STATUS=1
			<if test="month != null and month.trim() != ''">
				AND b.CREATE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
				AND b.CREATE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
			</if>
			<if test="settleDomainId != null and settleDomainId.trim() != ''">
				AND b.SETTLE_DOMAIN = #{settleDomainId}
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND b.SETTLE_DOMAIN in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
		</where>
		) x
	</select>

	<!--B端查询指定月份的派减分页数据-->
	<select id="getSocialAndFundReduceInfo" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialAndFundReduceBusinessVo">
		SELECT
		z.EMP_NAME as 'empName',
		GROUP_CONCAT(z.LEAVE_DATE) as 'leaveDate',
		GROUP_CONCAT(z.SOCIAL_HANDLE_STATUS) as 'socialStatus',
		GROUP_CONCAT(z.FUND_HANDLE_STATUS) as 'fundStatus',
		GROUP_CONCAT(z.SOCIAL_REDUCE_DATE) as 'socialReduceDate',
		GROUP_CONCAT(z.FUND_REDUCE_DATE)  as 'fundReduceDate'
		FROM (
		SELECT
		a.EMP_ID,
		a.EMP_NAME,
		a.LEAVE_DATE,
		a.SOCIAL_HANDLE_STATUS,
		NULL as 'FUND_HANDLE_STATUS',
		a.SOCIAL_REDUCE_DATE as 'SOCIAL_REDUCE_DATE',
		NULL as 'FUND_REDUCE_DATE'
		FROM t_dispatch_info a
		<where>
			a.DELETE_FLAG=0
			AND a.TYPE =1
			AND a.SOCIAL_ID is not NULL
			AND a.SOCIAL_HANDLE_STATUS=1
			<if test="month != null and month.trim() != ''">
				AND a.CREATE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
				AND a.CREATE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
			</if>
			<if test="settleDomainId != null and settleDomainId.trim() != ''">
				AND a.SETTLE_DOMAIN = #{settleDomainId}
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND a.SETTLE_DOMAIN in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
		</where>
		UNION ALL
		SELECT
		b.EMP_ID,
		b.EMP_NAME,
		b.LEAVE_DATE,
		NULL as 'SOCIAL_HANDLE_STATUS',
		b.FUND_HANDLE_STATUS,
		NULL as 'SOCIAL_REDUCE_DATE',
		b.FUND_REDUCE_DATE as 'FUND_REDUCE_DATE'
		FROM t_dispatch_info b
		<where>
			b.DELETE_FLAG=0
			AND b.TYPE=1
			AND b.FUND_ID is not NULL
			AND b.FUND_HANDLE_STATUS=1
			<if test="month != null and month.trim() != ''">
				AND b.CREATE_TIME <![CDATA[>=]]> DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d")
				AND b.CREATE_TIME <![CDATA[<=]]> last_day(DATE_FORMAT(CONCAT(#{month},"01"),"%Y-%m-%d"))
			</if>
			<if test="settleDomainId != null and settleDomainId.trim() != ''">
				AND b.SETTLE_DOMAIN = #{settleDomainId}
			</if>
			<if test="settleDomainIds != null and settleDomainIds.size > 0">
				AND b.SETTLE_DOMAIN in
				<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
		</where>
		) z GROUP BY z.EMP_ID
	</select>
	<select id="selectCountPaymentSearchInfoSocial" resultType="java.lang.Integer">
		SELECT
		<!--<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''  and tPaymentInfo.socialHousehold == null">
			distinct a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH,a.SETTLE_DOMAIN_CODE
		</if>
		<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
			distinct a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SETTLE_DOMAIN_CODE
		</if>-->

			<choose>
				<when test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''  and tPaymentInfo.socialHousehold == null">
					COUNT(DISTINCT CONCAT(a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH)) as 'count'
				</when>
				<when test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
					COUNT(DISTINCT CONCAT(a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH)) as 'count'
				</when>
				<otherwise>
					COUNT(DISTINCT CONCAT(a.EMP_IDCARD,IFNULL(a.SOCIAL_PAY_MONTH,a.PROVIDENT_PAY_MONTH),IFNULL(a.SOCIAL_CREATE_MONTH,a.PROVIDENT_CREATE_MONTH))) as 'count'
				</otherwise>
			</choose>


		FROM t_payment_info a
		<where>
			<include refid="tPaymentInfo_export_count_where"/>
		</where>
	</select>
	<select id="selectCountPaymentSearchInfoSocialByLimit" resultType="java.lang.Integer">
		SELECT
		<!--<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''  and tPaymentInfo.socialHousehold == null">
			distinct a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
		</if>
		<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
			distinct a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
		</if>-->

		<choose>
			<when test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''  and tPaymentInfo.socialHousehold == null">
				COUNT(DISTINCT CONCAT(a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH)) as 'count'
			</when>
			<when test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
				COUNT(DISTINCT CONCAT(a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH)) as 'count'
			</when>
			<otherwise>
				COUNT(DISTINCT CONCAT(a.EMP_IDCARD,IFNULL(a.SOCIAL_PAY_MONTH,a.PROVIDENT_PAY_MONTH),IFNULL(a.SOCIAL_CREATE_MONTH,a.PROVIDENT_CREATE_MONTH))) as 'count'
			</otherwise>
		</choose>

		FROM t_payment_info a
		<where>
			<include refid="tPaymentInfo_export_count_where"/>
		</where>
		    limit 20001
	</select>
	<select id="selectCountPaymentSearchInfoFund" resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM (
		select
		1
		from (
		(SELECT
		distinct a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
			<include refid="tPaymentInfo_export_fund_where"/>
		</where>
		)
		) w ) c
	</select>

	<!--tPaymentInfo合并查询 通过keygroup获取对应数据-->
	<select id="getSumByKeyGroupSocial" resultMap="tPaymentInfoSumMap">
		SELECT
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
		SUM( IFNULL(a.SUM_ALL,0) ) AS SUM_ALL,
		SUM( IFNULL(a.SOCIAL_SUM,0) ) AS SOCIAL_SUM,
		0  AS PROVIDENT_SUM,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_PAY_ADDR,
		null PROVIDENT_HOUSEHOLD,
		null PROVIDENT_PAY_ADDR
		FROM t_payment_info a
		<where>
			<if test="empIdcard != null and empIdcard !=''">
				AND a.EMP_IDCARD = #{empIdcard}
			</if>
			<if test="empIdcard == null or empIdcard ==''">
				AND a.EMP_IDCARD is null
			</if>
			<if test="payMonth != null and payMonth !=''">
				AND a.SOCIAL_PAY_MONTH = #{payMonth}
			</if>
			<if test="payMonth == null or payMonth ==''">
				AND a.SOCIAL_PAY_MONTH is null
			</if>
			<if test="createMonth != null and createMonth !=''">
				AND a.SOCIAL_CREATE_MONTH  = #{createMonth}
			</if>
			<if test="createMonth == null or createMonth ==''">
				AND a.SOCIAL_CREATE_MONTH  is null
			</if>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
		limit 1
	</select>
	<!--tPaymentInfo合并查询 通过keygroup获取对应数据-->
	<select id="getSumByKeyGroupFund" resultMap="tPaymentInfoSumMap">
		SELECT
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
		SUM( IFNULL(a.SUM_ALL,0) ) AS SUM_ALL,
		SUM( IFNULL(a.PROVIDENT_SUM,0) ) AS PROVIDENT_SUM,
		0 AS SOCIAL_SUM,
		null SOCIAL_HOUSEHOLD,
		null SOCIAL_PAY_ADDR,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR
		FROM t_payment_info a
		<where>
			<if test="empIdcard != null and empIdcard !=''">
				AND a.EMP_IDCARD = #{empIdcard}
			</if>
			<if test="empIdcard == null or empIdcard ==''">
				AND a.EMP_IDCARD is null
			</if>
			<if test="payMonth != null and payMonth !=''">
				AND a.PROVIDENT_PAY_MONTH = #{payMonth}
			</if>
			<if test="payMonth == null or payMonth ==''">
				AND a.PROVIDENT_PAY_MONTH is null
			</if>
			<if test="createMonth != null and createMonth !=''">
				AND a.PROVIDENT_CREATE_MONTH  = #{createMonth}
			</if>
			<if test="createMonth == null or createMonth ==''">
				AND a.PROVIDENT_CREATE_MONTH  is null
			</if>
		</where>
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
		limit 1
	</select>
</mapper>