TPaymentInfoMapper.xml 149 KB
Newer Older
huyuchen's avatar
huyuchen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<?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">
huyuchen's avatar
huyuchen committed
25 26 27 28 29 30 31
	<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"/>
huyuchen's avatar
huyuchen committed
32 33 34
		<result property="unitName" column="UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
huyuchen's avatar
huyuchen committed
35 36 37 38 39 40 41
		<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"/>
huyuchen's avatar
huyuchen committed
42
		<result property="pushStatus" column="PUSH_STATUS"/>
huyuchen's avatar
huyuchen committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
		<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"/>
89 90
		<result property="salarySocialFlag" column="SALARY_SOCIAL_FLAG"/>
		<result property="salaryFundFlag" column="SALARY_FUND_FLAG"/>
huyuchen's avatar
huyuchen committed
91 92 93 94 95 96 97 98 99 100
		<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"/>
huyuchen's avatar
huyuchen committed
101
		<result property="incomeStatus" column="INCOME_STATUS"/>
huyuchen's avatar
huyuchen committed
102
		<result property="isIncomeStatus" column="IS_INCOME_STATUS"/>
huyuchen's avatar
huyuchen committed
103 104
		<result property="incomeSettleFlag" column="INCOME_SETTLE_FLAG"/>
		<result property="incomeCollectFlag" column="INCOME_COLLECT_FLAG"/>
huyuchen's avatar
huyuchen committed
105 106
		<result property="paySettleFlag" column="PAY_SETTLE_FLAG"/>
		<result property="payCollectFlag" column="PAY_COLLECT_FLAG"/>
huyuchen's avatar
huyuchen committed
107
		<result property="bpoFlag" column="BPO_FLAG"/>
huyuchen's avatar
huyuchen committed
108
		<result property="secondIndicatorBelong" column="SECOND_INDICATOR_BELONG"/>
huyuchen's avatar
huyuchen committed
109
	</resultMap>
huyuchen's avatar
huyuchen committed
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
	<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"/>
huyuchen's avatar
huyuchen committed
158
		<result property="personalProvidentSum" column="PERSONAL_PROVIDENT_SUM"/>
huyuchen's avatar
huyuchen committed
159 160
		<result property="keyGroup" column="keyGroup"/>
	</resultMap>
huyuchen's avatar
huyuchen committed
161

huyuchen's avatar
huyuchen committed
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
	<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"/>
huyuchen's avatar
huyuchen committed
190 191
		<result property="createName" column="CREATE_NAME"/>
		<result property="createTime" column="CREATE_TIME"/>
huyuchen's avatar
huyuchen committed
192
		<result property="bpoFlag" column="BPO_FLAG"/>
huyuchen's avatar
huyuchen committed
193 194
	</resultMap>

huyuchen's avatar
huyuchen committed
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
	<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>
huyuchen's avatar
huyuchen committed
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289

	<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"/>
huyuchen's avatar
huyuchen committed
290 291 292 293 294
		<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"/>
huyuchen's avatar
huyuchen committed
295 296 297 298 299 300
		<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"/>
huyuchen's avatar
huyuchen committed
301 302 303
		<result property="unitSocialFundSum" column="UNIT_SOCIAL_FUND_SUM"/>
		<result property="socialFundPersonalSum" column="SOCIAL_FUND_PERSONAL_SUM"/>
		<result property="keyGroup" column="keyGroup"/>
huyuchen's avatar
huyuchen committed
304
		<result property="secondIndicatorBelong" column="SECOND_INDICATOR_BELONG"/>
305 306 307 308 309 310 311 312
		<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"/>
huyuchen's avatar
huyuchen committed
313 314 315 316
	</resultMap>

	<resultMap id="tPaymentInfoNewExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoNewExportVo">
		<result property="empName" column="EMP_NAME"/>
huyuchen's avatar
huyuchen committed
317
		<result property="empNo" column="EMP_NO"/>
huyuchen's avatar
huyuchen committed
318 319 320
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
huyuchen's avatar
huyuchen committed
321
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
huyuchen's avatar
huyuchen committed
322
		<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
huyuchen's avatar
huyuchen committed
323
		<result property="socialSecurityNo" column="SOCIAL_SECURITY_NO"/>
huyuchen's avatar
huyuchen committed
324 325 326 327
		<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"/>
huyuchen's avatar
huyuchen committed
328 329
		<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
		<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
huyuchen's avatar
huyuchen committed
330 331 332
		<result property="providentHousehold" column="PROVIDENT_HOUSEHOLD"/>
		<result property="providentPayAddr" column="PROVIDENT_PAY_ADDR"/>
		<result property="socialSum" column="SOCIAL_SUM"/>
huyuchen's avatar
huyuchen committed
333 334
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="socialSecurityPersonalSum" column="SOCIAL_SECURITY_PERSONAL_SUM"/>
huyuchen's avatar
huyuchen committed
335
		<result property="providentSum" column="PROVIDENT_SUM"/>
huyuchen's avatar
huyuchen committed
336 337 338 339 340 341 342 343 344 345 346
		<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"/>
huyuchen's avatar
huyuchen committed
347 348
		<result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
		<result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
huyuchen's avatar
huyuchen committed
349 350 351 352 353 354 355 356 357 358 359
		<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"/>
huyuchen's avatar
huyuchen committed
360
		<result property="keyGroup" column="keyGroup"/>
huyuchen's avatar
huyuchen committed
361
		<result property="secondIndicatorBelong" column="SECOND_INDICATOR_BELONG"/>
362 363 364 365 366 367 368 369 370 371 372 373 374 375
		<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"/>
huyuchen's avatar
huyuchen committed
376
	</resultMap>
huyuchen's avatar
huyuchen committed
377
	<sql id="Base_Column_List">
huyuchen's avatar
huyuchen committed
378
		a.ID,
huyuchen's avatar
huyuchen committed
379 380 381 382 383
                a.EMP_NAME,
                a.EMP_NO,
                a.EMP_ID,
                a.EMP_IDCARD,
                a.UNIT_ID,
huyuchen's avatar
huyuchen committed
384 385 386
                a.UNIT_NAME,
                a.SETTLE_DOMAIN_CODE,
                a.SETTLE_DOMAIN_NAME,
huyuchen's avatar
huyuchen committed
387 388 389 390 391 392 393
                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,
huyuchen's avatar
huyuchen committed
394
                a.PUSH_STATUS,
huyuchen's avatar
huyuchen committed
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
                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,
413 414
                a.SALARY_SOCIAL_FLAG,
        		a.SALARY_FUND_FLAG,
huyuchen's avatar
huyuchen committed
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447
                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,
huyuchen's avatar
huyuchen committed
448
                a.CREATE_BY,
huyuchen's avatar
huyuchen committed
449
                a.UPDATE_TIME,
huyuchen's avatar
huyuchen committed
450 451
                a.UPDATE_BY,
                a.CREATE_NAME,
huyuchen's avatar
huyuchen committed
452
                a.BPO_FLAG,
huyuchen's avatar
huyuchen committed
453 454 455 456 457 458 459 460
                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() != ''">
461
				AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
huyuchen's avatar
huyuchen committed
462 463 464 465 466 467 468 469
			</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() != ''">
fangxinjiang's avatar
fangxinjiang committed
470
				AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
huyuchen's avatar
huyuchen committed
471 472 473 474
			</if>
			<if test="tPaymentInfo.unitId != null and tPaymentInfo.unitId.trim() != ''">
				AND a.UNIT_ID = #{tPaymentInfo.unitId}
			</if>
huyuchen's avatar
huyuchen committed
475 476 477 478 479 480 481 482 483
			<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>
huyuchen's avatar
huyuchen committed
484 485 486 487
			<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() != ''">
huyuchen's avatar
huyuchen committed
488
				AND a.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
huyuchen's avatar
huyuchen committed
489 490 491 492 493 494 495 496
			</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() != ''">
huyuchen's avatar
huyuchen committed
497
				AND (a.SOCIAL_PAY_MONTH = '${tPaymentInfo.socialPayMonth}' or a.PROVIDENT_PAY_MONTH = '${tPaymentInfo.socialPayMonth}')
huyuchen's avatar
huyuchen committed
498 499
			</if>
			<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
huyuchen's avatar
huyuchen committed
500
				AND (a.SOCIAL_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}' or a.PROVIDENT_CREATE_MONTH = '${tPaymentInfo.socialCreateMonth}')
huyuchen's avatar
huyuchen committed
501 502 503 504
			</if>
			<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
				AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
			</if>
huyuchen's avatar
huyuchen committed
505 506
			<if test="tPaymentInfo.pushStatus != null and tPaymentInfo.pushStatus.trim() != ''">
				AND a.PUSH_STATUS = #{tPaymentInfo.pushStatus}
huyuchen's avatar
huyuchen committed
507 508 509 510 511
			</if>
			<if test="tPaymentInfo.sumAll != null">
				AND a.SUM_ALL = #{tPaymentInfo.sumAll}
			</if>
			<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
huyuchen's avatar
huyuchen committed
512
				AND a.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
huyuchen's avatar
huyuchen committed
513 514 515 516
			</if>
			<if test="tPaymentInfo.providentPayAddr != null and tPaymentInfo.providentPayAddr.trim() != ''">
				AND a.PROVIDENT_PAY_ADDR = #{tPaymentInfo.providentPayAddr}
			</if>
fangxinjiang's avatar
fangxinjiang committed
517
			<!-- 区域 默认精准查询 0    包含下级查询 1 开始 2023-03-02 fxj -->
fangxinjiang's avatar
fangxinjiang committed
518
			<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
fangxinjiang's avatar
fangxinjiang committed
519 520 521
				<if test="tPaymentInfo.socialTown == null">
					<if test="tPaymentInfo.socialCity != null">
						AND (a.SOCIAL_CITY = '${tPaymentInfo.socialCity}' or a.FUND_CITY = '${tPaymentInfo.socialCity}')
huyuchen's avatar
huyuchen committed
522
					</if>
fangxinjiang's avatar
fangxinjiang committed
523 524 525 526
					<if test="tPaymentInfo.socialCity == null">
						<if test="tPaymentInfo.socialProvince != null">
							AND (a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' or a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}')
						</if>
huyuchen's avatar
huyuchen committed
527 528
					</if>
				</if>
fangxinjiang's avatar
fangxinjiang committed
529 530
				<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
					AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
huyuchen's avatar
huyuchen committed
531 532
				</if>
			</if>
fangxinjiang's avatar
fangxinjiang committed
533
			<if test='tPaymentInfo.areaFlag == "0"'>
fangxinjiang's avatar
fangxinjiang committed
534 535
				<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
					AND (
fangxinjiang's avatar
fangxinjiang committed
536
					(a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY =''))
fangxinjiang's avatar
fangxinjiang committed
537
					or
fangxinjiang's avatar
fangxinjiang committed
538
					(a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY =''))
fangxinjiang's avatar
fangxinjiang committed
539 540 541 542
					)
				</if>
				<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
					AND (
fangxinjiang's avatar
fangxinjiang committed
543
					(a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'  and (a.SOCIAL_TOWN is null  or a.SOCIAL_TOWN =''))
fangxinjiang's avatar
fangxinjiang committed
544
					or
fangxinjiang's avatar
fangxinjiang committed
545
					(a.FUND_CITY = '${tPaymentInfo.socialCity}' and  (a.FUND_TOWN is null or a.FUND_TOWN =''))
fangxinjiang's avatar
fangxinjiang committed
546 547 548 549 550
					)
				</if>
				<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
					AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
				</if>
huyuchen's avatar
huyuchen committed
551
			</if>
fangxinjiang's avatar
fangxinjiang committed
552 553 554
			<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->


huyuchen's avatar
huyuchen committed
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686
			<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>
huyuchen's avatar
huyuchen committed
687 688
			<if test="tPaymentInfo.createTimeStart != null and tPaymentInfo.createTimeEnd != null">
				AND a.CREATE_TIME BETWEEN #{tPaymentInfo.createTimeStart} AND #{tPaymentInfo.createTimeEnd}
huyuchen's avatar
huyuchen committed
689 690 691 692 693 694 695 696 697 698 699 700
			</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>
huyuchen's avatar
huyuchen committed
701
			<if test="tPaymentInfo.idList == null">
702 703 704
				<if test="tPaymentInfo.pushStatus != null and tPaymentInfo.pushStatus.trim() != ''">
					AND a.PUSH_STATUS = #{tPaymentInfo.pushStatus}
				</if>
huyuchen's avatar
huyuchen committed
705 706 707 708
				<if test="tPaymentInfo.id != null and tPaymentInfo.id.trim() != ''">
					AND a.ID = #{tPaymentInfo.id}
				</if>
				<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
709
					AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
huyuchen's avatar
huyuchen committed
710 711 712 713 714
				</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() != ''">
fangxinjiang's avatar
fangxinjiang committed
715
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
huyuchen's avatar
huyuchen committed
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755
				</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>
fangxinjiang's avatar
fangxinjiang committed
756
				<!-- 区域 默认精准查询 0    包含下级查询 1 开始 2023-03-02 fxj -->
fangxinjiang's avatar
fangxinjiang committed
757
				<if test='tPaymentInfo.areaFlag == null || tPaymentInfo.areaFlag == "1"'>
fangxinjiang's avatar
fangxinjiang committed
758 759 760 761 762 763 764 765
					<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>
huyuchen's avatar
huyuchen committed
766
						</if>
huyuchen's avatar
huyuchen committed
767
					</if>
fangxinjiang's avatar
fangxinjiang committed
768 769 770
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
					</if>
huyuchen's avatar
huyuchen committed
771
				</if>
fangxinjiang's avatar
fangxinjiang committed
772
				<if test='tPaymentInfo.areaFlag == "0"'>
fangxinjiang's avatar
fangxinjiang committed
773 774
					<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
						AND (
fangxinjiang's avatar
fangxinjiang committed
775
						(a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY =''))
fangxinjiang's avatar
fangxinjiang committed
776
						or
fangxinjiang's avatar
fangxinjiang committed
777
						(a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY =''))
fangxinjiang's avatar
fangxinjiang committed
778 779 780 781
						)
					</if>
					<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
						AND (
fangxinjiang's avatar
fangxinjiang committed
782
						(a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'  and (a.SOCIAL_TOWN is null  or a.SOCIAL_TOWN =''))
fangxinjiang's avatar
fangxinjiang committed
783
						or
fangxinjiang's avatar
fangxinjiang committed
784
						(a.FUND_CITY = '${tPaymentInfo.socialCity}' and (a.FUND_TOWN is null or a.FUND_TOWN =''))
fangxinjiang's avatar
fangxinjiang committed
785 786 787 788 789
						)
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
					</if>
huyuchen's avatar
huyuchen committed
790
				</if>
fangxinjiang's avatar
fangxinjiang committed
791 792
				<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->

huyuchen's avatar
huyuchen committed
793 794 795 796 797 798 799 800 801
				<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>
802 803 804
				<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
					AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
				</if>
huyuchen's avatar
huyuchen committed
805 806 807
				<if test="tPaymentInfo.createBy != null and tPaymentInfo.createBy.trim() != ''">
					AND a.CREATE_BY = #{tPaymentInfo.createBy}
				</if>
huyuchen's avatar
huyuchen committed
808 809 810
			</if>
		</if>
	</sql>
811 812 813 814 815 816 817 818 819 820
	<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() != ''">
fangxinjiang's avatar
fangxinjiang committed
821
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888
				</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>
huyuchen's avatar
huyuchen committed
889 890 891 892
	<sql id="tPaymentInfo_export_social_where">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
893
					AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'%')
huyuchen's avatar
huyuchen committed
894 895
				</if>
				<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
896
					AND a.EMP_IDCARD = #{tPaymentInfo.empIdcard}
huyuchen's avatar
huyuchen committed
897
				</if>
fangxinjiang's avatar
fangxinjiang committed
898 899 900
				<if test="tPaymentInfo.secondIndicatorBelong != null and tPaymentInfo.secondIndicatorBelong.trim() != ''">
					AND a.SECOND_INDICATOR_BELONG = #{tPaymentInfo.secondIndicatorBelong}
				</if>
huyuchen's avatar
huyuchen committed
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919
				<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">
huyuchen's avatar
huyuchen committed
920
							AND a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'
huyuchen's avatar
huyuchen committed
921 922 923
						</if>
						<if test="tPaymentInfo.socialCity == null">
							<if test="tPaymentInfo.socialProvince != null">
huyuchen's avatar
huyuchen committed
924
								AND a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}'
huyuchen's avatar
huyuchen committed
925 926 927 928
							</if>
						</if>
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
huyuchen's avatar
huyuchen committed
929
						AND a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}'
huyuchen's avatar
huyuchen committed
930 931 932 933
					</if>
				</if>
				<if test='tPaymentInfo.areaFlag == "0"'>
					<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
huyuchen's avatar
huyuchen committed
934
						AND a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.SOCIAL_CITY is null or a.SOCIAL_CITY ='')
huyuchen's avatar
huyuchen committed
935 936
					</if>
					<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
huyuchen's avatar
huyuchen committed
937
						AND a.SOCIAL_CITY = '${tPaymentInfo.socialCity}'  and (a.SOCIAL_TOWN is null  or a.SOCIAL_TOWN ='')
huyuchen's avatar
huyuchen committed
938 939
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
huyuchen's avatar
huyuchen committed
940
						AND a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}'
huyuchen's avatar
huyuchen committed
941 942
					</if>
				</if>
huyuchen's avatar
huyuchen committed
943 944 945
				<if test="tPaymentInfo.authSql != null and tPaymentInfo.authSql.trim() != ''">
					${tPaymentInfo.authSql}
				</if>
huyuchen's avatar
huyuchen committed
946
				<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->
fangxinjiang's avatar
fangxinjiang committed
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961
				<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>
huyuchen's avatar
huyuchen committed
962 963 964
			</if>
		</if>
	</sql>
965 966 967 968 969 970 971
	<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() != ''">
fangxinjiang's avatar
fangxinjiang committed
972
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039
				</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>
huyuchen's avatar
huyuchen committed
1040

huyuchen's avatar
huyuchen committed
1041
	<sql id="tPaymentInfo_export_socialFund_where2">
huyuchen's avatar
huyuchen committed
1042 1043 1044
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
huyuchen's avatar
huyuchen committed
1045
					AND c.SOCIAL_HOUSEHOLD = #{tPaymentInfo.socialHousehold}
huyuchen's avatar
huyuchen committed
1046 1047
				</if>
				<if test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''">
huyuchen's avatar
huyuchen committed
1048
					AND c.PROVIDENT_HOUSEHOLD = #{tPaymentInfo.providentHousehold}
huyuchen's avatar
huyuchen committed
1049
				</if>
huyuchen's avatar
huyuchen committed
1050 1051 1052
				<if test="tPaymentInfo.secondIndicatorBelong != null and tPaymentInfo.secondIndicatorBelong.trim() != ''">
					AND c.SECOND_INDICATOR_BELONG = #{tPaymentInfo.secondIndicatorBelong}
				</if>
huyuchen's avatar
huyuchen committed
1053 1054 1055 1056
			</if>
		</if>
	</sql>

huyuchen's avatar
huyuchen committed
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071
	<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>
huyuchen's avatar
huyuchen committed
1072 1073 1074
				<if test="tPaymentInfo.secondIndicatorBelong != null and tPaymentInfo.secondIndicatorBelong.trim() != ''">
					AND k.SECOND_INDICATOR_BELONG = #{tPaymentInfo.secondIndicatorBelong}
				</if>
huyuchen's avatar
huyuchen committed
1075 1076 1077 1078
			</if>
		</if>
	</sql>

huyuchen's avatar
huyuchen committed
1079 1080 1081 1082
	<sql id="tPaymentInfo_export_fund_where">
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.idList == null">
				<if test="tPaymentInfo.empName != null and tPaymentInfo.empName.trim() != ''">
1083
					AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
huyuchen's avatar
huyuchen committed
1084 1085
				</if>
				<if test="tPaymentInfo.empIdcard != null and tPaymentInfo.empIdcard.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
1086
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
huyuchen's avatar
huyuchen committed
1087
				</if>
fangxinjiang's avatar
fangxinjiang committed
1088 1089 1090
				<if test="tPaymentInfo.secondIndicatorBelong != null and tPaymentInfo.secondIndicatorBelong.trim() != ''">
					AND a.SECOND_INDICATOR_BELONG = #{tPaymentInfo.secondIndicatorBelong}
				</if>
huyuchen's avatar
huyuchen committed
1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109
				<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">
huyuchen's avatar
huyuchen committed
1110
							AND a.FUND_CITY = '${tPaymentInfo.socialCity}'
huyuchen's avatar
huyuchen committed
1111 1112 1113
						</if>
						<if test="tPaymentInfo.socialCity == null">
							<if test="tPaymentInfo.socialProvince != null">
huyuchen's avatar
huyuchen committed
1114
								AND a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}'
huyuchen's avatar
huyuchen committed
1115 1116 1117 1118
							</if>
						</if>
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
huyuchen's avatar
huyuchen committed
1119
						AND a.FUND_TOWN = '${tPaymentInfo.socialTown}'
huyuchen's avatar
huyuchen committed
1120 1121 1122 1123
					</if>
				</if>
				<if test='tPaymentInfo.areaFlag == "0"'>
					<if test="tPaymentInfo.socialProvince != null and tPaymentInfo.socialProvince.trim() != '' and tPaymentInfo.socialCity == null">
huyuchen's avatar
huyuchen committed
1124
						AND a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}' and (a.FUND_CITY is null or a.FUND_CITY ='')
huyuchen's avatar
huyuchen committed
1125 1126
					</if>
					<if test="tPaymentInfo.socialCity != null and tPaymentInfo.socialCity.trim() != '' and tPaymentInfo.socialTown == null">
huyuchen's avatar
huyuchen committed
1127
						AND a.FUND_CITY = '${tPaymentInfo.socialCity}' and (a.FUND_TOWN is null or a.FUND_TOWN ='')
huyuchen's avatar
huyuchen committed
1128 1129
					</if>
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
huyuchen's avatar
huyuchen committed
1130
						AND a.FUND_TOWN = '${tPaymentInfo.socialTown}'
huyuchen's avatar
huyuchen committed
1131 1132
					</if>
				</if>
huyuchen's avatar
huyuchen committed
1133 1134 1135
				<if test="tPaymentInfo.authSql != null and tPaymentInfo.authSql.trim() != ''">
					${tPaymentInfo.authSql}
				</if>
huyuchen's avatar
huyuchen committed
1136
				<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->
fangxinjiang's avatar
fangxinjiang committed
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151
				<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>
huyuchen's avatar
huyuchen committed
1152 1153 1154 1155
			</if>
		</if>
	</sql>

huyuchen's avatar
huyuchen committed
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168
	<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() != ''">
1169
					AND a.EMP_NAME like concat('',#{tPaymentInfo.empName},'')
huyuchen's avatar
huyuchen committed
1170 1171 1172 1173 1174
				</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() != ''">
fangxinjiang's avatar
fangxinjiang committed
1175
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
huyuchen's avatar
huyuchen committed
1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209
				</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>
fangxinjiang's avatar
fangxinjiang committed
1210 1211 1212 1213 1214 1215

				<!-- 区域 默认精准查询 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}')
huyuchen's avatar
huyuchen committed
1216
						</if>
fangxinjiang's avatar
fangxinjiang committed
1217 1218 1219 1220
						<if test="tPaymentInfo.socialCity == null">
							<if test="tPaymentInfo.socialProvince != null">
								AND (a.SOCIAL_PROVINCE = '${tPaymentInfo.socialProvince}' or a.FUND_PROVINCE = '${tPaymentInfo.socialProvince}')
							</if>
huyuchen's avatar
huyuchen committed
1221 1222
						</if>
					</if>
fangxinjiang's avatar
fangxinjiang committed
1223 1224
					<if test="tPaymentInfo.socialTown != null and tPaymentInfo.socialTown.trim() != ''">
						AND (a.SOCIAL_TOWN = '${tPaymentInfo.socialTown}' or a.FUND_TOWN = '${tPaymentInfo.socialTown}')
huyuchen's avatar
huyuchen committed
1225 1226
					</if>
				</if>
fangxinjiang's avatar
fangxinjiang committed
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244
				<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>
huyuchen's avatar
huyuchen committed
1245
				</if>
fangxinjiang's avatar
fangxinjiang committed
1246 1247
				<!-- 区域 默认精准查询 0    包含下级查询 1 结束  2023-03-02 fxj -->

huyuchen's avatar
huyuchen committed
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263
				<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>

huyuchen's avatar
huyuchen committed
1264 1265 1266 1267 1268 1269 1270 1271
	<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"/>
huyuchen's avatar
huyuchen committed
1272 1273 1274
		<result property="unitName" column="UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
huyuchen's avatar
huyuchen committed
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341
		<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简单分页查询-->
huyuchen's avatar
huyuchen committed
1342 1343
	<select id="getTPaymentInfoPage" resultMap="tPaymentInfoMap"
			resultType="com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo">
huyuchen's avatar
huyuchen committed
1344
		SELECT
huyuchen's avatar
huyuchen committed
1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366
		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
huyuchen's avatar
huyuchen committed
1367 1368 1369 1370 1371 1372 1373 1374
		FROM t_payment_info a
		<where>
			1=1
			<include refid="tPaymentInfo_where"/>
		</where>
		ORDER BY a.CREATE_TIME desc
	</select>

huyuchen's avatar
huyuchen committed
1375 1376
	<!--tPaymentInfo简单分页查询-->
	<select id="getTPaymentInfoNewPage" resultMap="tPaymentInfoNewMap">
huyuchen's avatar
huyuchen committed
1377
		SELECT
huyuchen's avatar
huyuchen committed
1378 1379 1380 1381 1382
		c.keyGroup,
		c.EMP_IDCARD,
		c.EMP_NAME,
		c.UNIT_NAME,
		c.SETTLE_DOMAIN_NAME,
huyuchen's avatar
huyuchen committed
1383
		c.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394
		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
huyuchen's avatar
huyuchen committed
1395 1396 1397 1398 1399
		w.keyGroup,
		w.EMP_IDCARD,
		w.EMP_NAME,
		w.UNIT_NAME,
		w.SETTLE_DOMAIN_NAME,
huyuchen's avatar
huyuchen committed
1400
		w.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411
		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
1412
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
huyuchen's avatar
huyuchen committed
1413 1414 1415 1416
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
huyuchen's avatar
huyuchen committed
1417
		a.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431
		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>
1432
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
huyuchen's avatar
huyuchen committed
1433 1434 1435
		)
		union all
		(SELECT
1436
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
huyuchen's avatar
huyuchen committed
1437 1438 1439 1440
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
huyuchen's avatar
huyuchen committed
1441
		a.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455
		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>
1456
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
huyuchen's avatar
huyuchen committed
1457 1458
		)
		) w
huyuchen's avatar
huyuchen committed
1459
		GROUP BY w.keyGroup ) c
huyuchen's avatar
huyuchen committed
1460 1461
		<where>
			1 = 1
huyuchen's avatar
huyuchen committed
1462
			<include refid="tPaymentInfo_export_socialFund_where2"/>
huyuchen's avatar
huyuchen committed
1463
		</where>
1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557

	</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>
huyuchen's avatar
huyuchen committed
1558 1559
	</select>

1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613
	<!--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>
huyuchen's avatar
huyuchen committed
1614 1615
	<!--tPaymentInfo简单分页查询-->
	<select id="getTPaymentInfoNewPageInfo" resultMap="tPaymentInfoNewMap">
huyuchen's avatar
huyuchen committed
1616
		SELECT
huyuchen's avatar
huyuchen committed
1617 1618 1619 1620
		k.EMP_IDCARD,
		k.EMP_NAME,
		k.UNIT_NAME,
		k.SETTLE_DOMAIN_NAME,
huyuchen's avatar
huyuchen committed
1621
		k.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662
		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,
1663 1664 1665 1666 1667 1668 1669 1670 1671
		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
huyuchen's avatar
huyuchen committed
1672 1673
		from (
		select
huyuchen's avatar
huyuchen committed
1674 1675 1676 1677 1678
		w.keyGroup,
		w.EMP_IDCARD,
		w.EMP_NAME,
		w.UNIT_NAME,
		w.SETTLE_DOMAIN_NAME,
huyuchen's avatar
huyuchen committed
1679
		w.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709
		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,
huyuchen's avatar
huyuchen committed
1710 1711 1712 1713 1714
		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,
huyuchen's avatar
huyuchen committed
1715 1716 1717 1718
		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,
huyuchen's avatar
huyuchen committed
1719 1720
		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,
1721
		SUM( w.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM,
1722 1723 1724 1725 1726 1727 1728 1729
		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
huyuchen's avatar
huyuchen committed
1730 1731
		FROM (
		(SELECT
1732
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
huyuchen's avatar
huyuchen committed
1733 1734 1735 1736
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
huyuchen's avatar
huyuchen committed
1737
		a.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767
		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,
huyuchen's avatar
huyuchen committed
1768 1769 1770 1771 1772
		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,
huyuchen's avatar
huyuchen committed
1773 1774 1775 1776
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.PERSONAL_PROIDENT_SET,
1777
		a.UNIT_PROVIDENT_SUM,
1778 1779 1780 1781 1782 1783 1784 1785
		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
huyuchen's avatar
huyuchen committed
1786 1787 1788
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1'
huyuchen's avatar
huyuchen committed
1789
			<include refid="tPaymentInfo_export_social_where"/>
huyuchen's avatar
huyuchen committed
1790
		</where>
1791
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
huyuchen's avatar
huyuchen committed
1792 1793 1794
		)
		union all
		(SELECT
1795
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
huyuchen's avatar
huyuchen committed
1796 1797 1798 1799
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
huyuchen's avatar
huyuchen committed
1800
		a.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
1801 1802 1803
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_SECURITY_NO,
		a.SOCIAL_PAY_ADDR,
huyuchen's avatar
huyuchen committed
1804 1805
		a.PROVIDENT_PAY_MONTH as SOCIAL_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH as SOCIAL_CREATE_MONTH,
huyuchen's avatar
huyuchen committed
1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830
		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,
huyuchen's avatar
huyuchen committed
1831 1832 1833 1834 1835
		null PENSION_MONEY_SUM,
		null MEDICAL_MONEY_SUM,
		null UNEMPLOYMENT_MONEY_SUM,
		null BIGMAILMENT_MONEY_SUM,
		null ACCRUAL_SUM,
huyuchen's avatar
huyuchen committed
1836 1837 1838 1839
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.PERSONAL_PROIDENT_SET,
1840 1841 1842 1843 1844 1845 1846 1847 1848
		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
huyuchen's avatar
huyuchen committed
1849 1850 1851
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
huyuchen's avatar
huyuchen committed
1852
			<include refid="tPaymentInfo_export_fund_where"/>
huyuchen's avatar
huyuchen committed
1853
		</where>
1854
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
huyuchen's avatar
huyuchen committed
1855 1856
		)
		) w
huyuchen's avatar
huyuchen committed
1857 1858
		GROUP BY w.keyGroup) k
		<where>
huyuchen's avatar
huyuchen committed
1859 1860 1861
			1 = 1
			<include refid="tPaymentInfo_export_socialFund_where1"/>
		</where>
huyuchen's avatar
huyuchen committed
1862 1863
	</select>

huyuchen's avatar
huyuchen committed
1864 1865 1866 1867 1868
	<!--tPaymentInfo数量查询-->
	<select id="selectCountPaymentSearchInfo" resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM (
huyuchen's avatar
huyuchen committed
1869
		select w.SOCIAL_HOUSEHOLD,w.PROVIDENT_HOUSEHOLD,w.SECOND_INDICATOR_BELONG from (
huyuchen's avatar
huyuchen committed
1870
		(SELECT
1871
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
huyuchen's avatar
huyuchen committed
1872
		a.SOCIAL_HOUSEHOLD,
huyuchen's avatar
huyuchen committed
1873 1874
		a.PROVIDENT_HOUSEHOLD,
		a.SECOND_INDICATOR_BELONG
huyuchen's avatar
huyuchen committed
1875 1876 1877 1878 1879
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1'
			<include refid="tPaymentInfo_export_social_where"/>
		</where>
1880
		GROUP BY  a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
huyuchen's avatar
huyuchen committed
1881 1882 1883
		)
		union all
		(SELECT
1884
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
huyuchen's avatar
huyuchen committed
1885
		a.SOCIAL_HOUSEHOLD,
huyuchen's avatar
huyuchen committed
1886 1887
		a.PROVIDENT_HOUSEHOLD,
		a.SECOND_INDICATOR_BELONG
huyuchen's avatar
huyuchen committed
1888 1889 1890 1891 1892
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
			<include refid="tPaymentInfo_export_fund_where"/>
		</where>
1893 1894 1895 1896 1897 1898 1899
		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>
huyuchen's avatar
huyuchen committed
1900 1901
		)
		) w
huyuchen's avatar
huyuchen committed
1902
		GROUP BY w.keyGroup) c
huyuchen's avatar
huyuchen committed
1903 1904
		<where>
			1 = 1
huyuchen's avatar
huyuchen committed
1905
			<include refid="tPaymentInfo_export_socialFund_where2"/>
huyuchen's avatar
huyuchen committed
1906
		</where>
huyuchen's avatar
huyuchen committed
1907 1908
	</select>

huyuchen's avatar
huyuchen committed
1909
	<!--tPaymentInfo简单分页查询-->
huyuchen's avatar
huyuchen committed
1910
	<select id="getTPaymentInfoNewExportInfo" resultMap="tPaymentInfoNewExportMap">
huyuchen's avatar
huyuchen committed
1911
		SELECT
huyuchen's avatar
huyuchen committed
1912 1913 1914 1915 1916 1917
		c.keyGroup,
		c.EMP_IDCARD,
		c.EMP_NO,
		c.EMP_NAME,
		c.UNIT_NAME,
		c.SETTLE_DOMAIN_CODE,
huyuchen's avatar
huyuchen committed
1918
		c.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952
		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,
1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966
		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,
huyuchen's avatar
huyuchen committed
1967 1968 1969 1970 1971 1972 1973
		c.PROVIDENT_NO AS PROVIDENT_NO,
		c.PERSONAL_PROIDENT_SET,
		c.UNIT_PROVIDENT_SET,
		c.PROVIDENT_PERCENT,
		c.UNIT_PROVIDENT_SUM
		from (
		select
huyuchen's avatar
huyuchen committed
1974 1975
		w.keyGroup,
		w.EMP_IDCARD,
huyuchen's avatar
huyuchen committed
1976
		w.EMP_NO,
huyuchen's avatar
huyuchen committed
1977 1978
		w.EMP_NAME,
		w.UNIT_NAME,
huyuchen's avatar
huyuchen committed
1979
		w.SETTLE_DOMAIN_CODE,
huyuchen's avatar
huyuchen committed
1980
		w.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
1981 1982
		w.SETTLE_DOMAIN_NAME,
		w.SOCIAL_HOUSEHOLD,
huyuchen's avatar
huyuchen committed
1983
		MAX( w.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
huyuchen's avatar
huyuchen committed
1984 1985 1986
		w.SOCIAL_PAY_ADDR,
		w.SOCIAL_PAY_MONTH,
		w.SOCIAL_CREATE_MONTH,
huyuchen's avatar
huyuchen committed
1987
		SUM( w.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
huyuchen's avatar
huyuchen committed
1988
		SUM( w.SUM_ALL ) AS SUM_ALL,
huyuchen's avatar
huyuchen committed
1989 1990
		MAX( w.PROVIDENT_PAY_MONTH ) AS PROVIDENT_PAY_MONTH,
		MAX( w.PROVIDENT_CREATE_MONTH ) AS PROVIDENT_CREATE_MONTH,
huyuchen's avatar
huyuchen committed
1991 1992 1993
		MAX( w.PROVIDENT_HOUSEHOLD ) AS PROVIDENT_HOUSEHOLD,
		MAX( w.PROVIDENT_PAY_ADDR ) AS PROVIDENT_PAY_ADDR,
		w.SOCIAL_SUM,
huyuchen's avatar
huyuchen committed
1994 1995
		w.UNIT_SOCIAL_SUM,
		w.SOCIAL_SECURITY_PERSONAL_SUM,
huyuchen's avatar
huyuchen committed
1996
		SUM( w.PROVIDENT_SUM ) AS PROVIDENT_SUM,
huyuchen's avatar
huyuchen committed
1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007
		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,
huyuchen's avatar
huyuchen committed
2008 2009
		w.UNIT_INJURY_MONEY,
		w.UNIT_BIRTH_MONEY,
huyuchen's avatar
huyuchen committed
2010 2011 2012 2013 2014
		w.UNIT_BIGMAILMENT_MONEY,
		w.PERSONAL_PENSION_MONEY,
		w.PERSONAL_MEDICAL_MONEY,
		w.PERSONAL_UNEMPLOYMENT_MONEY,
		w.PERSONAL_BIGMAILMENT_MONEY,
2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028
		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,
huyuchen's avatar
huyuchen committed
2029 2030 2031 2032 2033
		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
huyuchen's avatar
huyuchen committed
2034 2035
		FROM (
		(SELECT
2036
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
huyuchen's avatar
huyuchen committed
2037
		a.EMP_NAME,
huyuchen's avatar
huyuchen committed
2038
		a.EMP_NO,
huyuchen's avatar
huyuchen committed
2039 2040
		a.EMP_IDCARD,
		a.UNIT_NAME,
huyuchen's avatar
huyuchen committed
2041
		a.SETTLE_DOMAIN_CODE,
huyuchen's avatar
huyuchen committed
2042
		a.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
2043 2044
		a.SETTLE_DOMAIN_NAME,
		a.SOCIAL_HOUSEHOLD,
huyuchen's avatar
huyuchen committed
2045
		MAX( a.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
huyuchen's avatar
huyuchen committed
2046 2047 2048
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
huyuchen's avatar
huyuchen committed
2049
		a.PERSONAL_PROVIDENT_SUM,
huyuchen's avatar
huyuchen committed
2050
		SUM( a.SUM_ALL ) AS SUM_ALL,
huyuchen's avatar
huyuchen committed
2051 2052
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
huyuchen's avatar
huyuchen committed
2053 2054 2055
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
huyuchen's avatar
huyuchen committed
2056 2057
		SUM( a.UNIT_SOCIAL_SUM ) AS UNIT_SOCIAL_SUM,
		SUM( a.SOCIAL_SECURITY_PERSONAL_SUM ) AS SOCIAL_SECURITY_PERSONAL_SUM,
huyuchen's avatar
huyuchen committed
2058
		a.PROVIDENT_SUM,
huyuchen's avatar
huyuchen committed
2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069
		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,
huyuchen's avatar
huyuchen committed
2070 2071
		SUM( a.UNIT_INJURY_MONEY ) AS UNIT_INJURY_MONEY,
		SUM( a.UNIT_BIRTH_MONEY ) AS UNIT_BIRTH_MONEY,
huyuchen's avatar
huyuchen committed
2072 2073 2074 2075 2076
		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,
2077 2078 2079 2080 2081 2082
		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,
2083 2084 2085 2086 2087 2088 2089 2090
		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,
huyuchen's avatar
huyuchen committed
2091 2092 2093 2094 2095
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.PERSONAL_PROIDENT_SET,
		a.UNIT_PROVIDENT_SUM
huyuchen's avatar
huyuchen committed
2096 2097 2098
		FROM t_payment_info a
		<where>
			IFNULL(a.SOCIAL_ID,'1') != '1'
huyuchen's avatar
huyuchen committed
2099
			<include refid="tPaymentInfo_export_social_where"/>
huyuchen's avatar
huyuchen committed
2100
		</where>
2101
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
huyuchen's avatar
huyuchen committed
2102 2103 2104
		)
		union all
		(SELECT
2105
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH) AS keyGroup,
huyuchen's avatar
huyuchen committed
2106
		a.EMP_NAME,
huyuchen's avatar
huyuchen committed
2107
		a.EMP_NO,
huyuchen's avatar
huyuchen committed
2108 2109
		a.EMP_IDCARD,
		a.UNIT_NAME,
huyuchen's avatar
huyuchen committed
2110
		a.SETTLE_DOMAIN_CODE,
huyuchen's avatar
huyuchen committed
2111
		a.SECOND_INDICATOR_BELONG,
huyuchen's avatar
huyuchen committed
2112 2113
		a.SETTLE_DOMAIN_NAME,
		a.SOCIAL_HOUSEHOLD,
huyuchen's avatar
huyuchen committed
2114
		a.SOCIAL_SECURITY_NO,
huyuchen's avatar
huyuchen committed
2115
		a.SOCIAL_PAY_ADDR,
huyuchen's avatar
huyuchen committed
2116 2117 2118
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		SUM(a.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
huyuchen's avatar
huyuchen committed
2119
		SUM( a.SUM_ALL ) AS SUM_ALL,
huyuchen's avatar
huyuchen committed
2120 2121
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
huyuchen's avatar
huyuchen committed
2122 2123 2124
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_PAY_ADDR,
		a.SOCIAL_SUM,
huyuchen's avatar
huyuchen committed
2125 2126
		a.UNIT_SOCIAL_SUM,
		a.SOCIAL_SECURITY_PERSONAL_SUM,
huyuchen's avatar
huyuchen committed
2127
		SUM( a.PROVIDENT_SUM ) AS PROVIDENT_SUM,
huyuchen's avatar
huyuchen committed
2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138
		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,
huyuchen's avatar
huyuchen committed
2139 2140
		a.UNIT_INJURY_MONEY,
		a.UNIT_BIRTH_MONEY,
huyuchen's avatar
huyuchen committed
2141 2142 2143 2144 2145
		a.UNIT_BIGMAILMENT_MONEY,
		a.PERSONAL_PENSION_MONEY,
		a.PERSONAL_MEDICAL_MONEY,
		a.PERSONAL_UNEMPLOYMENT_MONEY,
		a.PERSONAL_BIGMAILMENT_MONEY,
2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159
		'' 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,
huyuchen's avatar
huyuchen committed
2160 2161 2162 2163 2164
		a.PROVIDENT_NO,
		a.UNIT_PROVIDENT_SET,
		a.PROVIDENT_PERCENT,
		a.PERSONAL_PROIDENT_SET,
		SUM( a.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
huyuchen's avatar
huyuchen committed
2165 2166 2167
		FROM t_payment_info a
		<where>
			IFNULL(a.FUND_ID,'1') != '1'
huyuchen's avatar
huyuchen committed
2168
			<include refid="tPaymentInfo_export_fund_where"/>
huyuchen's avatar
huyuchen committed
2169
		</where>
2170
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
huyuchen's avatar
huyuchen committed
2171 2172
		)
		) w
huyuchen's avatar
huyuchen committed
2173
		GROUP BY w.keyGroup) c
huyuchen's avatar
huyuchen committed
2174 2175
		<where>
			1 = 1
huyuchen's avatar
huyuchen committed
2176
			<include refid="tPaymentInfo_export_socialFund_where2"/>
huyuchen's avatar
huyuchen committed
2177
		</where>
huyuchen's avatar
huyuchen committed
2178
		limit #{tPaymentInfo.limitStart},#{tPaymentInfo.limitEnd}
huyuchen's avatar
huyuchen committed
2179 2180
	</select>

huyuchen's avatar
huyuchen committed
2181
	<!--tPaymentInfo不分页查询-->
huyuchen's avatar
huyuchen committed
2182
	<select id="getTPaymentInfoNoPage" resultMap="tPaymentInfoBatchMap">
huyuchen's avatar
huyuchen committed
2183
		SELECT
huyuchen's avatar
huyuchen committed
2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226
		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,
huyuchen's avatar
huyuchen committed
2227 2228
		CASE WHEN a.PUSH_STATUS=0 THEN "已推送"
		WHEN a.PUSH_STATUS =1 THEN "未推送"
huyuchen's avatar
huyuchen committed
2229
		ELSE a.PUSH_STATUS END as "PUSH_STATUS",
huyuchen's avatar
huyuchen committed
2230 2231
		CASE WHEN a.LOCK_STATUS=0 THEN "未打标"
		WHEN a.LOCK_STATUS =1 THEN "已打标"
huyuchen's avatar
huyuchen committed
2232
		ELSE a.LOCK_STATUS END as "LOCK_STATUS",
huyuchen's avatar
huyuchen committed
2233
		a.CREATE_NAME,
huyuchen's avatar
huyuchen committed
2234
		a.CREATE_TIME
huyuchen's avatar
huyuchen committed
2235 2236 2237 2238 2239 2240 2241 2242 2243
		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>

huyuchen's avatar
huyuchen committed
2244 2245 2246 2247 2248 2249
	<!--tPaymentInfo不分页查询-->
	<select id="getTPaymentInfoList" resultType="java.lang.String">
		SELECT
		a.ID
		FROM t_payment_info a
		<where>
huyuchen's avatar
huyuchen committed
2250
			a.LOCK_STATUS = '0'
huyuchen's avatar
huyuchen committed
2251 2252 2253 2254
			<include refid="tPaymentInfo_export_where"/>
		</where>
	</select>

huyuchen's avatar
huyuchen committed
2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265
	<!--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>

huyuchen's avatar
huyuchen committed
2266 2267 2268 2269 2270
	<!--tPaymentInfo合并查询-->
	<select id="getTPaymentInfoSumNoPage" resultMap="tPaymentInfoSumMap">
		SELECT
		w.keyGroup,
		w.EMP_IDCARD,
huyuchen's avatar
huyuchen committed
2271
		w.EMP_NO,
huyuchen's avatar
huyuchen committed
2272 2273 2274 2275 2276
		w.EMP_NAME,
		w.UNIT_NAME,
		w.SETTLE_DOMAIN_CODE,
		w.SETTLE_DOMAIN_NAME,
		w.SOCIAL_HOUSEHOLD,
huyuchen's avatar
huyuchen committed
2277
		MAX( w.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
huyuchen's avatar
huyuchen committed
2278 2279 2280
		w.SOCIAL_PAY_ADDR,
		w.SOCIAL_PAY_MONTH,
		w.SOCIAL_CREATE_MONTH,
huyuchen's avatar
huyuchen committed
2281
		SUM( w.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
huyuchen's avatar
huyuchen committed
2282
		SUM( w.SUM_ALL ) AS SUM_ALL,
huyuchen's avatar
huyuchen committed
2283 2284
		MAX( w.PROVIDENT_PAY_MONTH ) AS PROVIDENT_PAY_MONTH,
		MAX( w.PROVIDENT_CREATE_MONTH ) AS PROVIDENT_CREATE_MONTH,
huyuchen's avatar
huyuchen committed
2285 2286
		MAX( w.PROVIDENT_HOUSEHOLD ) AS PROVIDENT_HOUSEHOLD,
		MAX( w.PROVIDENT_PAY_ADDR ) AS PROVIDENT_PAY_ADDR,
huyuchen's avatar
huyuchen committed
2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308
		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,
huyuchen's avatar
huyuchen committed
2309
		MAX( w.PROVIDENT_NO ) AS PROVIDENT_NO,
huyuchen's avatar
huyuchen committed
2310
		MAX( w.PERSONAL_PROIDENT_SET ) AS PERSONAL_PROIDENT_SET,
huyuchen's avatar
huyuchen committed
2311 2312 2313 2314 2315 2316 2317 2318 2319
		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
2320
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup,
huyuchen's avatar
huyuchen committed
2321
		a.EMP_NAME,
huyuchen's avatar
huyuchen committed
2322
		a.EMP_NO,
huyuchen's avatar
huyuchen committed
2323 2324 2325 2326 2327
		a.EMP_IDCARD,
		a.UNIT_NAME,
		a.SETTLE_DOMAIN_CODE,
		a.SETTLE_DOMAIN_NAME,
		a.SOCIAL_HOUSEHOLD,
huyuchen's avatar
huyuchen committed
2328
		MAX( a.SOCIAL_SECURITY_NO ) AS SOCIAL_SECURITY_NO,
huyuchen's avatar
huyuchen committed
2329 2330 2331
		a.SOCIAL_PAY_ADDR,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
huyuchen's avatar
huyuchen committed
2332
		a.PERSONAL_PROVIDENT_SUM,
huyuchen's avatar
huyuchen committed
2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344
		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,
huyuchen's avatar
huyuchen committed
2345 2346 2347 2348 2349
		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,
huyuchen's avatar
huyuchen committed
2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370
		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>
huyuchen's avatar
huyuchen committed
2371
			IFNULL(a.SOCIAL_ID,'1') != '1'
huyuchen's avatar
huyuchen committed
2372 2373 2374 2375 2376 2377 2378 2379
			<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,
huyuchen's avatar
huyuchen committed
2380
		a.EMP_NO,
huyuchen's avatar
huyuchen committed
2381 2382 2383 2384 2385 2386 2387 2388 2389
		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,
huyuchen's avatar
huyuchen committed
2390
		SUM(a.PERSONAL_PROVIDENT_SUM) AS PERSONAL_PROVIDENT_SUM,
huyuchen's avatar
huyuchen committed
2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425
		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,
huyuchen's avatar
huyuchen committed
2426
		SUM( a.UNIT_PROVIDENT_SUM ) AS UNIT_PROVIDENT_SUM
huyuchen's avatar
huyuchen committed
2427 2428
		FROM t_payment_info a
		<where>
huyuchen's avatar
huyuchen committed
2429
			IFNULL(a.FUND_ID,'1') != '1'
huyuchen's avatar
huyuchen committed
2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445
			<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
2446
		CONCAT( a.EMP_IDCARD, '_', a.SOCIAL_PAY_MONTH, '_', a.SOCIAL_CREATE_MONTH) AS keyGroup
huyuchen's avatar
huyuchen committed
2447 2448
		FROM t_payment_info a
		<where>
huyuchen's avatar
huyuchen committed
2449
			IFNULL(a.SOCIAL_ID,'1') != '1'
huyuchen's avatar
huyuchen committed
2450 2451 2452
			<include refid="tPaymentInfo_export_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
2453 2454 2455 2456 2457 2458
		<!-- 导出查询条数接口 fxj 2024-08-06 -->
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.limitEnd != null and tPaymentInfo.limitEnd > 0">
				limit 0,#{tPaymentInfo.limitEnd}
			</if>
		</if>
huyuchen's avatar
huyuchen committed
2459 2460 2461
		)
		union all
		(SELECT
huyuchen's avatar
huyuchen committed
2462
		CONCAT( a.EMP_IDCARD, '_', a.PROVIDENT_PAY_MONTH, '_', a.PROVIDENT_CREATE_MONTH ) AS keyGroup
huyuchen's avatar
huyuchen committed
2463 2464
		FROM t_payment_info a
		<where>
huyuchen's avatar
huyuchen committed
2465
			IFNULL(a.FUND_ID,'1') != '1'
huyuchen's avatar
huyuchen committed
2466 2467 2468
			<include refid="tPaymentInfo_export_where"/>
		</where>
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
2469 2470 2471 2472 2473 2474
		<!-- 导出查询条数接口 fxj 2024-08-06 -->
		<if test="tPaymentInfo != null">
			<if test="tPaymentInfo.limitEnd != null and tPaymentInfo.limitEnd > 0">
				limit 0,#{tPaymentInfo.limitEnd}
			</if>
		</if>
huyuchen's avatar
huyuchen committed
2475 2476 2477 2478 2479
		)
		) w
		GROUP BY w.keyGroup) c
	</select>

huyuchen's avatar
huyuchen committed
2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509
	<!--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,
huyuchen's avatar
huyuchen committed
2510
		a.BPO_FLAG,
huyuchen's avatar
huyuchen committed
2511
		a.CREATE_NAME,
huyuchen's avatar
huyuchen committed
2512
		DATE_FORMAT(a.CREATE_TIME,'%Y-%m-%d') AS CREATE_NAME
huyuchen's avatar
huyuchen committed
2513 2514
		FROM t_payment_info a
		<where>
huyuchen's avatar
huyuchen committed
2515 2516
			IFNULL(a.SOCIAL_ID,'1') != '1' and a.PUSH_STATUS = '1' and a.LOCK_STATUS = '1'
			<include refid="tPaymentInfo_export_push_where"/>
huyuchen's avatar
huyuchen committed
2517
		</where>
huyuchen's avatar
huyuchen committed
2518
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SOCIAL_PAY_ADDR
huyuchen's avatar
huyuchen committed
2519 2520 2521 2522 2523
	</select>

	<!--tPaymentInfo合并查询-->
	<select id="getTPaymentInfoSumPushCount" resultType="java.lang.Integer">
		SELECT
huyuchen's avatar
huyuchen committed
2524 2525
		count(1) FROM(
		SELECT 1
huyuchen's avatar
huyuchen committed
2526 2527
		FROM t_payment_info a
		<where>
huyuchen's avatar
huyuchen committed
2528 2529
			IFNULL(a.SOCIAL_ID,'1') != '1' and a.PUSH_STATUS = '1' and a.LOCK_STATUS = '1'
			<include refid="tPaymentInfo_export_push_where"/>
huyuchen's avatar
huyuchen committed
2530
		</where>
huyuchen's avatar
huyuchen committed
2531
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH,a.SOCIAL_PAY_ADDR) c
huyuchen's avatar
huyuchen committed
2532 2533
	</select>

huyuchen's avatar
huyuchen committed
2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580
	<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>
huyuchen's avatar
huyuchen committed
2581 2582 2583 2584
	<update id="updateStatusById">
		update t_payment_info
		<trim prefix="SET" suffixOverrides=",">
			<if test="tPaymentInfo != null">
huyuchen's avatar
huyuchen committed
2585
				<if test="tPaymentInfo.incomeSettleFlag != null and tPaymentInfo.incomeSettleFlag.trim() != ''">
huyuchen's avatar
huyuchen committed
2586 2587
					INCOME_SETTLE_FLAG = #{tPaymentInfo.incomeSettleFlag},
				</if>
huyuchen's avatar
huyuchen committed
2588
				<if test="tPaymentInfo.incomeCollectFlag != null and tPaymentInfo.incomeCollectFlag.trim() != ''">
huyuchen's avatar
huyuchen committed
2589 2590 2591
					INCOME_COLLECT_FLAG = #{tPaymentInfo.incomeCollectFlag},
				</if>
				<if test="tPaymentInfo.paySettleFlag != null and tPaymentInfo.paySettleFlag.trim() != ''">
huyuchen's avatar
huyuchen committed
2592
					PAY_SETTLE_FLAG = #{tPaymentInfo.paySettleFlag},
huyuchen's avatar
huyuchen committed
2593 2594 2595 2596 2597 2598 2599 2600
				</if>
				<if test="tPaymentInfo.payCollectFlag != null and tPaymentInfo.payCollectFlag.trim() != ''">
					PAY_COLLECT_FLAG = #{tPaymentInfo.payCollectFlag},
				</if>
			</if>
		</trim>
		where ID = #{tPaymentInfo.id}
	</update>
huyuchen's avatar
huyuchen committed
2601

huyuchen's avatar
huyuchen committed
2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617
	<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>

huyuchen's avatar
huyuchen committed
2618 2619 2620 2621 2622 2623 2624 2625
	<!--tPaymentInfo 按ID查收缴费库包含社保和公积金明细的数据查询-->
	<select id="getAllInfoById" resultMap="tPaymentAllInfoMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_payment_info a
		where a.ID = #{id}
	</select>

huyuchen's avatar
huyuchen committed
2626 2627 2628
	<!--tPaymentInfo 按ID查收缴费库包含社保和公积金明细的数据查询-->
	<select id="getAllPushInfoById" resultMap="tPaymentInfoMap">
		SELECT
huyuchen's avatar
huyuchen committed
2629 2630 2631 2632 2633
			ID,
			INCOME_SETTLE_FLAG,
			INCOME_COLLECT_FLAG,
			PAY_COLLECT_FLAG,
			PAY_SETTLE_FLAG
huyuchen's avatar
huyuchen committed
2634 2635 2636 2637
		FROM t_payment_info a
		where a.ID in (${idStr})
	</select>

huyuchen's avatar
huyuchen committed
2638 2639 2640 2641 2642 2643
	<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">
huyuchen's avatar
huyuchen committed
2644
			AND a.SOCIAL_PAY_MONTH in
huyuchen's avatar
huyuchen committed
2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656
			<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>

huyuchen's avatar
huyuchen committed
2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675
	<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>

2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698
	<!--洪光武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,
hongguangwu's avatar
hongguangwu committed
2699 2700 2701 2702 2703
		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,
2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732
		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>
2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745

	<!-- 更改薪资社保结算状态 -->
	<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">
huyuchen's avatar
huyuchen committed
2746 2747
		update t_payment_info
		set SALARY_FUND_FLAG = #{status}
2748 2749 2750 2751 2752 2753 2754
		where
		ID in
		<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
			#{item}
		</foreach>
	</update>

huyuchen's avatar
huyuchen committed
2755 2756 2757 2758
	<!-- 更改薪资公积金结算状态 -->
	<update id="updatePaymentSocialAndFound">
		update t_payment_info
		set UNIT_ID = #{infoVo.unitId},
huyuchen's avatar
huyuchen committed
2759 2760 2761 2762
			UNIT_NAME = #{infoVo.unitName},
			SETTLE_DOMAIN_NAME = #{infoVo.settleDomainName},
			SETTLE_DOMAIN_CODE = #{infoVo.settleDomainCode},
			SETTLE_DOMAIN_ID = #{infoVo.settleDomainId}
huyuchen's avatar
huyuchen committed
2763
		where
huyuchen's avatar
huyuchen committed
2764
			((SALARY_SOCIAL_FLAG = '0' and SOCIAL_CREATE_MONTH >= #{infoVo.socialCreateMonth}) or
huyuchen's avatar
huyuchen committed
2765 2766
			 (SALARY_FUND_FLAG = '0' and PROVIDENT_CREATE_MONTH >= #{infoVo.socialCreateMonth}))
		  and PUSH_STATUS = '1' and EMP_IDCARD = #{infoVo.empIdcard}
huyuchen's avatar
huyuchen committed
2767 2768
	</update>

huyuchen's avatar
huyuchen committed
2769 2770 2771 2772 2773 2774 2775 2776
	<!-- 更改薪资公积金结算状态 -->
	<update id="updateByIncome">
		update t_payment_info
		set INCOME_STATUS = '0'
		where
			ID = #{id}
	</update>

huyuchen's avatar
huyuchen committed
2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787
	<!-- 更改社保推送结算状态 -->
	<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>

2788
	<!-- 校验缴费库是否有已结算的数据,有,则不允许ekp费用划转 -->
huyuchen's avatar
huyuchen committed
2789 2790
	<select id="checkPaymentChange" resultType="java.lang.String">
		select p.EMP_IDCARD from t_payment_info p
2791 2792 2793 2794 2795 2796 2797 2798 2799 2800
		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
huyuchen's avatar
huyuchen committed
2801 2802 2803 2804 2805
		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}
huyuchen's avatar
huyuchen committed
2806
		,p.SECOND_INDICATOR_BELONG = #{dept.secondIndicatorBelong}
2807 2808 2809 2810 2811 2812
		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>

huyuchen's avatar
huyuchen committed
2813 2814 2815
	<!--tPaymentInfo公积金推送查询-->
	<select id="getTPaymentFundPushInfo" resultMap="tPaymentInfoMap">
		SELECT
huyuchen's avatar
huyuchen committed
2816
		a.BPO_FLAG,
huyuchen's avatar
huyuchen committed
2817 2818 2819
		<include refid="Base_Column_List"/>
		FROM t_payment_info a
		<where>
huyuchen's avatar
huyuchen committed
2820
			a.PUSH_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId}
huyuchen's avatar
huyuchen committed
2821 2822
			<include refid="tPaymentInfo_export_where"/>
		</where>
huyuchen's avatar
huyuchen committed
2823 2824 2825 2826 2827 2828 2829 2830 2831 2832
	</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'
huyuchen's avatar
huyuchen committed
2833 2834 2835 2836 2837 2838 2839 2840
	</select>

	<!--tPaymentInfo社保收入推送查询-->
	<select id="getTPaymentSocialIncomeInfo" resultMap="tPaymentInfoMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_payment_info a
		<where>
huyuchen's avatar
huyuchen committed
2841
			a.INCOME_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId} AND a.IS_INCOME_STATUS = '0'
huyuchen's avatar
huyuchen committed
2842 2843
			<include refid="tPaymentInfo_export_where"/>
		</where>
huyuchen's avatar
huyuchen committed
2844
		limit 0,10000
huyuchen's avatar
huyuchen committed
2845 2846 2847 2848 2849 2850 2851 2852
	</select>

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

huyuchen's avatar
huyuchen committed
2859 2860 2861
	<!-- 更改社保公积金推送状态 -->
	<update id="updateBySocialPayment">
		update t_payment_info
huyuchen's avatar
huyuchen committed
2862
		set PUSH_STATUS = '0',UPDATE_TIME = NOW()
huyuchen's avatar
huyuchen committed
2863 2864 2865 2866
		where
			ID = #{id}
	</update>

huyuchen's avatar
huyuchen committed
2867 2868 2869
	<!-- 更改社保公积金推送状态 -->
	<update id="updateBySocialPaymentList">
		update t_payment_info
huyuchen's avatar
huyuchen committed
2870
		set PUSH_STATUS = '0',UPDATE_TIME = NOW()
huyuchen's avatar
huyuchen committed
2871 2872 2873 2874
		where
			ID in (${idStr})
	</update>

huyuchen's avatar
huyuchen committed
2875 2876 2877 2878 2879 2880 2881 2882
	<!-- 批量更改社保公积金推送状态 -->
	<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>

huyuchen's avatar
huyuchen committed
2883 2884 2885 2886 2887 2888 2889 2890
	<!-- 批量更改社保公积金推送状态 -->
	<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>

huyuchen's avatar
huyuchen committed
2891

huyuchen's avatar
huyuchen committed
2892 2893 2894
	<!-- 更改社保公积金推送状态 -->
	<update id="updateBySocialIncomePayment">
		update t_payment_info
huyuchen's avatar
huyuchen committed
2895
		set INCOME_STATUS = '0',UPDATE_TIME = NOW()
huyuchen's avatar
huyuchen committed
2896 2897 2898
		where
			ID = #{id}
	</update>
huyuchen's avatar
huyuchen committed
2899

huyuchen's avatar
huyuchen committed
2900 2901
	<update id="updateBySocialIncomeFlag">
		update t_payment_info
huyuchen's avatar
huyuchen committed
2902
		set IS_INCOME_STATUS = '1',UPDATE_TIME = NOW()
huyuchen's avatar
huyuchen committed
2903 2904 2905 2906
		where
			ID = #{id}
	</update>

2907
	<!--<select id="getTPaymentSocialPushCount" resultType="java.lang.Long">
huyuchen's avatar
huyuchen committed
2908 2909 2910 2911 2912 2913 2914
		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>
2915
	</select>-->
huyuchen's avatar
huyuchen committed
2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933

	<!--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>
huyuchen's avatar
huyuchen committed
2934
			a.INCOME_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId} AND a.IS_INCOME_STATUS = '0'
huyuchen's avatar
huyuchen committed
2935 2936 2937 2938 2939 2940 2941 2942 2943 2944
			<include refid="tPaymentInfo_export_where"/>
		</where>
	</select>

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

	<!--tPaymentInfo 缴费库包含明细的数据查询查询 核准表生成查询专用-->
	<select id="getPaymentAllInfoList" resultMap="tPaymentAllInfoMap">
		SELECT
huyuchen's avatar
huyuchen committed
2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027
		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
3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039
		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() != ''">
3040
					AND (
huyuchen's avatar
huyuchen committed
3041 3042
					a.SOCIAL_PAY_MONTH like CONCAT(#{tPaymentInfo.likeYear},'%')
					or a.PROVIDENT_PAY_MONTH like CONCAT(#{tPaymentInfo.likeYear},'%')
3043
					)
3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057
				</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() != ''">
fangxinjiang's avatar
fangxinjiang committed
3058
					AND a.EMP_IDCARD  = #{tPaymentInfo.empIdcard}
3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075
				</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() != ''">
3076
					AND (a.SOCIAL_PAY_MONTH = #{tPaymentInfo.socialPayMonth} or a.PROVIDENT_PAY_MONTH = #{tPaymentInfo.socialPayMonth})
3077 3078 3079 3080
				</if>
				<if test="tPaymentInfo.socialCreateMonth != null and tPaymentInfo.socialCreateMonth.trim() != ''">
					AND a.SOCIAL_CREATE_MONTH = #{tPaymentInfo.socialCreateMonth}
				</if>
3081 3082
				<if test="tPaymentInfo.createBy != null and tPaymentInfo.createBy.trim() != ''">
					AND a.CREATE_BY = #{tPaymentInfo.createBy}
3083 3084 3085 3086
				</if>
				<if test="tPaymentInfo.createTime != null">
					AND a.CREATE_TIME = #{tPaymentInfo.createTime}
				</if>
3087
				<!--<if test="tPaymentInfo.lastUpdateUser != null and tPaymentInfo.lastUpdateUser.trim() != ''">
3088 3089 3090 3091
					AND a.UPDATE_BY = #{tPaymentInfo.lastUpdateUser}
				</if>
				<if test="tPaymentInfo.lastUpdateTime != null">
					AND a.UPDATE_TIME = #{tPaymentInfo.lastUpdateTime}
3092
				</if>-->
3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170
				<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
huyuchen's avatar
huyuchen committed
3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190
		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"
3191 3192 3193 3194 3195 3196 3197 3198
		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() != ''">
3199
					AND (
huyuchen's avatar
huyuchen committed
3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233
					(
					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')
					)
3234 3235 3236 3237 3238 3239 3240 3241 3242 3243
					)
				</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
3244
			ifnull(a.SOCIAL_PAY_MONTH,a.PROVIDENT_PAY_MONTH) desc
3245 3246 3247 3248 3249 3250 3251 3252 3253
		</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
3254
		ifnull(a.SOCIAL_PAY_MONTH,a.PROVIDENT_PAY_MONTH) SOCIAL_PAY_MONTH,
3255 3256 3257 3258 3259 3260 3261 3262 3263 3264
		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() != ''">
3265 3266
					AND (a.SOCIAL_PAY_MONTH like CONCAT(#{socialAndFundBusinessPageVo.year},'%')
					or a.PROVIDENT_PAY_MONTH like CONCAT(#{socialAndFundBusinessPageVo.year},'%'))
3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325
				</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
huyuchen's avatar
huyuchen committed
3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368
		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"
3369 3370 3371 3372 3373 3374 3375 3376
		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() != ''">
3377
					AND (a.SOCIAL_PAY_MONTH = #{paymentBusinessPageVo.month} or a.PROVIDENT_PAY_MONTH = #{paymentBusinessPageVo.month})
3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557
				</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>
3558 3559 3560 3561 3562 3563 3564 3565
	<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>-->
fangxinjiang's avatar
fangxinjiang committed
3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578

			<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>

3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592

		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>-->
fangxinjiang's avatar
fangxinjiang committed
3593

3594 3595
		<choose>
			<when test="tPaymentInfo.providentHousehold != null and tPaymentInfo.providentHousehold.trim() != ''  and tPaymentInfo.socialHousehold == null">
fangxinjiang's avatar
fangxinjiang committed
3596
				COUNT(DISTINCT CONCAT(a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH)) as 'count'
3597 3598
			</when>
			<when test="tPaymentInfo.socialHousehold != null and tPaymentInfo.socialHousehold.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
3599
				COUNT(DISTINCT CONCAT(a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH)) as 'count'
3600 3601
			</when>
			<otherwise>
fangxinjiang's avatar
fangxinjiang committed
3602
				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'
3603 3604
			</otherwise>
		</choose>
fangxinjiang's avatar
fangxinjiang committed
3605

3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628
		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>
3629

3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642
	<!--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>
fangxinjiang's avatar
fangxinjiang committed
3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653
			<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
3654
			</if>
fangxinjiang's avatar
fangxinjiang committed
3655 3656 3657 3658 3659
			<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
3660 3661 3662
			</if>
		</where>
		GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
fangxinjiang's avatar
fangxinjiang committed
3663
		limit 1
3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677
	</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>
fangxinjiang's avatar
fangxinjiang committed
3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691
			<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}
3692
			</if>
fangxinjiang's avatar
fangxinjiang committed
3693 3694
			<if test="createMonth == null or createMonth ==''">
				AND a.PROVIDENT_CREATE_MONTH  is null
3695 3696 3697
			</if>
		</where>
		GROUP BY a.EMP_IDCARD,a.PROVIDENT_PAY_MONTH,a.PROVIDENT_CREATE_MONTH
fangxinjiang's avatar
fangxinjiang committed
3698
		limit 1
3699
	</select>
huyuchen's avatar
huyuchen committed
3700
</mapper>