TDispatchInfoMapper.xml 105 KB
Newer Older
fangxinjiang's avatar
fangxinjiang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<?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">

fangxinjiang's avatar
fangxinjiang committed
24
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TDispatchInfoMapper">
fangxinjiang's avatar
fangxinjiang committed
25

huyuchen's avatar
huyuchen committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
	<resultMap id="tDispatchInfoMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TDispatchInfo">
		<id property="id" column="ID"/>
		<result property="empId" column="EMP_ID"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="empType" column="EMP_TYPE"/>
		<result property="empMobile" column="EMP_MOBILE"/>
		<result property="empNational" column="EMP_NATIONAL"/>
		<result property="status" column="STATUS"/>
		<result property="type" column="TYPE"/>
		<result property="socialId" column="SOCIAL_ID"/>
		<result property="fundId" column="FUND_ID"/>
		<result property="typeSub" column="TYPE_SUB"/>
		<result property="processInstId" column="PROCESS_INST_ID"/>
		<result property="settleDomain" column="SETTLE_DOMAIN"/>
		<result property="deleteFlag" column="DELETE_FLAG"/>
		<result property="socialReduceDate" column="SOCIAL_REDUCE_DATE"/>
		<result property="fundReduceDate" column="FUND_REDUCE_DATE"/>
		<result property="leaveDate" column="LEAVE_DATE"/>
		<result property="reduceReason" column="REDUCE_REASON"/>
		<result property="reduceRemark" column="REDUCE_REMARK"/>
		<result property="belongUnit" column="BELONG_UNIT"/>
		<result property="currentOperator" column="CURRENT_OPERATOR"/>
		<result property="dispatchIdBak" column="DISPATCH_ID_BAK"/>
		<result property="contractStart" column="CONTRACT_START"/>
		<result property="contractEnd" column="CONTRACT_END"/>
		<result property="contractTerm" column="CONTRACT_TERM"/>
		<result property="empRegisType" column="EMP_REGIS_TYPE"/>
		<result property="fileAddr" column="FILE_ADDR"/>
		<result property="post" column="POST"/>
		<result property="trustRemark" column="TRUST_REMARK"/>
		<result property="fileProvince" column="FILE_PROVINCE"/>
		<result property="fileCity" column="FILE_CITY"/>
		<result property="fileTown" column="FILE_TOWN"/>
		<result property="contractType" column="CONTRACT_TYPE"/>
		<result property="socialHandleStatus" column="SOCIAL_HANDLE_STATUS"/>
		<result property="fundHandleStatus" column="FUND_HANDLE_STATUS"/>
		<result property="handleRemark" column="HANDLE_REMARK"/>
		<result property="auditRemark" column="AUDIT_REMARK"/>
		<result property="fundHandleRemark" column="FUND_HANDLE_REMARK"/>
		<result property="socialHandleRemark" column="SOCIAL_HANDLE_REMARK"/>
		<result property="socialProvince" column="SOCIAL_PROVINCE"/>
		<result property="socialCity" column="SOCIAL_CITY"/>
		<result property="socialTown" column="SOCIAL_TOWN"/>
		<result property="fundProvince" column="FUND_PROVINCE"/>
		<result property="fundCity" column="FUND_CITY"/>
		<result property="fundTown" column="FUND_TOWN"/>
		<result property="auditUser" column="AUDIT_USER"/>
		<result property="auditUserName" column="AUDIT_USER_NAME"/>
		<result property="auditTime" column="AUDIT_TIME"/>
		<result property="workingHours" column="WORKING_HOURS"/>
		<result property="createBy" column="CREATE_BY"/>
		<result property="updateBy" column="UPDATE_BY"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="updateTime" column="UPDATE_TIME"/>
		<result property="organName" column="ORGAN_NAME"/>
		<result property="dispatchItem" column="DISPATCH_ITEM"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
		<result property="belongUnitName" column="BELONG_UNIT_NAME"/>
		<result property="dispatchCode" column="DISPATCH_CODE"/>
		<result property="againDispatchCode" column="AGAIN_DISPATCH_CODE"/>
		<result property="contractSubName" column="CONTRACT_SUB_NAME"/>
		<result property="contractId" column="CONTRACT_ID"/>
		<result property="educationName" column="EDUCATION_NAME"/>

		<result property="tryPeriod" column="TRY_PERIOD"/>
		<result property="idCardProvince" column="ID_CARD_PROVINCE"/>
		<result property="idCardCity" column="ID_CARD_CITY"/>
		<result property="idCardTown" column="ID_CARD_TOWN"/>
		<result property="idCardAddress" column="ID_CARD_ADDRESS"/>
		<result property="applyNo" column="APPLY_NO"/>
		<result property="createTime" column="CREATE_TIME"/>
		<result property="orderId" column="ORDER_ID"/>

		<result property="schoolName" column="SCHOOL_NAME"/>
		<result property="major" column="MAJOR"/>
		<result property="firstPayTime" column="FIRST_PAY_TIME"/>
		<result property="graduationTime" column="GRADUATION_TIME"/>
		<result property="autoFlag" column="AUTO_FLAG"/>


	</resultMap>
fangxinjiang's avatar
fangxinjiang committed
110 111 112
	<resultMap id="dispatchPageMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoPageVo" extends="tDispatchInfoMap">
		<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
		<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
113 114
		<result property="exportFundFlag" column="EXPORT_FUND_FLAG"/>
		<result property="exportSocialFlag" column="EXPORT_SOCIAL_FLAG"/>
115 116 117
		<result property="ygsHandleStatus" column="YGS_HANDLE_STATUS"/>
		<result property="ysdHandleStatus" column="YSD_HANDLE_STATUS"/>

fangxinjiang's avatar
fangxinjiang committed
118
	</resultMap>
119 120 121 122 123 124 125 126 127 128 129
	<!-- 派单导出vo -->
	<resultMap id="exportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoExportVo">
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="empType" column="EMP_TYPE"/>
		<result property="belongUnitName" column="BELONG_UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="type" column="TYPE"/>
		<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
		<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
		<result property="socialHandleStatus" column="SOCIAL_HANDLE_STATUS"/>
130 131 132 133 134
		<result property="pensionHandle" column="PENSION_HANDLE"/>
		<result property="medicalHandle" column="MEDICAL_HANDLE"/>
		<result property="unemployHandle" column="UNEMPLOY_HANDLE"/>
		<result property="workInjuryHandle" column="WORK_INJURY_HANDLE"/>
		<result property="birthHandle" column="BIRTH_HANDLE"/>
huyuchen's avatar
huyuchen committed
135
		<result property="fundReduceDate" column="FUND_REDUCE_DATE"/>
136
		<result property="bigailmentHandle" column="BIGAILMENT_HANDLE"/>
137 138 139 140
		<result property="fundHandleStatus" column="FUND_HANDLE_STATUS"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="organName" column="ORGAN_NAME"/>
		<result property="createTime" column="CREATE_TIME"/>
huyuchen's avatar
huyuchen committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
		<result property="contractType" column="CONTRACT_TYPE"/>
		<result property="contractSubName" column="CONTRACT_SUB_NAME"/>
		<result property="contractTerm" column="CONTRACT_TERM"/>
		<result property="contractStart" column="CONTRACT_START"/>
		<result property="contractEnd" column="CONTRACT_END"/>
		<result property="auditUserName" column="AUDIT_USER_NAME"/>
		<result property="auditRemark" column="AUDIT_REMARK"/>
		<result property="trustRemark" column="TRUST_REMARK"/>
		<result property="leaveDate" column="LEAVE_DATE"/>
		<result property="reduceReason" column="REDUCE_REASON"/>
		<result property="status" column="STATUS"/>
		<result property="auditUser" column="AUDIT_USER"/>
		<result property="auditTime" column="AUDIT_TIME"/>
		<result property="fundHandleRemark" column="FUND_HANDLE_REMARK"/>
		<result property="socialHandleRemark" column="SOCIAL_HANDLE_REMARK"/>

		<result property="providentStart" column="PROVIDENT_START"/>
		<result property="fundAuditStatus" column="FUND_AUDIT_STATUS"/>
		<result property="fundAuditUser" column="FUND_AUDIT_USER"/>
		<result property="fundHandleUser" column="FUND_HANDLE_USER"/>
		<result property="fundHandleTime" column="FUND_HANDLE_TIME"/>

		<result property="auditStatus" column="AUDIT_STATUS"/>
		<result property="socialStartDate" column="SOCIAL_START_DATE"/>
		<result property="socialReduceDate" column="SOCIAL_REDUCE_DATE"/>
		<result property="recordBase" column="RECORD_BASE"/>
		<result property="handleUser" column="HANDLE_USER"/>
		<result property="handleTime" column="HANDLE_TIME"/>
		<result property="unitPensionCardinal" column="UNIT_PENSION_CARDINAL"/>
		<result property="unitMedicalCardinal" column="UNIT_MEDICAL_CARDINAL"/>
		<result property="unitUnemploymentCardinal" column="UNIT_UNEMPLOYMENT_CARDINAL"/>
		<result property="unitBigailmentCardinal" column="UNIT_BIGAILMENT_CARDINAL"/>
		<result property="unitWorkInjuryCardinal" column="UNIT_WORK_INJURY_CARDINAL"/>
		<result property="unitBirthCardinal" column="UNIT_BIRTH_CARDINAL"/>
175
		<result property="empMobile" column="EMP_MOBILE"/>
176

fangxinjiang's avatar
fangxinjiang committed
177
		<result property="educationName" column="EDUCATION_NAME"/>
178 179 180
		<result property="schoolName" column="SCHOOL_NAME"/>
		<result property="major" column="MAJOR"/>
		<result property="firstPayTime" column="FIRST_PAY_TIME"/>
181
		<result property="graduationTime" column="GRADUATION_TIME"/>
182 183

		<result property="autoFlag" column="AUTO_FLAG"/>
184 185 186

		<result property="unitProvidentPer" column="UNIT_PROVIDENT_PER"/>
		<result property="personalProvidentPer" column="PERSONAL_PROVIDENT_PER"/>
187 188
	</resultMap>

fangxinjiang's avatar
fangxinjiang committed
189 190 191 192 193 194 195 196 197 198
	<resultMap id="fundSupplementaryMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.FundSupplementaryExportVo">
		<result property="providentStart" column="PROVIDENT_START"/>
		<result property="unitProvidengCardinal" column="UNIT_PROVIDENG_CARDINAL"/>
		<result property="personalProvidentCardinal" column="PERSONAL_PROVIDENT_CARDINAL"/>
		<result property="unitProvidentPer" column="UNIT_PROVIDENT_PER"/>
		<result property="personalProvidentPer" column="PERSONAL_PROVIDENT_PER"/>
		<result property="unitProvidentFee" column="UNIT_PROVIDENT_FEE"/>
		<result property="personalProvidentFee" column="PERSONAL_PROVIDENT_FEE"/>
		<result property="empName" column="EMP_NAME"/>
	</resultMap>
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
	<resultMap id="FundExport" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchFundPersionExportVo">
		<result property="num" column="NUM"/>
		<result property="personalAccount" column="PERSON_ACCOUNT"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="depositBase" column="DEPOSIT_BASE"/>
		<result property="monthlyIncrease" column="MOTHLY_INCREASE"/>
		<result property="monthlyDecrease" column="MOTHLY_DECREASE"/>
		<result property="causeChange" column="CAUSE_CHANGE"/>
	</resultMap>

	<resultMap id="CompanyProVo" type="com.yifu.cloud.plus.v1.yifu.social.vo.CompanyProVo">
		<result property="companyPro" column="COMPANY_PRO"/>

	</resultMap>

	<resultMap id="HouseNameConfigVo" type="com.yifu.cloud.plus.v1.yifu.social.vo.HouseNameConfigVo">
		<result property="customerNo" column="CUSTOMER_NO"/>
		<result property="fundBank" column="FUND_BANK"/>
		<result property="companyPro" column="COMPANY_PRO"/>

	</resultMap>
	<resultMap id="FundSupplementaryExport" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchFundSupplementaryExportVo">
		<result property="num" column="NUM"/>
		<result property="personalAccount" column="PERSON_ACCOUNT"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="depositBase" column="DEPOSIT_BASE"/>
		<result property="supplementaryAmount" column="SUPPLEMENTART_AMOUNT"/>
		<result property="originate" column="ORIGINATE"/>
		<result property="end" column="END"/>
	</resultMap>

	<resultMap id="FundSupplementary" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchFundSumVo">
		<result property="supplementaryAmountSum" column="SUPPLEMENTART_AMOUNT_SUM"/>
234
		<result property="number" column="NUMBER"/>
235 236 237 238 239 240 241 242
	</resultMap>

	<resultMap id="FundSumExport" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchFundSumExportVo">
		<result property="numOne" column="NUM_ONE"/>
		<result property="numTwo" column="NUM_TWO"/>
		<result property="monenyOne" column="MONEY_ONE"/>
		<result property="monenyTwo" column="MONEY_TWO"/>
	</resultMap>
huyuchen's avatar
huyuchen committed
243 244 245 246 247 248 249 250 251 252 253 254 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
	<resultMap id="socialDisExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchSocialExportVo">
		<result property="num" column="NUM"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="idcardType" column="IDCARD_TYPE"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="medicalCardinal" column="MEDICAL_CARDINAL"/>
		<result property="empMobile" column="EMP_MOBILE"/>
		<result property="educationName" column="EDUCATION_NAME"/>
		<result property="disMonth" column="DIS_MONTH"/>
		<result property="changeTypeOne" column="CHANGE_TYPE_ONE"/>
		<result property="changeTypeTwo" column="CHANGE_TYPE_TWO"/>
		<result property="changeTypeThree" column="CHANGE_TYPE_THREE"/>
		<result property="changeTypeFour" column="CHANGE_TYPE_FOUR"/>
		<result property="remark" column="REMARK"/>
	</resultMap>

	<resultMap id="socialPersionDisExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchSocialPersionExportVo">
		<result property="num" column="num"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="sex" column="sex"/>
		<result property="empNational" column="EMP_NATIONAL"/>
		<result property="workDate" column="WORK_DATE"/>
		<result property="type" column="type"/>
		<result property="signleType" column="SIGNLE_TYPE"/>
		<result property="insuranceTypeOne" column="INSURANCE_TYPE_ONE"/>
		<result property="insuranceTypeTwo" column="INSURANCE_TYPE_TWO"/>
		<result property="insuranceTypeThree" column="INSURANCE_TYPE_THREE"/>
		<result property="insuranceTypeFour" column="INSURANCE_TYPE_FOUR"/>
		<result property="insuranceTypeFive" column="INSURANCE_TYPE_FIVE"/>
		<result property="persionCardinal" column="PERSION_CARDINAL"/>
		<result property="dateOne" column="DATE_ONE"/>
		<result property="contactAddress" column="CONTRACT_ADRESS"/>
		<result property="remark" column="REMARK"/>
	</resultMap>

huyuchen's avatar
huyuchen committed
280 281 282 283 284 285 286 287 288 289 290
	<resultMap id="socialPersionReduceDisExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchSocialPersionReduceExportVo">
		<result property="num" column="num"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="workDate" column="WORK_DATE"/>
		<result property="typeA" column="typeA"/>
		<result property="typeB" column="typeB"/>
		<result property="typeC" column="typeC"/>
		<result property="typeD" column="typeD"/>
		<result property="typeE" column="typeE"/>
huyuchen's avatar
huyuchen committed
291
		<result property="typeW" column="typeW"/>
huyuchen's avatar
huyuchen committed
292 293 294 295 296 297 298 299 300 301 302 303
		<result property="typeF" column="typeF"/>
		<result property="typeG" column="typeG"/>
		<result property="typeH" column="typeH"/>
		<result property="typeI" column="typeI"/>
		<result property="typeJ" column="typeJ"/>
		<result property="typeK" column="typeK"/>
		<result property="typeL" column="typeL"/>
		<result property="typeM" column="typeM"/>
		<result property="typeN" column="typeN"/>
		<result property="typeO" column="typeO"/>
		<result property="typeP" column="typeP"/>
		<result property="typeQ" column="typeQ"/>
huyuchen's avatar
huyuchen committed
304
		<result property="typeZ" column="typeZ"/>
huyuchen's avatar
huyuchen committed
305 306 307
		<result property="remark" column="REMARK"/>
	</resultMap>

huyuchen's avatar
huyuchen committed
308 309 310 311 312 313
	<!-- 派单审核导出vo -->
	<resultMap id="exportAuditMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchAuditExportVo">
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="belongUnitName" column="BELONG_UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
hongguangwu's avatar
hongguangwu committed
314 315 316
		<result property="empMobile" column="EMP_MOBILE"/>
		<result property="idCardAddress" column="ID_CARD_ADDRESS"/>

huyuchen's avatar
huyuchen committed
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
		<result property="type" column="TYPE"/>
		<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
		<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="createTime" column="CREATE_TIME"/>
		<result property="contractStart" column="CONTRACT_START"/>
		<result property="contractEnd" column="CONTRACT_END"/>
		<result property="trustRemark" column="TRUST_REMARK"/>
		<result property="contractName" column="CONTRACT_NAME"/>
		<result property="workingHours" column="WORKING_HOURS"/>
		<result property="socialReduceDate" column="SOCIAL_REDUCE_DATE"/>
		<result property="fundReduceDate" column="FUND_REDUCE_DATE"/>
		<result property="leaveDate" column="LEAVE_DATE"/>
		<result property="reduceReason" column="REDUCE_REASON"/>

		<result property="paymentType" column="PAYMENT_TYPE"/>
		<result property="recordBase" column="RECORD_BASE"/>
		<result property="unitPensionCardinal" column="UNIT_PENSION_CARDINAL"/>
		<result property="unitMedicalCardinal" column="UNIT_MEDICAL_CARDINAL"/>
		<result property="unitUnemploymentCardinal" column="UNIT_UNEMPLOYMENT_CARDINAL"/>
		<result property="unitWorkInjuryCardinal" column="UNIT_WORK_INJURY_CARDINAL"/>
		<result property="unitBirthCardinal" column="UNIT_BIRTH_CARDINAL"/>
		<result property="personalPensionCardinal" column="PERSONAL_PENSION_CARDINAL"/>
		<result property="personalMedicalCardinal" column="PERSONAL_MEDICAL_CARDINAL"/>
		<result property="personalUnemploymentCardinal" column="PERSONAL_UNEMPLOYMENT_CARDINAL"/>
		<result property="personalBigailmentMoney" column="PERSONAL_BIGAILMENT_MONEY"/>
		<result property="unitBigailmentMoney" column="UNIT_BIGAILMENT_MONEY"/>
huyuchen's avatar
huyuchen committed
344
		<result property="socialStartDate" column="SOCIAL_START_DATE"/>
huyuchen's avatar
huyuchen committed
345

huyuchen's avatar
huyuchen committed
346
		<result property="providentStart" column="PROVIDENT_START"/>
huyuchen's avatar
huyuchen committed
347 348 349 350
		<result property="unitProvidengCardinal" column="UNIT_PROVIDENG_CARDINAL"/>
		<result property="personalProvidentCardinal" column="PERSONAL_PROVIDENT_CARDINAL"/>
		<result property="unitProvidentPer" column="UNIT_PROVIDENT_PER"/>
		<result property="personalProvidentPer" column="PERSONAL_PROVIDENT_PER"/>
351

fangxinjiang's avatar
fangxinjiang committed
352
		<result property="educationName" column="EDUCATION_NAME"/>
353 354 355
		<result property="schoolName" column="SCHOOL_NAME"/>
		<result property="major" column="MAJOR"/>
		<result property="firstPayTime" column="FIRST_PAY_TIME"/>
356
		<result property="graduationTime" column="GRADUATION_TIME"/>
huyuchen's avatar
huyuchen committed
357 358
	</resultMap>

huyuchen's avatar
huyuchen committed
359
	<sql id="Base_Column_List">
fangxinjiang's avatar
fangxinjiang committed
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
		a.ID,
		a.EMP_ID,
		a.EMP_NAME,
		a.EMP_NO,
		a.EMP_IDCARD,
		a.EMP_TYPE,
		a.EMP_MOBILE,
		a.EMP_NATIONAL,
		a.STATUS,
		a.TYPE,
		a.SOCIAL_ID,
		a.FUND_ID,
		a.TYPE_SUB,
		a.PROCESS_INST_ID,
		a.SETTLE_DOMAIN,
		a.DELETE_FLAG,
		a.SOCIAL_REDUCE_DATE,
		a.FUND_REDUCE_DATE,
		a.LEAVE_DATE,
		a.REDUCE_REASON,
		a.REDUCE_REMARK,
		a.BELONG_UNIT,
		a.CURRENT_OPERATOR,
		a.DISPATCH_ID_BAK,
		a.CONTRACT_START,
		a.CONTRACT_END,
		a.CONTRACT_TERM,
		a.EMP_REGIS_TYPE,
		a.ENJOIN_DATE,
		a.FILE_ADDR,
		a.POST,
		a.TRUST_REMARK,
		a.FILE_PROVINCE,
		a.FILE_CITY,
		a.FILE_TOWN,
		a.CONTRACT_TYPE,
		a.SOCIAL_HANDLE_STATUS,
		a.FUND_HANDLE_STATUS,
		a.HANDLE_REMARK,
		a.AUDIT_REMARK,
		a.FUND_HANDLE_REMARK,
		a.SOCIAL_HANDLE_REMARK,
		a.SOCIAL_PROVINCE,
		a.SOCIAL_CITY,
		a.SOCIAL_TOWN,
		a.FUND_PROVINCE,
		a.FUND_CITY,
		a.FUND_TOWN,
		a.AUDIT_USER,
fangxinjiang's avatar
fangxinjiang committed
409
		a.AUDIT_USER_NAME,
fangxinjiang's avatar
fangxinjiang committed
410 411 412 413 414
		a.AUDIT_TIME,
		a.WORKING_HOURS,
		a.CREATE_BY,
		a.UPDATE_BY,
		a.CREATE_NAME,
hongguangwu's avatar
hongguangwu committed
415
		a.CREATE_TIME,
fangxinjiang's avatar
fangxinjiang committed
416 417 418 419 420 421
		a.UPDATE_TIME,
		a.ORGAN_NAME,
		a.DISPATCH_ITEM,
		a.SETTLE_DOMAIN_NAME,
		a.BELONG_UNIT_NAME,
		a.DISPATCH_CODE,
huyuchen's avatar
huyuchen committed
422
		a.AGAIN_DISPATCH_CODE,
fangxinjiang's avatar
fangxinjiang committed
423
		a.SETTLE_DOMAIN_CODE,
424
		a.CONTRACT_SUB_NAME,
fangxinjiang's avatar
fangxinjiang committed
425 426 427 428 429 430
		a.CONTRACT_ID,
		a.EDUCATION_NAME,
		a.TRY_PERIOD,
		a.ID_CARD_PROVINCE,
		a.ID_CARD_CITY,
		a.ID_CARD_TOWN,
fangxinjiang's avatar
fangxinjiang committed
431
		a.ID_CARD_ADDRESS,
432
		a.APPLY_NO,
433 434 435
		a.ORDER_ID,
		a.SCHOOL_NAME,
		a.MAJOR,
436
		a.FIRST_PAY_TIME,
437
		a.GRADUATION_TIME,a.AUTO_FLAG
huyuchen's avatar
huyuchen committed
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
	</sql>
	<sql id="tDispatchInfo_where">
		<if test="tDispatchInfo != null">
			<if test="tDispatchInfo.dispatchItems != null and tDispatchInfo.dispatchItems.size >0">
				AND
				<foreach item="item" index="index" collection="tDispatchInfo.dispatchItems" open="(" separator="or" close=")">
					INSTR(a.DISPATCH_ITEM,#{item})
				</foreach>
			</if>
			<if test="tDispatchInfo.idList != null and tDispatchInfo.idList.size >0">
				AND a.ID in
				<foreach item="idStr" index="index" collection="tDispatchInfo.idList" open="(" separator="," close=")">
					#{idStr}
				</foreach>
			</if>
			<if test="tDispatchInfo.empTypeList != null and tDispatchInfo.empTypeList.length>0">
				AND a.EMP_TYPE IN
				<foreach collection="tDispatchInfo.empTypeList" item="item" index="index" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			<if test="tDispatchInfo.autoFlag != null and tDispatchInfo.autoFlag.trim() != ''">
				AND a.AUTO_FLAG = #{tDispatchInfo.autoFlag}
			</if>
			<if test="tDispatchInfo.id != null and tDispatchInfo.id.trim() != ''">
				AND a.ID = #{tDispatchInfo.id}
			</if>
			<if test="tDispatchInfo.orderId != null and tDispatchInfo.orderId.trim() != ''">
				AND a.ORDER_ID = #{tDispatchInfo.orderId}
			</if>
			<if test="tDispatchInfo.empId != null and tDispatchInfo.empId.trim() != ''">
				AND a.EMP_ID = #{tDispatchInfo.empId}
			</if>
			<if test="tDispatchInfo.empName != null and tDispatchInfo.empName.trim() != ''">
				AND a.EMP_NAME like concat('%',#{tDispatchInfo.empName},'%')
			</if>
			<if test="tDispatchInfo.empNo != null and tDispatchInfo.empNo.trim() != ''">
				AND a.EMP_NO = #{tDispatchInfo.empNo}
			</if>
			<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
				AND a.EMP_IDCARD like concat('%',#{tDispatchInfo.empIdcard},'%')
			</if>
			<if test="tDispatchInfo.empType != null and tDispatchInfo.empType.trim() != ''">
				AND a.EMP_TYPE in #{tDispatchInfo.empType}
			</if>
			<if test="tDispatchInfo.empMobile != null and tDispatchInfo.empMobile.trim() != ''">
				AND a.EMP_MOBILE = #{tDispatchInfo.empMobile}
			</if>
			<if test="tDispatchInfo.empNational != null and tDispatchInfo.empNational.trim() != ''">
				AND a.EMP_NATIONAL = #{tDispatchInfo.empNational}
			</if>
			<if test="tDispatchInfo.status != null and tDispatchInfo.status.trim() != ''">
				AND a.STATUS = #{tDispatchInfo.status}
			</if>
			<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
				AND a.TYPE = #{tDispatchInfo.type}
			</if>
			<if test="tDispatchInfo.socialId != null and tDispatchInfo.socialId.trim() != ''">
				AND a.SOCIAL_ID = #{tDispatchInfo.socialId}
			</if>
			<if test="tDispatchInfo.fundId != null and tDispatchInfo.fundId.trim() != ''">
				AND a.FUND_ID = #{tDispatchInfo.fundId}
			</if>
			<if test="tDispatchInfo.typeSub != null and tDispatchInfo.typeSub.trim() != ''">
				AND a.TYPE_SUB = #{tDispatchInfo.typeSub}
			</if>
			<if test="tDispatchInfo.processInstId != null and tDispatchInfo.processInstId.trim() != ''">
				AND a.PROCESS_INST_ID = #{tDispatchInfo.processInstId}
			</if>
			<if test="tDispatchInfo.settleDomain != null and tDispatchInfo.settleDomain.trim() != ''">
				AND a.SETTLE_DOMAIN = #{tDispatchInfo.settleDomain}
			</if>
			<if test="tDispatchInfo.settleDomainName != null and tDispatchInfo.settleDomainName.trim() != ''">
				AND a.SETTLE_DOMAIN_NAME like CONCAT(#{tDispatchInfo.settleDomainName}, '%')
			</if>
			<if test="tDispatchInfo.settleDomainCode != null and tDispatchInfo.settleDomainCode.trim() != ''">
				AND a.SETTLE_DOMAIN_CODE = #{tDispatchInfo.settleDomainCode}
			</if>
fangxinjiang's avatar
fangxinjiang committed
516

huyuchen's avatar
huyuchen committed
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 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
			<if test="tDispatchInfo.deleteFlag != null and tDispatchInfo.deleteFlag.trim() != ''">
				AND a.DELETE_FLAG = #{tDispatchInfo.deleteFlag}
			</if>
			<if test="tDispatchInfo.socialReduceDate != null">
				AND a.SOCIAL_REDUCE_DATE = #{tDispatchInfo.socialReduceDate}
			</if>
			<if test="tDispatchInfo.fundReduceDate != null">
				AND a.FUND_REDUCE_DATE = #{tDispatchInfo.fundReduceDate}
			</if>
			<if test="tDispatchInfo.leaveDate != null">
				AND a.LEAVE_DATE = #{tDispatchInfo.leaveDate}
			</if>
			<if test="tDispatchInfo.reduceReason != null and tDispatchInfo.reduceReason.trim() != ''">
				AND a.REDUCE_REASON = #{tDispatchInfo.reduceReason}
			</if>
			<if test="tDispatchInfo.reduceRemark != null and tDispatchInfo.reduceRemark.trim() != ''">
				AND a.REDUCE_REMARK = #{tDispatchInfo.reduceRemark}
			</if>
			<if test="tDispatchInfo.belongUnit != null and tDispatchInfo.belongUnit.trim() != ''">
				AND a.BELONG_UNIT = #{tDispatchInfo.belongUnit}
			</if>
			<if test="tDispatchInfo.currentOperator != null and tDispatchInfo.currentOperator.trim() != ''">
				AND a.CURRENT_OPERATOR = #{tDispatchInfo.currentOperator}
			</if>
			<if test="tDispatchInfo.dispatchIdBak != null and tDispatchInfo.dispatchIdBak.trim() != ''">
				AND a.DISPATCH_ID_BAK = #{tDispatchInfo.dispatchIdBak}
			</if>
			<if test="tDispatchInfo.contractStart != null">
				AND a.CONTRACT_START = #{tDispatchInfo.contractStart}
			</if>
			<if test="tDispatchInfo.contractEnd != null">
				AND a.CONTRACT_END = #{tDispatchInfo.contractEnd}
			</if>
			<if test="tDispatchInfo.contractTerm != null">
				AND a.CONTRACT_TERM = #{tDispatchInfo.contractTerm}
			</if>
			<if test="tDispatchInfo.empRegisType != null and tDispatchInfo.empRegisType.trim() != ''">
				AND a.EMP_REGIS_TYPE = #{tDispatchInfo.empRegisType}
			</if>
			<if test="tDispatchInfo.fileAddr != null and tDispatchInfo.fileAddr.trim() != ''">
				AND a.FILE_ADDR = #{tDispatchInfo.fileAddr}
			</if>
			<if test="tDispatchInfo.post != null and tDispatchInfo.post.trim() != ''">
				AND a.POST = #{tDispatchInfo.post}
			</if>
			<if test="tDispatchInfo.trustRemark != null and tDispatchInfo.trustRemark.trim() != ''">
				AND a.TRUST_REMARK = #{tDispatchInfo.trustRemark}
			</if>
			<if test="tDispatchInfo.fileProvince != null">
				AND a.FILE_PROVINCE = #{tDispatchInfo.fileProvince}
			</if>
			<if test="tDispatchInfo.fileCity != null">
				AND a.FILE_CITY = #{tDispatchInfo.fileCity}
			</if>
			<if test="tDispatchInfo.fileTown != null">
				AND a.FILE_TOWN = #{tDispatchInfo.fileTown}
			</if>
			<if test="tDispatchInfo.contractType != null and tDispatchInfo.contractType.trim() != ''">
				AND a.CONTRACT_TYPE = #{tDispatchInfo.contractType}
			</if>
			<if test="tDispatchInfo.socialHandleStatus != null and tDispatchInfo.socialHandleStatus.trim() != ''">
				AND a.SOCIAL_HANDLE_STATUS = #{tDispatchInfo.socialHandleStatus}
			</if>
			<if test="tDispatchInfo.fundHandleStatus != null and tDispatchInfo.fundHandleStatus.trim() != ''">
				AND a.FUND_HANDLE_STATUS = #{tDispatchInfo.fundHandleStatus}
			</if>
			<if test="tDispatchInfo.handleRemark != null and tDispatchInfo.handleRemark.trim() != ''">
				AND a.HANDLE_REMARK = #{tDispatchInfo.handleRemark}
			</if>
			<if test="tDispatchInfo.auditRemark != null and tDispatchInfo.auditRemark.trim() != ''">
				AND a.AUDIT_REMARK = #{tDispatchInfo.auditRemark}
			</if>
			<if test="tDispatchInfo.fundHandleRemark != null and tDispatchInfo.fundHandleRemark.trim() != ''">
				AND a.FUND_HANDLE_REMARK = #{tDispatchInfo.fundHandleRemark}
			</if>
			<if test="tDispatchInfo.socialHandleRemark != null and tDispatchInfo.socialHandleRemark.trim() != ''">
				AND a.SOCIAL_HANDLE_REMARK = #{tDispatchInfo.socialHandleRemark}
			</if>
			<if test="tDispatchInfo.socialProvince != null and tDispatchInfo.socialProvince.trim() != ''">
				AND a.SOCIAL_PROVINCE = #{tDispatchInfo.socialProvince}
			</if>
			<if test="tDispatchInfo.socialCity != null and tDispatchInfo.socialCity.trim() != ''">
				AND a.SOCIAL_CITY = #{tDispatchInfo.socialCity}
			</if>
			<if test="tDispatchInfo.socialTown != null and tDispatchInfo.socialTown.trim() != ''">
				AND a.SOCIAL_TOWN = #{tDispatchInfo.socialTown}
			</if>
			<if test="tDispatchInfo.fundProvince != null and tDispatchInfo.fundProvince.trim() != ''">
				AND a.FUND_PROVINCE = #{tDispatchInfo.fundProvince}
			</if>
			<if test="tDispatchInfo.fundCity != null and tDispatchInfo.fundCity.trim() != ''">
				AND a.FUND_CITY = #{tDispatchInfo.fundCity}
			</if>
			<if test="tDispatchInfo.fundTown != null and tDispatchInfo.fundTown.trim() != ''">
				AND a.FUND_TOWN = #{tDispatchInfo.fundTown}
			</if>
			<if test="tDispatchInfo.auditUser != null and tDispatchInfo.auditUser.trim() != ''">
				AND a.AUDIT_USER = #{tDispatchInfo.auditUser}
			</if>
			<if test="tDispatchInfo.auditUserName != null and tDispatchInfo.auditUserName.trim() != ''">
				AND a.AUDIT_USER_NAME like concat('%',#{tDispatchInfo.auditUserName},'%')
			</if>
			<if test="tDispatchInfo.auditTime != null">
				AND a.AUDIT_TIME = #{tDispatchInfo.auditTime}
			</if>
			<if test="tDispatchInfo.auditTimeStart != null">
				AND a.AUDIT_TIME <![CDATA[>=]]> #{tDispatchInfo.auditTimeStart}
			</if>
			<if test="tDispatchInfo.auditTimeEnd != null">
				AND a.AUDIT_TIME <![CDATA[<=]]> #{tDispatchInfo.auditTimeEnd}
			</if>
fangxinjiang's avatar
fangxinjiang committed
628

huyuchen's avatar
huyuchen committed
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
			<if test="tDispatchInfo.workingHours != null and tDispatchInfo.workingHours.trim() != ''">
				AND a.WORKING_HOURS = #{tDispatchInfo.workingHours}
			</if>
			<if test="tDispatchInfo.updateBy != null and tDispatchInfo.updateBy.trim() != ''">
				AND a.UPDATE_BY = #{tDispatchInfo.updateBy}
			</if>
			<if test="tDispatchInfo.createName != null and tDispatchInfo.createName.trim() != ''">
				AND a.CREATE_NAME = #{tDispatchInfo.createName}
			</if>
			<if test="tDispatchInfo.updateTime != null">
				AND a.UPDATE_TIME = #{tDispatchInfo.updateTime}
			</if>
			<if test="tDispatchInfo.organName != null and tDispatchInfo.organName.trim() != ''">
				AND a.ORGAN_NAME = #{tDispatchInfo.organName}
			</if>
			<if test="tDispatchInfo.dispatchItem != null and tDispatchInfo.dispatchItem.trim() != ''">
				AND a.DISPATCH_ITEM = #{tDispatchInfo.dispatchItem}
			</if>
			<if test="tDispatchInfo.belongUnitName != null and tDispatchInfo.belongUnitName.trim() != ''">
				AND a.BELONG_UNIT_NAME = #{tDispatchInfo.belongUnitName}
			</if>

			<if test="tDispatchInfo.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
				AND a.SOCIAL_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.socialHouseholdName}), '%')
			</if>
			<if test="tDispatchInfo.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
				AND a.PROVIDENT_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.providentHouseholdName}), '%')
			</if>
			<if test="tDispatchInfo.createTimeStart != null">
				AND a.CREATE_TIME <![CDATA[ >= ]]> #{tDispatchInfo.createTimeStart}
			</if>
			<if test="tDispatchInfo.createTimeEnd != null">
				AND a.CREATE_TIME <![CDATA[ <= ]]> #{tDispatchInfo.createTimeEnd}
			</if>
			<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
				${tDispatchInfo.authSql}
			</if>
			<if test="tDispatchInfo.noCreateUser != null and tDispatchInfo.noCreateUser.trim() != ''">
				AND a.CREATE_BY != #{tDispatchInfo.noCreateUser}
			</if>
fangxinjiang's avatar
fangxinjiang committed
669
		</if>
huyuchen's avatar
huyuchen committed
670
	</sql>
huyuchen's avatar
huyuchen committed
671 672 673

	<sql id="tDispatchInfoAudit_where">
		<if test="tDispatchInfo != null">
674 675 676 677 678 679
			<if test="tDispatchInfo.dispatchItems != null and tDispatchInfo.dispatchItems.size >0">
				AND
				<foreach item="item" index="index" collection="tDispatchInfo.dispatchItems" open="(" separator="or" close=")">
					INSTR(a.DISPATCH_ITEM,#{item})
				</foreach>
			</if>
680 681 682 683 684 685 686
			<if test="tDispatchInfo.empTypeList != null and tDispatchInfo.empTypeList.length>0">
				AND a.EMP_TYPE IN
				<foreach collection="tDispatchInfo.empTypeList" item="item" index="index" open="(" separator="," close=")">
					#{item}
				</foreach>

			</if>
huyuchen's avatar
huyuchen committed
687 688 689 690 691 692
			<if test="tDispatchInfo.idList != null and tDispatchInfo.idList.size >0">
				AND a.ID in
				<foreach item="idStr" index="index" collection="tDispatchInfo.idList" open="(" separator="," close=")">
					#{idStr}
				</foreach>
			</if>
fangxinjiang's avatar
fangxinjiang committed
693 694 695
			<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
				AND a.TYPE = #{tDispatchInfo.type}
			</if>
huyuchen's avatar
huyuchen committed
696
			<if test="tDispatchInfo.empName != null and tDispatchInfo.empName.trim() != ''">
697
				AND a.EMP_NAME like concat('%',#{tDispatchInfo.empName},'%')
huyuchen's avatar
huyuchen committed
698 699
			</if>
			<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
700
				AND a.EMP_IDCARD like concat('%',#{tDispatchInfo.empIdcard},'%')
huyuchen's avatar
huyuchen committed
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729
			</if>
			<if test="tDispatchInfo.settleDomainName != null and tDispatchInfo.settleDomainName.trim() != ''">
				AND a.SETTLE_DOMAIN_NAME like CONCAT(#{tDispatchInfo.settleDomainName}, '%')
			</if>
			<if test="tDispatchInfo.settleDomainCode != null and tDispatchInfo.settleDomainCode.trim() != ''">
				AND a.SETTLE_DOMAIN_CODE = #{tDispatchInfo.settleDomainCode}
			</if>
			<if test="tDispatchInfo.socialProvince != null and tDispatchInfo.socialProvince.trim() != ''">
				AND a.SOCIAL_PROVINCE = #{tDispatchInfo.socialProvince}
			</if>
			<if test="tDispatchInfo.socialCity != null and tDispatchInfo.socialCity.trim() != ''">
				AND a.SOCIAL_CITY = #{tDispatchInfo.socialCity}
			</if>
			<if test="tDispatchInfo.socialTown != null and tDispatchInfo.socialTown.trim() != ''">
				AND a.SOCIAL_TOWN = #{tDispatchInfo.socialTown}
			</if>
			<if test="tDispatchInfo.fundProvince != null and tDispatchInfo.fundProvince.trim() != ''">
				AND a.FUND_PROVINCE = #{tDispatchInfo.fundProvince}
			</if>
			<if test="tDispatchInfo.fundCity != null and tDispatchInfo.fundCity.trim() != ''">
				AND a.FUND_CITY = #{tDispatchInfo.fundCity}
			</if>
			<if test="tDispatchInfo.fundTown != null and tDispatchInfo.fundTown.trim() != ''">
				AND a.FUND_TOWN = #{tDispatchInfo.fundTown}
			</if>
			<if test="tDispatchInfo.createName != null and tDispatchInfo.createName.trim() != ''">
				AND a.CREATE_NAME = #{tDispatchInfo.createName}
			</if>
			<if test="tDispatchInfo.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
huyuchen's avatar
huyuchen committed
730
				AND a.SOCIAL_HOUSEHOLD_NAME like CONCAT(#{tDispatchInfo.socialHouseholdName}, '%')
huyuchen's avatar
huyuchen committed
731 732
			</if>
			<if test="tDispatchInfo.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
huyuchen's avatar
huyuchen committed
733
				AND a.PROVIDENT_HOUSEHOLD_NAME like CONCAT(#{tDispatchInfo.providentHouseholdName}, '%')
huyuchen's avatar
huyuchen committed
734 735 736 737 738 739 740 741 742 743
			</if>
			<if test="tDispatchInfo.createTimeStart != null">
				AND a.CREATE_TIME <![CDATA[ >= ]]> #{tDispatchInfo.createTimeStart}
			</if>
			<if test="tDispatchInfo.createTimeEnd != null">
				AND a.CREATE_TIME <![CDATA[ <= ]]> #{tDispatchInfo.createTimeEnd}
			</if>
			<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
				${tDispatchInfo.authSql}
			</if>
744 745 746
			<if test="tDispatchInfo.noCreateUser != null and tDispatchInfo.noCreateUser.trim() != ''">
				AND a.CREATE_BY != #{tDispatchInfo.noCreateUser}
			</if>
huyuchen's avatar
huyuchen committed
747 748 749
		</if>
	</sql>

huyuchen's avatar
huyuchen committed
750 751 752 753 754 755 756 757
	<!--tDispatchInfo简单分页查询-->
	<select id="getTDispatchInfoPage" resultMap="dispatchPageMap">
		SELECT
		<include refid="Base_Column_List"/>,
		a.SOCIAL_HOUSEHOLD_NAME,
		a.PROVIDENT_HOUSEHOLD_NAME
		FROM t_dispatch_info a
		<where>
fangxinjiang's avatar
fangxinjiang committed
758 759 760
			1=1
			<include refid="tDispatchInfo_where"/>
		</where>
fangxinjiang's avatar
fangxinjiang committed
761
		order by a.APPLY_NO desc
huyuchen's avatar
huyuchen committed
762
	</select>
763

huyuchen's avatar
huyuchen committed
764 765 766 767 768 769 770 771 772 773 774 775
	<!--tDispatchInfo简单分页查询-->
	<select id="getTDispatchInfoPageAudit" resultMap="dispatchPageMap">
		SELECT
		<include refid="Base_Column_List"/>,
		a.SOCIAL_HOUSEHOLD_NAME,
		a.PROVIDENT_HOUSEHOLD_NAME
		FROM t_dispatch_info a
		<where>
			1=1
			<include refid="tDispatchInfo_where"/>
		</where>

fangxinjiang's avatar
fangxinjiang committed
776
		order by a.APPLY_NO desc
huyuchen's avatar
huyuchen committed
777 778
	</select>

779
	<!-- 派单导出 -->
huyuchen's avatar
huyuchen committed
780
	<select id="exportDispatch" resultMap="exportMap">
781
		select
782 783 784 785 786 787 788 789 790
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.EMP_TYPE,
		a.BELONG_UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		case when a.TYPE = 0 then "派增"
		when a.TYPE = 1 then "派减"
		else null  end  as  "TYPE" ,
		a.SOCIAL_HOUSEHOLD_NAME,
huyuchen's avatar
huyuchen committed
791 792 793 794
		case when a.SOCIAL_HANDLE_STATUS = 0 then "待办理"
		when a.SOCIAL_HANDLE_STATUS = 1 then "办理成功"
		when a.SOCIAL_HANDLE_STATUS = 2 then "办理失败"
		when a.SOCIAL_HANDLE_STATUS = 3 then "部分办理失败"
huyuchen's avatar
huyuchen committed
795
		when a.SOCIAL_HANDLE_STATUS = 4 then "办理中"
796 797
		else null  end as "SOCIAL_HANDLE_STATUS",
		IF(a.TYPE='0',
798 799 800
		case when s.PENSION_HANDLE = 0 then "派增待办理"
		when s.PENSION_HANDLE = 1 then "派增办理成功"
		when s.PENSION_HANDLE = 2 then "派增办理失败"
801
		when s.PENSION_HANDLE = 3 then "已派减"
802
		when s.PENSION_HANDLE = 4 then "派减失败"
803
		when s.PENSION_HANDLE = 5 then "派减待办理"
804
		else null  end,
805
		IF(a.TYPE='1',
huyuchen's avatar
huyuchen committed
806 807 808 809 810 811
		case when if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = 0 then "派增待办理"
		when if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = 1 then "派增办理成功"
		when if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = 2 then "派增办理失败"
		when if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = 3 then "已派减"
		when if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = 4 then "派减失败"
		when if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = 5 then "派减待办理"
812
		else null  end,""
813 814 815
		))
		as PENSION_HANDLE,
		IF(a.TYPE='0',
816 817 818
		case when s.MEDICAL_HANDLE = 0 then "派增待办理"
		when s.MEDICAL_HANDLE = 1 then "派增办理成功"
		when s.MEDICAL_HANDLE = 2 then "派增办理失败"
819
		when s.MEDICAL_HANDLE = 3 then "已派减"
820
		when s.MEDICAL_HANDLE = 4 then "派减失败"
821
		when s.MEDICAL_HANDLE = 5 then "派减待办理"
822
		else null  end,
823
		IF(a.TYPE='1',
huyuchen's avatar
huyuchen committed
824 825 826 827 828 829
		case when if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = 0 then "派增待办理"
		when if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = 1 then "派增办理成功"
		when if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = 2 then "派增办理失败"
		when if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = 3 then "已派减"
		when if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = 4 then "派减失败"
		when if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = 5 then "派减待办理"
830
		else null  end,""
831 832 833
		))
		as MEDICAL_HANDLE,
		IF(a.TYPE='0',
834 835 836
		case when s.UNEMPLOY_HANDLE = 0 then "派增待办理"
		when s.UNEMPLOY_HANDLE = 1 then "派增办理成功"
		when s.UNEMPLOY_HANDLE = 2 then "派增办理失败"
837
		when s.UNEMPLOY_HANDLE = 3 then "已派减"
838
		when s.UNEMPLOY_HANDLE = 4 then "派减失败"
839
		when s.UNEMPLOY_HANDLE = 5 then "派减待办理"
840
		else null  end,
841
		IF(a.TYPE='1',
huyuchen's avatar
huyuchen committed
842 843 844 845 846 847
		case when if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = 0 then "派增待办理"
		when if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = 1 then "派增办理成功"
		when if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = 2 then "派增办理失败"
		when if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = 3 then "已派减"
		when if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = 4 then "派减失败"
		when if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = 5 then "派减待办理"
848
		else null  end,""
849 850 851
		))
		as UNEMPLOY_HANDLE,
		IF(a.TYPE='0',
852 853 854
		case when s.WORK_INJURY_HANDLE = 0 then "派增待办理"
		when s.WORK_INJURY_HANDLE = 1 then "派增办理成功"
		when s.WORK_INJURY_HANDLE = 2 then "派增办理失败"
855
		when s.WORK_INJURY_HANDLE = 3 then "已派减"
856
		when s.WORK_INJURY_HANDLE = 4 then "派减失败"
857
		when s.WORK_INJURY_HANDLE = 5 then "派减待办理"
858
		else null  end,
859
		IF(a.TYPE='1',
huyuchen's avatar
huyuchen committed
860 861 862 863 864 865
		case when if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = 0 then "派增待办理"
		when if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = 1 then "派增办理成功"
		when if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = 2 then "派增办理失败"
		when if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = 3 then "已派减"
		when if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = 4 then "派减失败"
		when if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = 5 then "派减待办理"
866
		else null  end,""
867 868 869
		))
		as WORK_INJURY_HANDLE,
		IF(a.TYPE='0',
870 871 872
		case when s.BIRTH_HANDLE = 0 then "派增待办理"
		when s.BIRTH_HANDLE = 1 then "派增办理成功"
		when s.BIRTH_HANDLE = 2 then "派增办理失败"
873
		when s.BIRTH_HANDLE = 3 then "已派减"
874
		when s.BIRTH_HANDLE = 4 then "派减失败"
875
		when s.BIRTH_HANDLE = 5 then "派减待办理"
876
		else null  end,
877
		IF(a.TYPE='1',
huyuchen's avatar
huyuchen committed
878 879 880 881 882 883
		case when if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = 0 then "派增待办理"
		when if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = 1 then "派增办理成功"
		when if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = 2 then "派增办理失败"
		when if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = 3 then "已派减"
		when if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = 4 then "派减失败"
		when if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = 5 then "派减待办理"
884
		else null  end,""
885 886 887
		))
		as BIRTH_HANDLE,
		IF(a.TYPE='0',
888 889 890
		case when s.BIGAILMENT_HANDLE = 0 then "派增待办理"
		when s.BIGAILMENT_HANDLE = 1 then "派增办理成功"
		when s.BIGAILMENT_HANDLE = 2 then "派增办理失败"
891
		when s.BIGAILMENT_HANDLE = 3 then "已派减"
892
		when s.BIGAILMENT_HANDLE = 4 then "派减失败"
893
		when s.BIGAILMENT_HANDLE = 5 then "派减待办理"
894
		else null  end,
895
		IF(a.TYPE='1',
huyuchen's avatar
huyuchen committed
896 897 898 899 900 901
		case when if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = 0 then "派增待办理"
		when if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = 1 then "派增办理成功"
		when if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = 2 then "派增办理失败"
		when if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = 3 then "已派减"
		when if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = 4 then "派减失败"
		when if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = 5 then "派减待办理"
902
		else null  end,""
903 904
		))
		as BIGAILMENT_HANDLE,
905 906 907
		case when a.FUND_HANDLE_STATUS = 0 then "派增待办理"
		when a.FUND_HANDLE_STATUS = 1 then "派增办理成功"
		when a.FUND_HANDLE_STATUS = 2 then "派增办理失败"
908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926
		when a.FUND_HANDLE_STATUS = 3 then "已派减"
		else null  end  as FUND_HANDLE_STATUS,
		a.CREATE_NAME,
		a.ORGAN_NAME,
		a.CREATE_TIME,
		a.CONTRACT_NAME AS CONTRACT_TYPE,
		a.CONTRACT_SUB_NAME,
		a.CONTRACT_TERM,
		a.CONTRACT_START,
		a.CONTRACT_END,
		a.AUDIT_REMARK,
		a.TRUST_REMARK,
		a.LEAVE_DATE,
		a.REDUCE_REASON,
		case when a.STATUS = 0 then "未提交"
		when a.STATUS = 1 then "待审核"
		when a.STATUS = 2 then "审核通过"
		when a.STATUS = 3 then "审核不通过"
		when a.STATUS = 4 then "已办结"
hongguangwu's avatar
hongguangwu committed
927
		when a.STATUS = 5 then "待SSC审核"
928 929 930 931 932 933 934 935 936 937 938 939 940
		else null  end as STATUS,
		a.AUDIT_USER_NAME as AUDIT_USER,
		a.AUDIT_TIME,
		a.FUND_HANDLE_REMARK,
		a.SOCIAL_HANDLE_REMARK,
		a.FUND_REDUCE_DATE,
		c.PROVIDENT_START,
		if(a.FUND_ID = NULL,'',
		(case when a.STATUS = 0 then "未提交"
		when a.STATUS = 1 then "待审核"
		when a.STATUS = 2 then "审核通过"
		when a.STATUS = 3 then "审核不通过"
		when a.STATUS = 4 then "已办结"
941
		when a.STATUS = 5 then "待SSC审核"
942 943
		else null  end )
		) as FUND_AUDIT_STATUS,
944 945
		c.AUDIT_USER_NAME as FUND_AUDIT_USER,
		c.HANDLE_USER_NAME as FUND_HANDLE_USER,
946
		c.HANDLE_TIME as FUND_HANDLE_TIME,
947
		s.AUDIT_USER_NAME as AUDIT_USER_NAME,
948 949 950 951 952 953
		if(a.SOCIAL_ID =NULL,'',
		(case when a.STATUS = 0 then "未提交"
		when a.STATUS = 1 then "待审核"
		when a.STATUS = 2 then "审核通过"
		when a.STATUS = 3 then "审核不通过"
		when a.STATUS = 4 then "已办结"
954
		when a.STATUS = 5 then "待SSC审核"
955 956 957 958 959
		else null  end )
		) as AUDIT_STATUS,
		s.SOCIAL_START_DATE,
		a.SOCIAL_REDUCE_DATE,
		s.RECORD_BASE,
huyuchen's avatar
huyuchen committed
960
		s.HANDLE_USER_NAME as HANDLE_USER,
961
		s.HANDLE_TIME,
huyuchen's avatar
huyuchen committed
962 963 964 965 966 967
		if(ifnull(h.id,0) != '0',h.UNIT_PENSION_CARDINAL,s.UNIT_PENSION_CARDINAL) UNIT_PENSION_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_MEDICAL_CARDINAL,s.UNIT_MEDICAL_CARDINAL) UNIT_MEDICAL_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_UNEMPLOYMENT_CARDINAL,s.UNIT_UNEMPLOYMENT_CARDINAL) UNIT_UNEMPLOYMENT_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_BIGAILMENT_CARDINAL,s.UNIT_BIGAILMENT_CARDINAL) UNIT_BIGAILMENT_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_WORK_INJURY_CARDINAL,s.UNIT_WORK_INJURY_CARDINAL) UNIT_WORK_INJURY_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_BIRTH_CARDINAL,s.UNIT_BIRTH_CARDINAL) UNIT_BIRTH_CARDINAL,
968 969
		c.PROVIDENT_HOUSEHOLD_NAME,
		c.UNIT_PROVIDENG_CARDINAL,
970
		c.UNIT_PROVIDENT_PER,
971
		c.PERSONAL_PROVIDENT_PER,
972
		a.EMP_MOBILE,
fangxinjiang's avatar
fangxinjiang committed
973
		a.EDUCATION_NAME,
974 975
		a.SCHOOL_NAME,
		a.MAJOR,
976
		a.FIRST_PAY_TIME,
977
		a.GRADUATION_TIME,
978 979 980
		case when a.AUTO_FLAG = 0 then "是"
		when a.AUTO_FLAG = 1 then "否"
		else "无"  end  as  "AUTO_FLAG"
981

982
		from t_dispatch_info a
huyuchen's avatar
huyuchen committed
983
		left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
984
		left join t_social_info s on s.id=a.SOCIAL_ID
huyuchen's avatar
huyuchen committed
985
		left join t_provident_fund c on c.id=a.FUND_ID
huyuchen's avatar
huyuchen committed
986 987 988 989
		<where>
			a.DELETE_FLAG = '0'
			<include refid="tDispatchInfo_where"/>
		</where>
fangxinjiang's avatar
fangxinjiang committed
990
		order by a.APPLY_NO desc
hongguangwu's avatar
hongguangwu committed
991
		<if test="tDispatchInfo.limitStart != null">
992 993
			limit #{tDispatchInfo.limitStart},#{tDispatchInfo.limitEnd}
		</if>
huyuchen's avatar
huyuchen committed
994
	</select>
huyuchen's avatar
huyuchen committed
995 996 997 998 999 1000

	<!-- 派单审核导出 -->
	<select id="exportAuditDispatch" resultMap="exportAuditMap">
		select
		a.EMP_NAME,
		a.EMP_IDCARD,
hongguangwu's avatar
hongguangwu committed
1001
		a.EMP_MOBILE,
huyuchen's avatar
huyuchen committed
1002
		a.EMP_TYPE,
hongguangwu's avatar
hongguangwu committed
1003
		a.ID_CARD_ADDRESS,
huyuchen's avatar
huyuchen committed
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019
		a.BELONG_UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.TYPE,
		a.SOCIAL_HOUSEHOLD_NAME,
		a.PROVIDENT_HOUSEHOLD_NAME,
		a.CREATE_NAME,
		a.CREATE_TIME,
		a.CONTRACT_START,
		a.CONTRACT_END,
		a.TRUST_REMARK,
		a.CONTRACT_NAME,
		a.WORKING_HOURS,
		a.SOCIAL_REDUCE_DATE,
		a.FUND_REDUCE_DATE,
		a.LEAVE_DATE,
		a.REDUCE_REASON,
1020
		a.CONTACT_ADDRESS,
huyuchen's avatar
huyuchen committed
1021
		b.SOCIAL_START_DATE,
huyuchen's avatar
huyuchen committed
1022 1023
		b.PAYMENT_TYPE,
		b.RECORD_BASE,
huyuchen's avatar
huyuchen committed
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033
		if(ifnull(h.id,0) != '0',h.UNIT_PENSION_CARDINAL,b.UNIT_PENSION_CARDINAL) UNIT_PENSION_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_MEDICAL_CARDINAL,b.UNIT_MEDICAL_CARDINAL) UNIT_MEDICAL_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_UNEMPLOYMENT_CARDINAL,b.UNIT_UNEMPLOYMENT_CARDINAL) UNIT_UNEMPLOYMENT_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_WORK_INJURY_CARDINAL,b.UNIT_WORK_INJURY_CARDINAL) UNIT_WORK_INJURY_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_BIRTH_CARDINAL,b.UNIT_BIRTH_CARDINAL) UNIT_BIRTH_CARDINAL,
		if(ifnull(h.id,0) != '0',h.PERSONAL_PENSION_CARDINAL,b.PERSONAL_PENSION_CARDINAL) PERSONAL_PENSION_CARDINAL,
		if(ifnull(h.id,0) != '0',h.PERSONAL_MEDICAL_CARDINAL,b.PERSONAL_MEDICAL_CARDINAL) PERSONAL_MEDICAL_CARDINAL,
		if(ifnull(h.id,0) != '0',h.PERSONAL_UNEMPLOYMENT_CARDINAL,b.PERSONAL_UNEMPLOYMENT_CARDINAL) PERSONAL_UNEMPLOYMENT_CARDINAL,
		if(ifnull(h.id,0) != '0',h.PERSONAL_BIGAILMENT_MONEY,b.PERSONAL_BIGAILMENT_MONEY) PERSONAL_BIGAILMENT_MONEY,
		if(ifnull(h.id,0) != '0',h.UNIT_BIGAILMENT_MONEY,b.UNIT_BIGAILMENT_MONEY) UNIT_BIGAILMENT_MONEY,
huyuchen's avatar
huyuchen committed
1034
		c.UNIT_PROVIDENG_CARDINAL,
huyuchen's avatar
huyuchen committed
1035
		c.PROVIDENT_START,
huyuchen's avatar
huyuchen committed
1036 1037
		c.PERSONAL_PROVIDENT_CARDINAL,
		c.UNIT_PROVIDENT_PER,
1038
		c.PERSONAL_PROVIDENT_PER,
fangxinjiang's avatar
fangxinjiang committed
1039
		a.EDUCATION_NAME,
1040
		a.SCHOOL_NAME,
huyuchen's avatar
huyuchen committed
1041 1042
		a.MAJOR,
		a.FIRST_PAY_TIME,
1043
		a.GRADUATION_TIME
huyuchen's avatar
huyuchen committed
1044
		from t_dispatch_info a
huyuchen's avatar
huyuchen committed
1045
		left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
huyuchen's avatar
huyuchen committed
1046 1047 1048
		left join t_social_info b on a.SOCIAL_ID = b.ID
		left join t_provident_fund c on a.FUND_ID = C.ID
		<where>
1049 1050 1051 1052 1053 1054 1055 1056 1057
			a.DELETE_FLAG = '0'
			<if test="tDispatchInfo != null">
				<if test="tDispatchInfo.status != null and tDispatchInfo.status.trim() != ''">
					AND a.STATUS = #{tDispatchInfo.status}
				</if>
				<if test="tDispatchInfo.status == null or tDispatchInfo.status.trim() == ''">
					AND a.STATUS = '1'
				</if>
			</if>
huyuchen's avatar
huyuchen committed
1058
			<include refid="tDispatchInfoAudit_where"/>
huyuchen's avatar
huyuchen committed
1059
		</where>
fangxinjiang's avatar
fangxinjiang committed
1060
		order by a.APPLY_NO desc
huyuchen's avatar
huyuchen committed
1061 1062 1063 1064 1065
		<if test="tDispatchInfo.limitStart != null">
			limit #{tDispatchInfo.limitStart},#{tDispatchInfo.limitEnd}
		</if>
	</select>

huyuchen's avatar
huyuchen committed
1066 1067 1068 1069 1070
	<select id="selectExportCount" resultType="java.lang.Long">
		SELECT
		count(1)
		from t_dispatch_info a
		<where>
1071 1072 1073 1074 1075 1076 1077 1078 1079
			a.DELETE_FLAG = '0'
			<if test="tDispatchInfo != null">
				<if test="tDispatchInfo.status != null and tDispatchInfo.status.trim() != ''">
					AND a.STATUS = #{tDispatchInfo.status}
				</if>
				<if test="tDispatchInfo.status == null or tDispatchInfo.status.trim() == ''">
					AND a.STATUS = '1'
				</if>
			</if>
huyuchen's avatar
huyuchen committed
1080 1081 1082 1083
			<include refid="tDispatchInfoAudit_where"/>
		</where>
	</select>

hongguangwu's avatar
hongguangwu committed
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
	<resultMap id="socialSoldierExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierExportVo">
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="empType" column="EMP_TYPE"/>
		<result property="empMobile" column="EMP_MOBILE"/>
		<result property="idCardAddress" column="ID_CARD_ADDRESS"/>
		<result property="empNational" column="EMP_NATIONAL"/>
		<result property="type" column="TYPE"/>
		<result property="settleDomain" column="SETTLE_DOMAIN_NAME"/>
		<result property="reduceReason" column="REDUCE_REASON"/>
		<result property="belongUnit" column="BELONG_UNIT_NAME"/>
		<result property="contractStart" column="CONTRACT_START"/>
		<result property="contractEnd" column="CONTRACT_END"/>
		<result property="contractTerm" column="CONTRACT_TERM"/>
		<result property="empRegisType" column="EMP_REGIS_TYPE"/>
		<result property="post" column="POST"/>
		<result property="socialHandleStatus" column="SOCIAL_HANDLE_STATUS"/>
		<result property="socialProvince" column="SOCIAL_PROVINCE"/>
		<result property="socialCity" column="SOCIAL_CITY"/>
		<result property="socialTown" column="SOCIAL_TOWN"/>
		<result property="workingHours" column="WORKING_HOURS"/>
		<result property="educationName" column="EDUCATION_NAME"/>
		<result property="createUserName" column="CREATE_NAME"/>

		<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
		<result property="socialProvince" column="SOCIAL_PROVINCE"/>
		<result property="socialCity" column="SOCIAL_CITY"/>
		<result property="socialTown" column="SOCIAL_TOWN"/>
		<result property="unitPensionCardinal" column="UNIT_PENSION_CARDINAL"/>
		<result property="unitMedicalCardinal" column="UNIT_MEDICAL_CARDINAL"/>
		<result property="unitUnemploymentCardinal" column="UNIT_UNEMPLOYMENT_CARDINAL"/>
		<result property="unitWorkInjuryCardinal" column="UNIT_WORK_INJURY_CARDINAL"/>
		<result property="unitBirthCardinal" column="UNIT_BIRTH_CARDINAL"/>
		<result property="personalBigailmentMoney" column="PERSONAL_BIGAILMENT_MONEY"/>
		<result property="unitBigailmentMoney" column="UNIT_BIGAILMENT_MONEY"/>
		<result property="unitBigailmentCardinal" column="UNIT_BIGAILMENT_CARDINAL"/>
		<result property="socailTrustRemark" column="TRUST_REMARK"/>
		<result property="pensionStart" column="PENSION_START"/>
		<result property="medicalStart" column="MEDICAL_START"/>
		<result property="unemployStart" column="UNEMPLOY_START"/>
		<result property="workInjuryStart" column="WORK_INJURY_START"/>
		<result property="birthStart" column="BIRTH_START"/>
		<result property="bigailmentStart" column="BIGAILMENT_START"/>
		<result property="exportSocialFlag" column="EXPORT_SOCIAL_FLAG"/>
		<result property="schoolName" column="SCHOOL_NAME"/>
		<result property="major" column="MAJOR"/>
		<result property="firstPayTime" column="FIRST_PAY_TIME"/>
		<result property="graduationTime" column="GRADUATION_TIME"/>

hongguangwu's avatar
hongguangwu committed
1133
		<result property="leaveDate" column="LEAVE_DATE"/>
hongguangwu's avatar
hongguangwu committed
1134 1135 1136 1137 1138 1139 1140
		<result property="ygsHandleStatus" column="ygs_Handle_Status"/>
		<result property="ysdHandleStatus" column="ysd_Handle_Status"/>
		<result property="ygsRemark" column="YGS_REMARK"/>
		<result property="ysdRemark" column="YSD_REMARK"/>

	</resultMap>

fangxinjiang's avatar
fangxinjiang committed
1141 1142 1143 1144 1145
	<resultMap id="socialHandleExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.SocialHandleExportVo">
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="empType" column="EMP_TYPE"/>
		<result property="empMobile" column="EMP_MOBILE"/>
hongguangwu's avatar
hongguangwu committed
1146
		<result property="idCardAddress" column="ID_CARD_ADDRESS"/>
fangxinjiang's avatar
fangxinjiang committed
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162
		<result property="empNational" column="EMP_NATIONAL"/>
		<result property="type" column="TYPE"/>
		<result property="settleDomain" column="SETTLE_DOMAIN_NAME"/>
		<result property="reduceReason" column="REDUCE_REASON"/>
		<result property="belongUnit" column="BELONG_UNIT_NAME"/>
		<result property="contractStart" column="CONTRACT_START"/>
		<result property="contractEnd" column="CONTRACT_END"/>
		<result property="contractTerm" column="CONTRACT_TERM"/>
		<result property="empRegisType" column="EMP_REGIS_TYPE"/>
		<result property="post" column="POST"/>
		<result property="socialHandleStatus" column="SOCIAL_HANDLE_STATUS"/>
		<result property="socialProvince" column="SOCIAL_PROVINCE"/>
		<result property="socialCity" column="SOCIAL_CITY"/>
		<result property="socialTown" column="SOCIAL_TOWN"/>
		<result property="workingHours" column="WORKING_HOURS"/>
		<result property="educationName" column="EDUCATION_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
1163
		<result property="createUserName" column="CREATE_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183

		<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
		<result property="socialProvince" column="SOCIAL_PROVINCE"/>
		<result property="socialCity" column="SOCIAL_CITY"/>
		<result property="socialTown" column="SOCIAL_TOWN"/>
		<result property="unitPensionCardinal" column="UNIT_PENSION_CARDINAL"/>
		<result property="unitMedicalCardinal" column="UNIT_MEDICAL_CARDINAL"/>
		<result property="unitUnemploymentCardinal" column="UNIT_UNEMPLOYMENT_CARDINAL"/>
		<result property="unitWorkInjuryCardinal" column="UNIT_WORK_INJURY_CARDINAL"/>
		<result property="unitBirthCardinal" column="UNIT_BIRTH_CARDINAL"/>
		<result property="personalBigailmentMoney" column="PERSONAL_BIGAILMENT_MONEY"/>
		<result property="unitBigailmentMoney" column="UNIT_BIGAILMENT_MONEY"/>
		<result property="unitBigailmentCardinal" column="UNIT_BIGAILMENT_CARDINAL"/>
		<result property="socailTrustRemark" column="TRUST_REMARK"/>
		<result property="pensionStart" column="PENSION_START"/>
		<result property="medicalStart" column="MEDICAL_START"/>
		<result property="unemployStart" column="UNEMPLOY_START"/>
		<result property="workInjuryStart" column="WORK_INJURY_START"/>
		<result property="birthStart" column="BIRTH_START"/>
		<result property="bigailmentStart" column="BIGAILMENT_START"/>
1184
		<result property="exportSocialFlag" column="EXPORT_SOCIAL_FLAG"/>
1185 1186 1187
		<result property="schoolName" column="SCHOOL_NAME"/>
		<result property="major" column="MAJOR"/>
		<result property="firstPayTime" column="FIRST_PAY_TIME"/>
1188
		<result property="graduationTime" column="GRADUATION_TIME"/>
1189
		<result property="leaveDate" column="LEAVE_DATE"/>
fangxinjiang's avatar
fangxinjiang committed
1190 1191 1192 1193 1194 1195 1196 1197 1198
	</resultMap>

	<resultMap id="fundHandleMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.FundHandleExportVo">
		<result property="type" column="TYPE"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="belongUnit" column="BELONG_UNIT_NAME"/>
		<result property="settleDomain" column="SETTLE_DOMAIN_NAME"/>
		<result property="empMobile" column="EMP_MOBILE"/>
hongguangwu's avatar
hongguangwu committed
1199
		<result property="idCardAddress" column="ID_CARD_ADDRESS"/>
fangxinjiang's avatar
fangxinjiang committed
1200
		<result property="createUserName" column="CREATE_NAME"/>
1201
		<result property="fundReduceDate" column="FUND_REDUCE_DATE"/>
fangxinjiang's avatar
fangxinjiang committed
1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213
		<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
		<result property="providentStart" column="PROVIDENT_START"/>
		<result property="unitProvidengCardinal" column="UNIT_PROVIDENG_CARDINAL"/>
		<result property="personalProvidentCardinal" column="PERSONAL_PROVIDENT_CARDINAL"/>
		<result property="unitProvidentPer" column="UNIT_PROVIDENT_PER"/>
		<result property="personalProvidentPer" column="PERSONAL_PROVIDENT_PER"/>
		<result property="unitProvidentFee" column="UNIT_PROVIDENT_FEE"/>
		<result property="personalProvidentFee" column="PERSONAL_PROVIDENT_FEE"/>
		<result property="fundProvince" column="FUND_PROVINCE"/>
		<result property="fundCity" column="FUND_CITY"/>
		<result property="fundTown" column="FUND_TOWN"/>
		<result property="belongUnit" column="BELONG_UNIT_NAME"/>
hongguangwu's avatar
hongguangwu committed
1214
		<result property="fundTrustRemark" column="TRUST_REMARK"/>
huyuchen's avatar
huyuchen committed
1215 1216
		<result property="leaveDate" column="LEAVE_DATE"/>
		<result property="reduceReason" column="REDUCE_REASON"/>
1217
		<result property="exportFundFlag" column="EXPORT_FUND_FLAG"/>
fangxinjiang's avatar
fangxinjiang committed
1218
	</resultMap>
1219

fangxinjiang's avatar
fangxinjiang committed
1220 1221 1222 1223 1224
	<!--tDispatchInfo 社保花名册数据查询-->
	<select id="getSocialRecordRosterList" resultMap="socialHandleExportMap">
		SELECT
		a.TYPE,
		a.SOCIAL_HANDLE_STATUS,
1225
		/*IF(a.TYPE='0',s.PENSION_HANDLE,IF(s.PENSION_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "PENSION_HANDLE",
huyuchen's avatar
huyuchen committed
1226 1227 1228 1229
		IF(a.TYPE='0',s.MEDICAL_HANDLE,IF(s.MEDICAL_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "MEDICAL_HANDLE",
		IF(a.TYPE='0',s.UNEMPLOY_HANDLE,IF(s.UNEMPLOY_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "UNEMPLOY_HANDLE",
		IF(a.TYPE='0',s.WORK_INJURY_HANDLE,IF(s.WORK_INJURY_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "WORK_INJURY_HANDLE",
		IF(a.TYPE='0',s.BIRTH_HANDLE,IF(s.BIRTH_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "BIRTH_HANDLE",
1230
		IF(a.TYPE='0',s.BIGAILMENT_HANDLE,IF(s.BIGAILMENT_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "BIGAILMENT_HANDLE",*/
huyuchen's avatar
huyuchen committed
1231 1232 1233 1234 1235 1236
		if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) PENSION_HANDLE,
		if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) MEDICAL_HANDLE,
		if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) UNEMPLOY_HANDLE,
		if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) WORK_INJURY_HANDLE,
		if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) BIRTH_HANDLE,
		if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) BIGAILMENT_HANDLE,
fangxinjiang's avatar
fangxinjiang committed
1237 1238 1239 1240 1241 1242 1243 1244
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.EDUCATION_NAME,
		a.BELONG_UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.EMP_TYPE,
		a.POST,
		a.EMP_MOBILE,
hongguangwu's avatar
hongguangwu committed
1245
		a.ID_CARD_ADDRESS,
fangxinjiang's avatar
fangxinjiang committed
1246 1247 1248 1249 1250 1251
		a.EMP_REGIS_TYPE,
		a.EMP_NATIONAL,
		a.WORKING_HOURS,
		a.CONTRACT_TERM,
		a.CONTRACT_START,
		a.CONTRACT_END,
fangxinjiang's avatar
fangxinjiang committed
1252
		a.CREATE_NAME,
1253
		a.CONTACT_ADDRESS,
huyuchen's avatar
huyuchen committed
1254 1255
		s.RECORD_BASE,
		s.PAYMENT_TYPE,
fangxinjiang's avatar
fangxinjiang committed
1256
		a.SOCIAL_HOUSEHOLD_NAME,
huyuchen's avatar
huyuchen committed
1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273
		if(ifnull(h.id,0) != '0',h.SOCIAL_PROVINCE,s.SOCIAL_PROVINCE) SOCIAL_PROVINCE,
		if(ifnull(h.id,0) != '0',h.SOCIAL_CITY,s.SOCIAL_CITY) SOCIAL_CITY,
		if(ifnull(h.id,0) != '0',h.SOCIAL_TOWN,s.SOCIAL_TOWN) SOCIAL_TOWN,
		if(ifnull(h.id,0) != '0',h.PENSION_START,s.PENSION_START) PENSION_START,
		if(ifnull(h.id,0) != '0',h.UNIT_PENSION_CARDINAL,s.UNIT_PENSION_CARDINAL) UNIT_PENSION_CARDINAL,
		if(ifnull(h.id,0) != '0',h.MEDICAL_START,s.MEDICAL_START) MEDICAL_START,
		if(ifnull(h.id,0) != '0',h.UNIT_MEDICAL_CARDINAL,s.UNIT_MEDICAL_CARDINAL) UNIT_MEDICAL_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNEMPLOY_START,s.UNEMPLOY_START) UNEMPLOY_START,
		if(ifnull(h.id,0) != '0',h.UNIT_UNEMPLOYMENT_CARDINAL,s.UNIT_UNEMPLOYMENT_CARDINAL) UNIT_UNEMPLOYMENT_CARDINAL,
		if(ifnull(h.id,0) != '0',h.WORK_INJURY_START,s.WORK_INJURY_START) WORK_INJURY_START,
		if(ifnull(h.id,0) != '0',h.UNIT_WORK_INJURY_CARDINAL,s.UNIT_WORK_INJURY_CARDINAL) UNIT_WORK_INJURY_CARDINAL,
		if(ifnull(h.id,0) != '0',h.BIRTH_START,s.BIRTH_START) BIRTH_START,
		if(ifnull(h.id,0) != '0',h.UNIT_BIRTH_CARDINAL,s.UNIT_BIRTH_CARDINAL) UNIT_BIRTH_CARDINAL,
		if(ifnull(h.id,0) != '0',h.BIGAILMENT_START,s.BIGAILMENT_START) BIGAILMENT_START,
		if(ifnull(h.id,0) != '0',h.UNIT_BIGAILMENT_CARDINAL,s.UNIT_BIGAILMENT_CARDINAL) UNIT_BIGAILMENT_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_BIGAILMENT_MONEY,s.UNIT_BIGAILMENT_MONEY) UNIT_BIGAILMENT_MONEY,
		if(ifnull(h.id,0) != '0',h.PERSONAL_BIGAILMENT_MONEY,s.PERSONAL_BIGAILMENT_MONEY) PERSONAL_BIGAILMENT_MONEY,
hongguangwu's avatar
hongguangwu committed
1274
		a.TRUST_REMARK,
1275
		a.REDUCE_REASON,
1276 1277 1278
		'1'  as EXPORT_SOCIAL_FLAG,
		a.SCHOOL_NAME,
		a.MAJOR,
1279
		a.FIRST_PAY_TIME,
1280
		a.GRADUATION_TIME,
1281
		IF(a.LEAVE_DATE is not null,DATE_FORMAT(a.LEAVE_DATE,"%Y-%m-%d"),"") as "LEAVE_DATE"
1282 1283
		FROM t_dispatch_info a
		left join t_social_info s on a.SOCIAL_ID = s.id
huyuchen's avatar
huyuchen committed
1284
		left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
fangxinjiang's avatar
fangxinjiang committed
1285 1286 1287
		<include refid="where_getSocialRecordRoster"/>
	</select>

hongguangwu's avatar
hongguangwu committed
1288 1289
	<!--tDispatchInfo 社保士兵数据查询-->
	<select id="getSocialSoldierList" resultMap="socialSoldierExportMap">
1290
		SELECT
hongguangwu's avatar
hongguangwu committed
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
		a.TYPE,
		a.SOCIAL_HANDLE_STATUS,
		if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) PENSION_HANDLE,
		if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) MEDICAL_HANDLE,
		if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) UNEMPLOY_HANDLE,
		if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) WORK_INJURY_HANDLE,
		if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) BIRTH_HANDLE,
		if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) BIGAILMENT_HANDLE,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.EDUCATION_NAME,
		a.BELONG_UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.EMP_TYPE,
		a.POST,
		a.EMP_MOBILE,
		a.ID_CARD_ADDRESS,
		a.EMP_REGIS_TYPE,
		a.EMP_NATIONAL,
		a.WORKING_HOURS,
		a.CONTRACT_TERM,
		a.CONTRACT_START,
		a.CONTRACT_END,
		a.CREATE_NAME,
		a.CONTACT_ADDRESS,
		s.RECORD_BASE,
		s.PAYMENT_TYPE,
		a.SOCIAL_HOUSEHOLD_NAME,
		if(ifnull(h.id,0) != '0',h.SOCIAL_PROVINCE,s.SOCIAL_PROVINCE) SOCIAL_PROVINCE,
		if(ifnull(h.id,0) != '0',h.SOCIAL_CITY,s.SOCIAL_CITY) SOCIAL_CITY,
		if(ifnull(h.id,0) != '0',h.SOCIAL_TOWN,s.SOCIAL_TOWN) SOCIAL_TOWN,
		if(ifnull(h.id,0) != '0',h.PENSION_START,s.PENSION_START) PENSION_START,
		if(ifnull(h.id,0) != '0',h.UNIT_PENSION_CARDINAL,s.UNIT_PENSION_CARDINAL) UNIT_PENSION_CARDINAL,
		if(ifnull(h.id,0) != '0',h.MEDICAL_START,s.MEDICAL_START) MEDICAL_START,
		if(ifnull(h.id,0) != '0',h.UNIT_MEDICAL_CARDINAL,s.UNIT_MEDICAL_CARDINAL) UNIT_MEDICAL_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNEMPLOY_START,s.UNEMPLOY_START) UNEMPLOY_START,
		if(ifnull(h.id,0) != '0',h.UNIT_UNEMPLOYMENT_CARDINAL,s.UNIT_UNEMPLOYMENT_CARDINAL) UNIT_UNEMPLOYMENT_CARDINAL,
		if(ifnull(h.id,0) != '0',h.WORK_INJURY_START,s.WORK_INJURY_START) WORK_INJURY_START,
		if(ifnull(h.id,0) != '0',h.UNIT_WORK_INJURY_CARDINAL,s.UNIT_WORK_INJURY_CARDINAL) UNIT_WORK_INJURY_CARDINAL,
		if(ifnull(h.id,0) != '0',h.BIRTH_START,s.BIRTH_START) BIRTH_START,
		if(ifnull(h.id,0) != '0',h.UNIT_BIRTH_CARDINAL,s.UNIT_BIRTH_CARDINAL) UNIT_BIRTH_CARDINAL,
		if(ifnull(h.id,0) != '0',h.BIGAILMENT_START,s.BIGAILMENT_START) BIGAILMENT_START,
		if(ifnull(h.id,0) != '0',h.UNIT_BIGAILMENT_CARDINAL,s.UNIT_BIGAILMENT_CARDINAL) UNIT_BIGAILMENT_CARDINAL,
		if(ifnull(h.id,0) != '0',h.UNIT_BIGAILMENT_MONEY,s.UNIT_BIGAILMENT_MONEY) UNIT_BIGAILMENT_MONEY,
		if(ifnull(h.id,0) != '0',h.PERSONAL_BIGAILMENT_MONEY,s.PERSONAL_BIGAILMENT_MONEY) PERSONAL_BIGAILMENT_MONEY,
		a.TRUST_REMARK,
		a.REDUCE_REASON,
		'1'  as EXPORT_SOCIAL_FLAG,
		a.SCHOOL_NAME,
		a.MAJOR,
		a.FIRST_PAY_TIME,
hongguangwu's avatar
hongguangwu committed
1342 1343
		a.GRADUATION_TIME,
		IF(a.LEAVE_DATE is not null,DATE_FORMAT(a.LEAVE_DATE,"%Y-%m-%d"),"") as "LEAVE_DATE"
hongguangwu's avatar
hongguangwu committed
1344 1345 1346 1347
		,s.ygs_Handle_Status
		,s.ysd_Handle_Status
		,s.YGS_REMARK
		,s.YSD_REMARK
1348 1349 1350 1351
		FROM t_dispatch_info a
		left join t_social_info s on a.SOCIAL_ID = s.id
		left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
		<include refid="where_getSocialSoldier"/>
1352
		group by s.id
1353
		order by a.AUDIT_TIME desc
1354 1355
	</select>

1356 1357
	<update id="updateSocialRecords">
		update
1358
		t_dispatch_info a
1359
		left join t_social_info s on a.SOCIAL_ID = s.id
huyuchen's avatar
huyuchen committed
1360
		left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
1361
		set a.EXPORT_SOCIAL_FLAG = 1
1362 1363 1364
		<include refid="where_getSocialRecordRoster"/>
	</update>

fangxinjiang's avatar
fangxinjiang committed
1365 1366 1367
	<!--tDispatchInfo 社保花名册数据查询count-->
	<select id="getSocialRecordRosterListCount" resultType="java.lang.Integer">
		SELECT
huyuchen's avatar
huyuchen committed
1368 1369 1370 1371
		count(1) from
		(
		SELECT
		a.id
1372 1373
		FROM t_dispatch_info a
		left join t_social_info s on a.SOCIAL_ID = s.id
huyuchen's avatar
huyuchen committed
1374
		left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
huyuchen's avatar
huyuchen committed
1375
		<include refid="where_getSocialRecordRoster"/>) a
fangxinjiang's avatar
fangxinjiang committed
1376 1377
	</select>

1378 1379 1380
	<!-- 导出社保士兵count -->
	<select id="getSocialSoldierCount" resultType="java.lang.Integer">
		SELECT
huyuchen's avatar
huyuchen committed
1381
		count(1)
1382
		from (
huyuchen's avatar
huyuchen committed
1383 1384 1385 1386 1387 1388 1389
		SELECT
		1
		FROM t_dispatch_info a
		left join t_social_info s on a.SOCIAL_ID = s.id
		left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
		<include refid="where_getSocialSoldier"/>
		group by s.id
1390
		) a
1391 1392
	</select>

1393 1394 1395 1396 1397 1398 1399 1400 1401 1402
	<resultMap id="socialSoldierPageMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierPageVo" extends="tDispatchInfoMap">
		<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
		<result property="ygsHandleStatus" column="YGS_HANDLE_STATUS"/>
		<result property="ysdHandleStatus" column="YSD_HANDLE_STATUS"/>
		<result property="ygsRemark" column="YGS_REMARK"/>
		<result property="ysdRemark" column="YSD_REMARK"/>
		<result property="ygsRemarkOld" column="YGS_REMARK_OLD"/>
		<result property="ysdRemarkOld" column="YSD_REMARK_OLD"/>
	</resultMap>

1403
	<!-- hgw 2024-5-10 10:42:33 社保士兵列表查询 -->
1404
	<select id="getTSocialSoldierHandlePage" resultMap="socialSoldierPageMap">
1405
		SELECT
huyuchen's avatar
huyuchen committed
1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441
		SUBSTRING_INDEX(GROUP_CONCAT(a.ID ORDER BY a.CREATE_TIME desc),',',1) ID,
		a.EMP_ID,
		a.EMP_NAME,
		a.EMP_NO,
		a.EMP_IDCARD,
		a.EMP_TYPE,
		a.EMP_MOBILE,
		a.EMP_NATIONAL,
		a.STATUS,
		SUBSTRING_INDEX(GROUP_CONCAT(a.TYPE ORDER BY a.CREATE_TIME desc),',',1) TYPE,
		SUBSTRING_INDEX(GROUP_CONCAT(a.SOCIAL_ID ORDER BY a.CREATE_TIME desc),',',1) SOCIAL_ID,
		a.FUND_ID,
		a.TYPE_SUB,
		a.PROCESS_INST_ID,
		a.SETTLE_DOMAIN,
		a.DELETE_FLAG,
		a.SOCIAL_REDUCE_DATE,
		a.FUND_REDUCE_DATE,
		a.LEAVE_DATE,
		a.REDUCE_REASON,
		a.REDUCE_REMARK,
		a.BELONG_UNIT,
		a.CURRENT_OPERATOR,
		a.DISPATCH_ID_BAK,
		a.CONTRACT_START,
		a.CONTRACT_END,
		a.CONTRACT_TERM,
		a.EMP_REGIS_TYPE,
		a.ENJOIN_DATE,
		a.FILE_ADDR,
		a.POST,
		a.TRUST_REMARK,
		a.FILE_PROVINCE,
		a.FILE_CITY,
		a.FILE_TOWN,
		a.CONTRACT_TYPE,
1442
		SUBSTRING_INDEX(GROUP_CONCAT(a.SOCIAL_HANDLE_STATUS ORDER BY a.CREATE_TIME desc),',',1) SOCIAL_HANDLE_STATUS,
huyuchen's avatar
huyuchen committed
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 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
		a.FUND_HANDLE_STATUS,
		a.HANDLE_REMARK,
		a.AUDIT_REMARK,
		a.FUND_HANDLE_REMARK,
		a.SOCIAL_HANDLE_REMARK,
		a.SOCIAL_PROVINCE,
		a.SOCIAL_CITY,
		a.SOCIAL_TOWN,
		a.FUND_PROVINCE,
		a.FUND_CITY,
		a.FUND_TOWN,
		a.AUDIT_USER,
		a.AUDIT_USER_NAME,
		a.AUDIT_TIME,
		a.WORKING_HOURS,
		a.CREATE_BY,
		a.UPDATE_BY,
		a.CREATE_NAME,
		a.CREATE_TIME,
		a.UPDATE_TIME,
		a.ORGAN_NAME,
		a.DISPATCH_ITEM,
		a.SETTLE_DOMAIN_NAME,
		a.BELONG_UNIT_NAME,
		a.DISPATCH_CODE,
		a.AGAIN_DISPATCH_CODE,
		a.SETTLE_DOMAIN_CODE,
		a.CONTRACT_SUB_NAME,
		a.CONTRACT_ID,
		a.EDUCATION_NAME,
		a.TRY_PERIOD,
		a.ID_CARD_PROVINCE,
		a.ID_CARD_CITY,
		a.ID_CARD_TOWN,
		a.ID_CARD_ADDRESS,
		SUBSTRING_INDEX(GROUP_CONCAT(a.APPLY_NO ORDER BY a.CREATE_TIME desc),',',1) APPLY_NO,
		a.ORDER_ID,
		a.SCHOOL_NAME,
		a.MAJOR,
		a.FIRST_PAY_TIME,
		a.GRADUATION_TIME,a.AUTO_FLAG
		,a.SOCIAL_HOUSEHOLD_NAME,s.YGS_HANDLE_STATUS,s.YSD_HANDLE_STATUS
		,s.YGS_REMARK,s.YSD_REMARK,s.YGS_REMARK_OLD,s.YSD_REMARK_OLD
		FROM t_dispatch_info a
		left join t_social_info s on a.SOCIAL_ID = s.id
		left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
		<include refid="where_getSocialSoldier"/>
		group by s.id
1491
		order by a.AUDIT_TIME desc
1492 1493
	</select>

fangxinjiang's avatar
fangxinjiang committed
1494
	<!--tDispatchInfo 社保办理数据查询-->
fangxinjiang's avatar
fangxinjiang committed
1495
	<select id="getTDispatchSocialHandlePage" resultMap="dispatchPageMap">
fangxinjiang's avatar
fangxinjiang committed
1496
		SELECT
fangxinjiang's avatar
fangxinjiang committed
1497
		<include refid="Base_Column_List"/>,
huyuchen's avatar
huyuchen committed
1498
		a.SOCIAL_HOUSEHOLD_NAME,a.EXPORT_SOCIAL_FLAG,s.YGS_HANDLE_STATUS,s.YSD_HANDLE_STATUS
1499 1500
		FROM t_dispatch_info a
		left join t_social_info s on a.SOCIAL_ID = s.id
huyuchen's avatar
huyuchen committed
1501
		left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
fangxinjiang's avatar
fangxinjiang committed
1502
		<include refid="where_getSocialRecordRoster"/>
1503
		and s.DELETE_FLAG = 0
fangxinjiang's avatar
fangxinjiang committed
1504
	</select>
huyuchen's avatar
huyuchen committed
1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515

	<!--tDispatchInfo 社保办理数据查询-->
	<select id="getTDispatchSocialHandleNoPage" resultMap="dispatchPageMap">
		SELECT
		<include refid="Base_Column_List"/>,
		a.SOCIAL_HOUSEHOLD_NAME,a.EXPORT_SOCIAL_FLAG
		FROM t_dispatch_info a
		left join t_social_info s on a.SOCIAL_ID = s.id
		<include refid="where_getSocialRecordNoPage"/>
	</select>

fangxinjiang's avatar
fangxinjiang committed
1516
	<!--tDispatchInfo 公积金办理数据查询-->
fangxinjiang's avatar
fangxinjiang committed
1517
	<select id="getTDispatchFundHandlePage" resultMap="dispatchPageMap">
fangxinjiang's avatar
fangxinjiang committed
1518
		SELECT
fangxinjiang's avatar
fangxinjiang committed
1519
		<include refid="Base_Column_List"/>,
1520 1521 1522
		a.PROVIDENT_HOUSEHOLD_NAME,a.EXPORT_FUND_FLAG
		FROM t_dispatch_info a
		left join t_provident_fund f on a.FUND_ID = f.id
1523 1524 1525 1526 1527
		<where>
			<include refid="where_getFundRecord"/>
			group by a.id
			order by a.APPLY_NO desc
		</where>
fangxinjiang's avatar
fangxinjiang committed
1528 1529
	</select>

1530 1531 1532 1533 1534
	<!--tDispatchInfo 公积金办理数据查询 2023-05-08-->
	<select id="getTDispatchFundHandleNoPage" resultMap="dispatchPageMap">
		SELECT
		<include refid="Base_Column_List"/>,
		a.PROVIDENT_HOUSEHOLD_NAME
1535 1536
		FROM t_dispatch_info a
		left join t_provident_fund f on a.FUND_ID = f.id
1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548
		<where>
			<include refid="where_getFundRecord"/>
			<if test="idCards != null and idCards.size > 0">
				AND a.emp_idcard in
				<foreach item="items" index="index" collection="idCards" open="(" separator="," close=")">
					#{items}
				</foreach>
			</if>
			group by a.id
			order by a.APPLY_NO desc
		</where>

1549 1550
	</select>

fangxinjiang's avatar
fangxinjiang committed
1551 1552 1553
	<!--tDispatchInfo 公积金变更清册cout-->
	<select id="getFundRecordCount" resultType="java.lang.Integer">
		SELECT
huyuchen's avatar
huyuchen committed
1554 1555 1556
		count(1) from
		(SELECT
		a.id
1557 1558
		FROM t_dispatch_info a
		left join t_provident_fund f on a.FUND_ID = f.id
1559 1560 1561 1562 1563
		<where>
			<include refid="where_getFundRecord"/>
			group by a.id
			order by a.APPLY_NO desc
		</where>) a
fangxinjiang's avatar
fangxinjiang committed
1564
	</select>
huyuchen's avatar
huyuchen committed
1565

1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579
	<select id="getFCount" resultType="java.lang.Integer">
		SELECT count(1) from (
		SELECT 1
		FROM t_dispatch_info a
		<where>
			<include refid="where_getFundDisRecord"/>
		</where>
		group by a.EMP_IDCARD ,a.TYPE) h
	</select>

	<select id="getSocialDisRecordCount" resultType="java.lang.Integer">
		SELECT count(1) from (
		SELECT 1
		FROM t_dispatch_info a
huyuchen's avatar
huyuchen committed
1580
		left join t_social_info s on s.id=a.SOCIAL_ID
1581 1582 1583 1584 1585
		<where>
			<include refid="where_getSocialDisRecord"/>
		</where>
		group by a.EMP_IDCARD) h
	</select>
1586

huyuchen's avatar
huyuchen committed
1587 1588 1589
	<!--tDispatchInfo 社保医疗花名册派单数据-->
	<select id="getSocialDisRecord" resultMap="socialDisExportMap">
		SELECT
huyuchen's avatar
huyuchen committed
1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616
		(@i :=@i+1) as NUM,
		h.EMP_NAME,
		h.IDCARD_TYPE,
		h.EMP_IDCARD,
		h.DIS_MONTH,
		h.MEDICAL_CARDINAL,
		h.CHANGE_TYPE_ONE,
		h.CHANGE_TYPE_TWO,
		h.CHANGE_TYPE_THREE,
		h.CHANGE_TYPE_FOUR,
		h.EMP_MOBILE,
		h.EDUCATION_NAME,
		h.REMARK
		from (
		select
		a.EMP_NAME,
		'身份证' as IDCARD_TYPE,
		a.EMP_IDCARD,
		replace(DATE_FORMAT(a.CREATE_TIME,"%Y-%m"),'-','') as DIS_MONTH,
		s.UNIT_MEDICAL_CARDINAL as MEDICAL_CARDINAL,
		'' as CHANGE_TYPE_ONE,
		'√' as CHANGE_TYPE_TWO,
		'' as CHANGE_TYPE_THREE,
		'' as CHANGE_TYPE_FOUR,
		a.EMP_MOBILE,
		a.EDUCATION_NAME,
		'' as REMARK
huyuchen's avatar
huyuchen committed
1617 1618 1619 1620 1621
		FROM t_dispatch_info a
		left join t_social_info s on s.id=a.SOCIAL_ID
		<where>
			<include refid="where_getSocialDisRecord"/>
		</where>
huyuchen's avatar
huyuchen committed
1622
		group by a.EMP_IDCARD) h,(select @i:=0) as itable
huyuchen's avatar
huyuchen committed
1623 1624
	</select>

huyuchen's avatar
huyuchen committed
1625 1626 1627 1628
	<!--tDispatchInfo 社保医疗花名册派单数据-->
	<select id="getSocialReduceDisRecord" resultMap="socialDisExportMap">
		SELECT
		(@i :=@i+1) as NUM,
huyuchen's avatar
huyuchen committed
1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642
		h.EMP_NAME,
		h.IDCARD_TYPE,
		h.EMP_IDCARD,
		h.DIS_MONTH,
		h.MEDICAL_CARDINAL,
		h.CHANGE_TYPE_ONE,
		h.CHANGE_TYPE_TWO,
		h.CHANGE_TYPE_THREE,
		h.CHANGE_TYPE_FOUR,
		h.EMP_MOBILE,
		h.EDUCATION_NAME,
		h.REMARK
		from (
		select
huyuchen's avatar
huyuchen committed
1643 1644 1645 1646 1647 1648 1649 1650 1651
		a.EMP_NAME,
		'身份证' as IDCARD_TYPE,
		a.EMP_IDCARD,
		replace(DATE_FORMAT(a.CREATE_TIME,"%Y-%m"),'-','') as DIS_MONTH,
		s.UNIT_MEDICAL_CARDINAL as MEDICAL_CARDINAL,
		'' as CHANGE_TYPE_ONE,
		'' as CHANGE_TYPE_TWO,
		'√' as CHANGE_TYPE_THREE,
		'' as CHANGE_TYPE_FOUR,
huyuchen's avatar
huyuchen committed
1652 1653
		'' as EMP_MOBILE,
		'' as EDUCATION_NAME,
huyuchen's avatar
huyuchen committed
1654
		'' as REMARK
huyuchen's avatar
huyuchen committed
1655 1656 1657 1658 1659
		FROM t_dispatch_info a
		left join t_social_info s on s.id=a.SOCIAL_ID
		<where>
			<include refid="where_getSocialDisRecord"/>
		</where>
huyuchen's avatar
huyuchen committed
1660
		group by a.EMP_IDCARD) h,(select @i:=0) as itable
huyuchen's avatar
huyuchen committed
1661 1662 1663 1664
	</select>

	<!--tDispatchInfo 社保养老花名册派单数据-->
	<select id="getSocialPersionDisCount" resultType="java.lang.Integer">
huyuchen's avatar
huyuchen committed
1665 1666
		SELECT count(1) from (
		select 1
huyuchen's avatar
huyuchen committed
1667 1668 1669 1670
		FROM t_dispatch_info a
		<where>
			<include refid="where_getSocialPersionDisRecord"/>
		</where>
huyuchen's avatar
huyuchen committed
1671
		group by a.EMP_IDCARD) h
huyuchen's avatar
huyuchen committed
1672 1673 1674 1675 1676 1677
	</select>

	<!--tDispatchInfo 社保养老花名册派单数据-->
	<select id="getSocialPersionDisRecord" resultMap="socialPersionDisExportMap">
		SELECT
		(@i :=@i+1) as num,
huyuchen's avatar
huyuchen committed
1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697
		h.EMP_NAME,
		h.EMP_NO,
		h.EMP_IDCARD,
		h.sex,
		h.EMP_NATIONAL,
		h.WORK_DATE,
		h.type,
		h.SIGNLE_TYPE,
		h.INSURANCE_TYPE_ONE,
		h.INSURANCE_TYPE_TWO,
		h.INSURANCE_TYPE_THREE,
		h.INSURANCE_TYPE_FOUR,
		h.INSURANCE_TYPE_FIVE,
		h.PERSION_CARDINAL,
		h.MEDICAL_CARDINAL,
		h.DATE_ONE,
		h.CONTRACT_ADRESS,
		h.REMARK
		FROM (
		SELECT
huyuchen's avatar
huyuchen committed
1698
		a.EMP_NAME,
huyuchen's avatar
huyuchen committed
1699
		'' as EMP_NO,
huyuchen's avatar
huyuchen committed
1700 1701 1702 1703
		a.EMP_IDCARD,
		CASE (SUBSTR(a.EMP_IDCARD,17,1)%2)
		WHEN 1 THEN '男'
		WHEN 0 THEN '女'
huyuchen's avatar
huyuchen committed
1704
		else '男'
huyuchen's avatar
huyuchen committed
1705
		END sex,
huyuchen's avatar
huyuchen committed
1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719
		case when a.EMP_NATIONAL = 1 then "汉族"
		when a.EMP_NATIONAL = 2 then "傣族"
		when a.EMP_NATIONAL = 3 then "回族"
		when a.EMP_NATIONAL = 4 then "未知"
		when a.EMP_NATIONAL = 5 then "满族"
		when a.EMP_NATIONAL = 6 then "壮族"
		when a.EMP_NATIONAL = 7 then "黎族"
		when a.EMP_NATIONAL = 8 then "蒙古族"
		when a.EMP_NATIONAL = 9 then "白族"
		when a.EMP_NATIONAL = 10 then "仫佬族"
		when a.EMP_NATIONAL = 11 then "土家族"
		when a.EMP_NATIONAL = 12 then "畬族"
		when a.EMP_NATIONAL = 13 then "苗族"
		else "汉族" end as EMP_NATIONAL,
huyuchen's avatar
huyuchen committed
1720 1721 1722 1723 1724 1725 1726 1727 1728 1729
		concat(ifnull(DATE_FORMAT(a.CONTRACT_START,"%Y%m%d"),''),'-',ifnull(DATE_FORMAT(a.CONTRACT_END,"%Y%m%d"),'')) as WORK_DATE,
		'非农业户口(城镇)' as type,
		'企业职工' as SIGNLE_TYPE,
		'√' as INSURANCE_TYPE_ONE,
		'√' as INSURANCE_TYPE_TWO,
		'' as INSURANCE_TYPE_THREE,
		'√' as INSURANCE_TYPE_FOUR,
		'' as INSURANCE_TYPE_FIVE,
		s.RECORD_BASE as PERSION_CARDINAL,
		s.UNIT_MEDICAL_CARDINAL as MEDICAL_CARDINAL,
huyuchen's avatar
huyuchen committed
1730
		concat(ifnull(DATE_FORMAT(a.CONTRACT_START,"%Y%m"),''),'-',ifnull(DATE_FORMAT(a.CONTRACT_END,"%Y%m"),'')) as DATE_ONE,
huyuchen's avatar
huyuchen committed
1731
		'安徽省合肥市' as CONTRACT_ADRESS,
huyuchen's avatar
huyuchen committed
1732 1733 1734 1735 1736 1737
		a.EMP_MOBILE as REMARK
		FROM t_dispatch_info a
		left join t_social_info s on s.id=a.SOCIAL_ID
		<where>
			<include refid="where_getSocialPersionDisRecord"/>
		</where>
huyuchen's avatar
huyuchen committed
1738
		group by a.EMP_IDCARD)h,(select @i:=0) as itable
huyuchen's avatar
huyuchen committed
1739 1740
	</select>

huyuchen's avatar
huyuchen committed
1741 1742
	<!--tDispatchInfo 社保养老花名册派单数据-->
	<select id="getSocialPersionReduceDisCount" resultType="java.lang.Integer">
huyuchen's avatar
huyuchen committed
1743 1744
		SELECT count(1) from (
		SELECT 1
huyuchen's avatar
huyuchen committed
1745 1746 1747 1748
		FROM t_dispatch_info a
		<where>
			<include refid="where_getSocialPersionDisRecord"/>
		</where>
huyuchen's avatar
huyuchen committed
1749
		group by a.EMP_IDCARD) h
huyuchen's avatar
huyuchen committed
1750 1751 1752 1753 1754 1755
	</select>

	<!--tDispatchInfo 社保养老花名册派单数据-->
	<select id="getSocialPersionReduceDisRecord" resultMap="socialPersionReduceDisExportMap">
		SELECT
		(@i :=@i+1) as num,
huyuchen's avatar
huyuchen committed
1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780
		h.EMP_NO,
		h.EMP_NAME,
		h.EMP_IDCARD,
		h.WORK_DATE,
		h.typeA,
		h.typeB,
		h.typeC,
		h.typeD,
		h.typeE,
		h.typeW,
		h.typeF,
		h.typeG,
		h.typeH,
		h.typeZ,
		h.typeJ,
		h.typeK,
		h.typeL,
		h.typeM,
		h.typeN,
		h.typeO,
		h.typeP,
		h.typeQ,
		h.REMARK
		FROM (
		SELECT
huyuchen's avatar
huyuchen committed
1781
		'' as EMP_NO,
huyuchen's avatar
huyuchen committed
1782 1783 1784 1785 1786 1787 1788 1789
		a.EMP_NAME,
		a.EMP_IDCARD,
		DATE_FORMAT(a.CREATE_TIME,"%Y%m") as WORK_DATE,
		'√' as typeA,
		'' as typeB,
		'' as typeC,
		'' as typeD,
		'' as typeE,
huyuchen's avatar
huyuchen committed
1790
		'' as typeW,
huyuchen's avatar
huyuchen committed
1791 1792 1793
		'' as typeF,
		'' as typeG,
		'' as typeH,
huyuchen's avatar
huyuchen committed
1794
		'' as typeZ,
huyuchen's avatar
huyuchen committed
1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808
		'' as typeJ,
		'' as typeK,
		'' as typeL,
		'' as typeM,
		'' as typeN,
		'' as typeO,
		'' as typeP,
		'' as typeQ,
		a.EMP_MOBILE as REMARK
		FROM t_dispatch_info a
		left join t_social_info s on s.id=a.SOCIAL_ID
		<where>
			<include refid="where_getSocialPersionDisRecord"/>
		</where>
huyuchen's avatar
huyuchen committed
1809
		group by a.EMP_IDCARD) h,(select @i:=0) as itable
huyuchen's avatar
huyuchen committed
1810 1811
	</select>

fangxinjiang's avatar
fangxinjiang committed
1812 1813 1814 1815 1816 1817
	<!--tDispatchInfo 公积金变更清册查询-->
	<select id="getFundRecordList" resultMap="fundHandleMap">
		SELECT
		a.TYPE,
		a.EMP_NAME,
		a.EMP_IDCARD,
1818
		a.EMP_TYPE,
fangxinjiang's avatar
fangxinjiang committed
1819 1820 1821
		a.BELONG_UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.EMP_MOBILE,
hongguangwu's avatar
hongguangwu committed
1822
		a.ID_CARD_ADDRESS,
fangxinjiang's avatar
fangxinjiang committed
1823
		a.CREATE_NAME,
fangxinjiang's avatar
fangxinjiang committed
1824
		a.PROVIDENT_HOUSEHOLD_NAME,
1825
		a.CONTACT_ADDRESS,
huyuchen's avatar
huyuchen committed
1826 1827
		f.PROVIDENT_START,
		f.UNIT_PROVIDENG_CARDINAL,
1828
		a.FUND_REDUCE_DATE,
huyuchen's avatar
huyuchen committed
1829 1830 1831 1832 1833 1834 1835
		f.PERSONAL_PROVIDENT_CARDINAL,
		f.UNIT_PROVIDENT_PER,
		f.PERSONAL_PROVIDENT_PER,
		f.UNIT_PROVIDENT_FEE,
		f.PERSONAL_PROVIDENT_FEE,
		f.FUND_PROVINCE,
		f.FUND_CITY,
hongguangwu's avatar
hongguangwu committed
1836
		f.FUND_TOWN,
huyuchen's avatar
huyuchen committed
1837 1838
		a.TRUST_REMARK,
		a.LEAVE_DATE,
1839
		a.REDUCE_REASON,
fangxinjiang's avatar
fangxinjiang committed
1840
		'1' as EXPORT_FUND_FLAG
1841 1842
		FROM t_dispatch_info a
		left join t_provident_fund f on a.FUND_ID = f.id
1843 1844 1845 1846 1847
		<where>
			<include refid="where_getFundRecord"/>
			group by a.id
			order by a.APPLY_NO desc
		</where>
fangxinjiang's avatar
fangxinjiang committed
1848
	</select>
1849 1850 1851
	<update id="updateFundRecords">
		update  t_dispatch_info a
		left join t_provident_fund f on a.FUND_ID = f.id
1852
		set a.EXPORT_FUND_FLAG = 1
1853 1854 1855
		<where>
			<include refid="where_getFundRecord"/>
		</where>
1856
	</update>
fangxinjiang's avatar
fangxinjiang committed
1857 1858 1859
	<!--tDispatchInfo 公积金补交清册-->
	<select id="getFundSupplementaryRecords" resultMap="fundSupplementaryMap">
		SELECT
huyuchen's avatar
huyuchen committed
1860 1861 1862 1863 1864 1865 1866 1867
		f.PROVIDENT_START,
		f.UNIT_PROVIDENG_CARDINAL,
		f.PERSONAL_PROVIDENT_CARDINAL,
		f.UNIT_PROVIDENT_PER,
		f.PERSONAL_PROVIDENT_PER,
		f.UNIT_PROVIDENT_FEE,
		f.PERSONAL_PROVIDENT_FEE,
		f.EMP_NAME
1868 1869
		FROM t_dispatch_info a
		left join t_provident_fund f on a.FUND_ID = f.id
1870 1871 1872 1873 1874
		<where>
			<include refid="where_getFundRecord"/>
			group by a.id
			order by a.APPLY_NO desc
		</where>
fangxinjiang's avatar
fangxinjiang committed
1875
	</select>
1876 1877

	<!-- 社保办理查询 -->
fangxinjiang's avatar
fangxinjiang committed
1878 1879
	<sql id="where_getSocialRecordRoster">
		<where>
hongguangwu's avatar
hongguangwu committed
1880
			s.DELETE_FLAG = 0
fangxinjiang's avatar
fangxinjiang committed
1881 1882 1883 1884
			/** 社保办理状态:0待办理/1已办理2办理失败3已派减4 办理中 5 部分办理失败 派单社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败)  3 部分办理成功 4 办理中  **/
			/*社保代办理 1.派单审核通过 2.派增(type=0):待办理(social_handle_status='0')  or 派减(type=1):已办理完成或部分办理失败 且已派减*/
			AND a.social_id is not null
			AND a.STATUS = "2"
huyuchen's avatar
huyuchen committed
1885
			and (( a.type = '0' AND (s.HANDLE_STATUS = "0" or s.HANDLE_STATUS = "4") ) or ( a.type ='1'  AND (if(ifnull(h.id,0) != '0',h.HANDLE_STATUS,s.HANDLE_STATUS) in ('1','5','6','3','7') or (s.HANDLE_STATUS in ('1','5','6','3','7') and s.REDUCE_CAN = '1'))  ))
fangxinjiang's avatar
fangxinjiang committed
1886
			and a.SOCIAL_HANDLE_STATUS in ('0','4')
1887
			and (a.auto_flag='1' or s.YGS_HANDLE_STATUS ='5' or s.YSD_HANDLE_STATUS = '5' )
1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911

			<!--<if test="tDispatchInfo.status != null and tDispatchInfo.status.trim() != ''">
				/*待办理组合判断*/
				<if test="'2'.toString() == tDispatchInfo.status.trim() and tDispatchInfo.typeSub != null ">
					/*社保代办理*/
					<if test=" '0'.toString()==tDispatchInfo.typeSub.trim() ">
						<if test="tDispatchInfo.socialHandleStatus != null and tDispatchInfo.socialHandleStatus != ''">

						</if>
						<if test="tDispatchInfo.socialHandleStatus == null or tDispatchInfo.socialHandleStatus == ''">
							and (( a.type = '0' AND b.HANDLE_STATUS in ('0','4')) or ( a.type ='1'  AND b.HANDLE_STATUS in ('1','5')  and b.REDUCE_CAN = '1'))
							and a.SOCIAL_HANDLE_STATUS in ('0','4')
						</if>
					</if>
					/* 公积金办理*/
					<if test=" '1'.toString()==tDispatchInfo.typeSub.trim() ">
						and (( a.type = '0' AND c.HANDLE_STATUS = '0') or ( a.type ='1'  AND c.HANDLE_STATUS = '1' and c.REDUCE_CAN = '1'))
						and a.FUND_HANDLE_STATUS='0'
					</if>
				</if>
			</if>-->
			<include refid="where_getSocialRecordRoster_base"/>
		</where>
	</sql>
fangxinjiang's avatar
fangxinjiang committed
1912

1913 1914 1915
	<!-- 社保士兵列表查询 -->
	<sql id="where_getSocialSoldier">
		<where>
1916
			a.DELETE_FLAG = '0'
1917 1918 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
			AND a.social_id is not null
			and a.AUTO_FLAG = '0'
			<include refid="where_getSocialRecordRoster_base"/>

			<if test="tDispatchInfo != null">
				<if test="tDispatchInfo.ygsHandleStatus != null and tDispatchInfo.ygsHandleStatus.trim() != ''">
					AND s.YGS_HANDLE_STATUS = #{tDispatchInfo.ygsHandleStatus}
				</if>
				<if test="tDispatchInfo.ysdHandleStatus != null and tDispatchInfo.ysdHandleStatus.trim() != ''">
					AND s.YSD_HANDLE_STATUS = #{tDispatchInfo.ysdHandleStatus}
				</if>
				<if test="tDispatchInfo.ygsRemark != null and tDispatchInfo.ygsRemark.trim() != ''">
					AND s.YGS_REMARK like concat('%',#{tDispatchInfo.ygsRemark},'%')
				</if>
				<if test="tDispatchInfo.ysdRemark != null and tDispatchInfo.ysdRemark.trim() != ''">
					AND s.YSD_REMARK like concat('%',#{tDispatchInfo.ysdRemark},'%')
				</if>
			</if>
		</where>
	</sql>

	<sql id="where_getSocialRecordRoster_base">
		<if test="idsStr != null and idsStr.size > 0">
			AND a.ID in
			<foreach item="items" index="index" collection="idsStr" open="(" separator="," close=")">
				#{items}
			</foreach>
		</if>
		<if test="tDispatchInfo != null">
fangxinjiang's avatar
fangxinjiang committed
1946
			<if test="tDispatchInfo.empTypeList != null  and tDispatchInfo.empTypeList.length>0">
1947 1948 1949 1950 1951
				AND a.EMP_TYPE IN
				<foreach collection="tDispatchInfo.empTypeList" item="item" index="index" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
1952

huyuchen's avatar
huyuchen committed
1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965
			<if test="tDispatchInfo.dispatchItems != null and tDispatchInfo.dispatchItems.size >0">
				AND
				<foreach item="item" index="index" collection="tDispatchInfo.dispatchItems" open="(" separator="or" close=")">
					INSTR(a.DISPATCH_ITEM,#{item})
				</foreach>
			</if>
			<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
				AND a.TYPE = #{tDispatchInfo.type}
			</if>
			<if test="tDispatchInfo.socialProvince != null and tDispatchInfo.socialProvince!= null">
				AND  if(ifnull(h.id,0) != '0',h.social_province,s.social_province) = #{tDispatchInfo.socialProvince}
				<if test="tDispatchInfo.socialCity != null and tDispatchInfo.socialCity!= null">
					AND  if(ifnull(h.id,0) != '0',h.social_city,s.social_city) = #{tDispatchInfo.socialCity}
fangxinjiang's avatar
fangxinjiang committed
1966
				</if>
huyuchen's avatar
huyuchen committed
1967 1968
				<if test="tDispatchInfo.socialTown != null and tDispatchInfo.socialTown!= null">
					AND  if(ifnull(h.id,0) != '0',h.social_town,s.social_town) = #{tDispatchInfo.socialTown}
fangxinjiang's avatar
fangxinjiang committed
1969
				</if>
huyuchen's avatar
huyuchen committed
1970 1971 1972 1973 1974 1975 1976 1977 1978 1979
			</if>
			<if test="tDispatchInfo.empName != null and tDispatchInfo.empName.trim() != ''">
				AND a.EMP_NAME like concat('%',#{tDispatchInfo.empName},'%')
			</if>
			<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
				AND a.EMP_IDCARD like concat('%',#{tDispatchInfo.empIdcard},'%')
			</if>
			<if test="tDispatchInfo.status != null and tDispatchInfo.status.trim() != ''">
				AND a.STATUS = #{tDispatchInfo.status}
			</if>
fangxinjiang's avatar
fangxinjiang committed
1980

huyuchen's avatar
huyuchen committed
1981 1982 1983
			<if test="tDispatchInfo.settleDomain != null and tDispatchInfo.settleDomain.trim() != ''">
				AND a.SETTLE_DOMAIN = #{tDispatchInfo.settleDomain}
			</if>
fangxinjiang's avatar
fangxinjiang committed
1984

huyuchen's avatar
huyuchen committed
1985 1986 1987
			<if test="tDispatchInfo.settleDomainCode != null and tDispatchInfo.settleDomainCode.trim() != ''">
				AND a.SETTLE_DOMAIN_CODE = #{tDispatchInfo.settleDomainCode}
			</if>
fangxinjiang's avatar
fangxinjiang committed
1988

huyuchen's avatar
huyuchen committed
1989 1990 1991
			<if test="tDispatchInfo.socialHandleStatus != null and tDispatchInfo.socialHandleStatus.trim() != ''">
				AND a.SOCIAL_HANDLE_STATUS = #{tDispatchInfo.socialHandleStatus}
			</if>
fangxinjiang's avatar
fangxinjiang committed
1992

huyuchen's avatar
huyuchen committed
1993 1994 1995
			<if test="tDispatchInfo.createName != null and tDispatchInfo.createName.trim() != ''">
				AND a.CREATE_NAME = #{tDispatchInfo.createName}
			</if>
fangxinjiang's avatar
fangxinjiang committed
1996

huyuchen's avatar
huyuchen committed
1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
			<if test="tDispatchInfo.settleDomainName != null and tDispatchInfo.settleDomainName.trim() != ''">
				AND a.SETTLE_DOMAIN_NAME like CONCAT(CONCAT(#{tDispatchInfo.settleDomainName}), '%')
			</if>
			<if test="tDispatchInfo.belongUnitName != null and tDispatchInfo.belongUnitName.trim() != ''">
				AND a.BELONG_UNIT_NAME = #{tDispatchInfo.belongUnitName}
			</if>
			<if test="tDispatchInfo.createTimeEnd != null">
				AND a.CREATE_TIME <![CDATA[<=]]> #{tDispatchInfo.createTimeEnd}
			</if>
			<if test="tDispatchInfo.createTimeStart != null">
				AND a.CREATE_TIME <![CDATA[>=]]> #{tDispatchInfo.createTimeStart}
			</if>
			<if test="tDispatchInfo.auditTimeStart != null">
				AND a.AUDIT_TIME <![CDATA[>=]]> #{tDispatchInfo.auditTimeStart}
fangxinjiang's avatar
fangxinjiang committed
2011
			</if>
huyuchen's avatar
huyuchen committed
2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027
			<if test="tDispatchInfo.auditTimeEnd != null">
				AND a.AUDIT_TIME <![CDATA[<=]]> #{tDispatchInfo.auditTimeEnd}
			</if>
			<if test="tDispatchInfo.auditUserName != null and tDispatchInfo.auditUserName.trim() != ''">
				AND a.AUDIT_USER_NAME like concat('%',#{tDispatchInfo.auditUserName},'%')
			</if>
			<if test="tDispatchInfo.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
				AND a.SOCIAL_HOUSEHOLD_NAME  like CONCAT(CONCAT(#{tDispatchInfo.socialHouseholdName}), '%')
			</if>
			<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
				${tDispatchInfo.authSql}
			</if>
			<if test="tDispatchInfo.exportSocialFlag != null and tDispatchInfo.exportSocialFlag.trim() != ''">
				AND a.EXPORT_SOCIAL_FLAG = ${tDispatchInfo.exportSocialFlag}
			</if>
		</if>
fangxinjiang's avatar
fangxinjiang committed
2028 2029
	</sql>

2030

huyuchen's avatar
huyuchen committed
2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045
	<sql id="where_getSocialRecordNoPage">
		<where>
			s.DELETE_FLAG = 0
			<if test="idsStr != null and idsStr.size > 0">
				AND a.ID in
				<foreach item="items" index="index" collection="idsStr" open="(" separator="," close=")">
					#{items}
				</foreach>
			</if>
			/** 社保办理状态:0待办理/1已办理2办理失败3已派减4 办理中 5 部分办理失败 派单社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败)  3 部分办理成功 4 办理中  **/
			/*社保代办理 1.派单审核通过 2.派增(type=0):待办理(social_handle_status='0')  or 派减(type=1):已办理完成或部分办理失败 且已派减*/
			AND a.social_id is not null
			AND a.STATUS = "2"
			and (( a.type = '0' AND (s.HANDLE_STATUS = "0" or s.HANDLE_STATUS = "4") ) or ( a.type ='1'  AND s.HANDLE_STATUS in ('1','5','6','3','7')  and s.REDUCE_CAN = '1'))
			and a.SOCIAL_HANDLE_STATUS in ('0','4')
fangxinjiang's avatar
fangxinjiang committed
2046
			<if test="tDispatchInfo.empTypeList != null  and tDispatchInfo.empTypeList.length>0 ">
huyuchen's avatar
huyuchen committed
2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138
				AND a.EMP_TYPE IN
				<foreach collection="tDispatchInfo.empTypeList" item="item" index="index" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			<if test="tDispatchInfo != null">
				<if test="tDispatchInfo.dispatchItems != null and tDispatchInfo.dispatchItems.size >0">
					AND
					<foreach item="item" index="index" collection="tDispatchInfo.dispatchItems" open="(" separator="or" close=")">
						INSTR(a.DISPATCH_ITEM,#{item})
					</foreach>
				</if>
				<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
					AND a.TYPE = #{tDispatchInfo.type}
				</if>
				<if test="tDispatchInfo.socialProvince != null and tDispatchInfo.socialProvince!= null">
					AND  s.social_province = #{tDispatchInfo.socialProvince}
					<if test="tDispatchInfo.socialCity != null and tDispatchInfo.socialCity!= null">
						AND  s.social_city = #{tDispatchInfo.socialCity}
					</if>
					<if test="tDispatchInfo.socialTown != null and tDispatchInfo.socialTown!= null">
						AND  s.social_town = #{tDispatchInfo.socialTown}
					</if>
				</if>
				<if test="tDispatchInfo.empName != null and tDispatchInfo.empName.trim() != ''">
					AND a.EMP_NAME like concat('%',#{tDispatchInfo.empName},'%')
				</if>
				<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD like concat('%',#{tDispatchInfo.empIdcard},'%')
				</if>
				<if test="tDispatchInfo.status != null and tDispatchInfo.status.trim() != ''">
					AND a.STATUS = #{tDispatchInfo.status}
				</if>

				<if test="tDispatchInfo.settleDomain != null and tDispatchInfo.settleDomain.trim() != ''">
					AND a.SETTLE_DOMAIN = #{tDispatchInfo.settleDomain}
				</if>

				<if test="tDispatchInfo.settleDomainCode != null and tDispatchInfo.settleDomainCode.trim() != ''">
					AND a.SETTLE_DOMAIN_CODE = #{tDispatchInfo.settleDomainCode}
				</if>

				<if test="tDispatchInfo.socialHandleStatus != null and tDispatchInfo.socialHandleStatus.trim() != ''">
					AND a.SOCIAL_HANDLE_STATUS = #{tDispatchInfo.socialHandleStatus}
				</if>

				<if test="tDispatchInfo.createName != null and tDispatchInfo.createName.trim() != ''">
					AND a.CREATE_NAME = #{tDispatchInfo.createName}
				</if>

				<if test="tDispatchInfo.settleDomainName != null and tDispatchInfo.settleDomainName.trim() != ''">
					AND a.SETTLE_DOMAIN_NAME like CONCAT(CONCAT(#{tDispatchInfo.settleDomainName}), '%')
				</if>
				<if test="tDispatchInfo.belongUnitName != null and tDispatchInfo.belongUnitName.trim() != ''">
					AND a.BELONG_UNIT_NAME = #{tDispatchInfo.belongUnitName}
				</if>
				<if test="tDispatchInfo.createTimeEnd != null">
					AND a.CREATE_TIME <![CDATA[<=]]> #{tDispatchInfo.createTimeEnd}
				</if>
				<if test="tDispatchInfo.createTimeStart != null">
					AND a.CREATE_TIME <![CDATA[>=]]> #{tDispatchInfo.createTimeStart}
				</if>
				<if test="tDispatchInfo.auditTimeStart != null">
					AND a.AUDIT_TIME <![CDATA[>=]]> #{tDispatchInfo.auditTimeStart}
				</if>
				<if test="tDispatchInfo.auditTimeEnd != null">
					AND a.AUDIT_TIME <![CDATA[<=]]> #{tDispatchInfo.auditTimeEnd}
				</if>
				<if test="tDispatchInfo.auditUserName != null and tDispatchInfo.auditUserName.trim() != ''">
					AND a.AUDIT_USER_NAME like concat('%',#{tDispatchInfo.auditUserName},'%')
				</if>
				<if test="tDispatchInfo.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
					AND a.SOCIAL_HOUSEHOLD_NAME  like CONCAT(CONCAT(#{tDispatchInfo.socialHouseholdName}), '%')
				</if>
				<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
					${tDispatchInfo.authSql}
				</if>
				<if test="tDispatchInfo.exportSocialFlag != null and tDispatchInfo.exportSocialFlag.trim() != ''">
					AND a.EXPORT_SOCIAL_FLAG = ${tDispatchInfo.exportSocialFlag}
				</if>
			</if>
			<if test="idCards != null and idCards.size > 0">
				AND a.emp_idcard in
				<foreach item="items" index="index" collection="idCards" open="(" separator="," close=")">
					#{items}
				</foreach>
			</if>
			group by a.id
			order by a.APPLY_NO desc
		</where>
	</sql>

fangxinjiang's avatar
fangxinjiang committed
2139
	<sql id="where_getFundRecord">
huyuchen's avatar
huyuchen committed
2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158
		a.DELETE_FLAG = 0
		<if test="idsStr != null and idsStr.size > 0">
			AND a.ID in
			<foreach item="items" index="index" collection="idsStr" open="(" separator="," close=")">
				#{items}
			</foreach>
		</if>
		/** 社保办理状态:0待办理/1已办理2办理失败3已派减4 办理中 5 部分办理失败 派单社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败)  3 部分办理成功 4 办理中  **/
		/*社保代办理 1.派单审核通过 2.派增(type=0):待办理(social_handle_status='0')  or 派减(type=1):已办理完成或部分办理失败 且已派减*/
		AND a.fund_id is not null
		AND a.STATUS = "2"
		and (( a.type = '0' AND f.HANDLE_STATUS = '0') or ( a.type ='1'  AND f.HANDLE_STATUS = '1' and f.REDUCE_CAN = '1'))
		and a.FUND_HANDLE_STATUS='0'
		<!--<if test="tDispatchInfo.status != null and tDispatchInfo.status.trim() != ''">
			/*待办理组合判断*/
			<if test="'2'.toString() == tDispatchInfo.status.trim() and tDispatchInfo.typeSub != null ">
				/*社保代办理*/
				<if test=" '0'.toString()==tDispatchInfo.typeSub.trim() ">
					<if test="tDispatchInfo.socialHandleStatus != null and tDispatchInfo.socialHandleStatus != ''">
fangxinjiang's avatar
fangxinjiang committed
2159 2160

					</if>
huyuchen's avatar
huyuchen committed
2161 2162 2163
					<if test="tDispatchInfo.socialHandleStatus == null or tDispatchInfo.socialHandleStatus == ''">
						and (( a.type = '0' AND b.HANDLE_STATUS in ('0','4')) or ( a.type ='1'  AND b.HANDLE_STATUS in ('1','5')  and b.REDUCE_CAN = '1'))
						and a.SOCIAL_HANDLE_STATUS in ('0','4')
fangxinjiang's avatar
fangxinjiang committed
2164 2165
					</if>
				</if>
huyuchen's avatar
huyuchen committed
2166 2167 2168 2169 2170 2171 2172
				/* 公积金办理*/
				<if test=" '1'.toString()==tDispatchInfo.typeSub.trim() ">
					and (( a.type = '0' AND c.HANDLE_STATUS = '0') or ( a.type ='1'  AND c.HANDLE_STATUS = '1' and c.REDUCE_CAN = '1'))
					and a.FUND_HANDLE_STATUS='0'
				</if>
			</if>
		</if>-->
fangxinjiang's avatar
fangxinjiang committed
2173

2174

huyuchen's avatar
huyuchen committed
2175 2176 2177 2178 2179 2180 2181 2182 2183 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
		<if test="tDispatchInfo != null">
			<if test="tDispatchInfo.dispatchItems != null and tDispatchInfo.dispatchItems.size >0">
				AND
				<foreach item="item" index="index" collection="tDispatchInfo.dispatchItems" open="(" separator="or" close=")">
					INSTR(a.DISPATCH_ITEM,#{item})
				</foreach>
			</if>
			<if test="tDispatchInfo.empTypeList != null  and tDispatchInfo.empTypeList.length>0">
				AND a.EMP_TYPE IN
				<foreach collection="tDispatchInfo.empTypeList" item="item" index="index" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			<if test="tDispatchInfo.fundProvince != null and tDispatchInfo.fundProvince.trim() != ''">
				AND a.FUND_PROVINCE = #{tDispatchInfo.fundProvince}
			</if>
			<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
				AND a.TYPE = #{tDispatchInfo.type}
			</if>
			<if test="tDispatchInfo.fundCity != null and tDispatchInfo.fundCity.trim() != ''">
				AND a.FUND_CITY = #{tDispatchInfo.fundCity}
			</if>
			<if test="tDispatchInfo.fundTown != null and tDispatchInfo.fundTown.trim() != ''">
				AND a.FUND_TOWN = #{tDispatchInfo.fundTown}
			</if>
			<if test="tDispatchInfo.empName != null and tDispatchInfo.empName.trim() != ''">
				AND a.EMP_NAME like concat('%',#{tDispatchInfo.empName},'%')
			</if>
			<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
				AND a.EMP_IDCARD like concat('%',#{tDispatchInfo.empIdcard},'%')
			</if>
			<if test="tDispatchInfo.status != null and tDispatchInfo.status.trim() != ''">
				AND a.STATUS = #{tDispatchInfo.status}
			</if>
fangxinjiang's avatar
fangxinjiang committed
2209

huyuchen's avatar
huyuchen committed
2210 2211 2212
			<if test="tDispatchInfo.settleDomain != null and tDispatchInfo.settleDomain.trim() != ''">
				AND a.SETTLE_DOMAIN = #{tDispatchInfo.settleDomain}
			</if>
fangxinjiang's avatar
fangxinjiang committed
2213

huyuchen's avatar
huyuchen committed
2214 2215 2216
			<if test="tDispatchInfo.settleDomainCode != null and tDispatchInfo.settleDomainCode.trim() != ''">
				AND a.SETTLE_DOMAIN_CODE = #{tDispatchInfo.settleDomainCode}
			</if>
fangxinjiang's avatar
fangxinjiang committed
2217

huyuchen's avatar
huyuchen committed
2218 2219 2220
			<if test="tDispatchInfo.socialHandleStatus != null and tDispatchInfo.socialHandleStatus.trim() != ''">
				AND a.SOCIAL_HANDLE_STATUS = #{tDispatchInfo.socialHandleStatus}
			</if>
fangxinjiang's avatar
fangxinjiang committed
2221

huyuchen's avatar
huyuchen committed
2222 2223 2224
			<if test="tDispatchInfo.createName != null and tDispatchInfo.createName.trim() != ''">
				AND a.CREATE_NAME = #{tDispatchInfo.createName}
			</if>
fangxinjiang's avatar
fangxinjiang committed
2225

huyuchen's avatar
huyuchen committed
2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254
			<if test="tDispatchInfo.settleDomainName != null and tDispatchInfo.settleDomainName.trim() != ''">
				AND a.SETTLE_DOMAIN_NAME like CONCAT(CONCAT(#{tDispatchInfo.settleDomainName}), '%')
			</if>
			<if test="tDispatchInfo.belongUnitName != null and tDispatchInfo.belongUnitName.trim() != ''">
				AND a.BELONG_UNIT_NAME = #{tDispatchInfo.belongUnitName}
			</if>
			<if test="tDispatchInfo.createTimeEnd != null">
				AND a.CREATE_TIME <![CDATA[<=]]> #{tDispatchInfo.createTimeEnd}
			</if>
			<if test="tDispatchInfo.createTimeStart != null">
				AND a.CREATE_TIME <![CDATA[>=]]> #{tDispatchInfo.createTimeStart}
			</if>
			<if test="tDispatchInfo.auditTimeStart != null">
				AND a.AUDIT_TIME <![CDATA[>=]]> #{tDispatchInfo.auditTimeStart}
			</if>
			<if test="tDispatchInfo.auditTimeEnd != null">
				AND a.AUDIT_TIME <![CDATA[<=]]> #{tDispatchInfo.auditTimeEnd}
			</if>
			<if test="tDispatchInfo.auditUserName != null and tDispatchInfo.auditUserName.trim() != ''">
				AND a.AUDIT_USER_NAME like concat('%',#{tDispatchInfo.auditUserName},'%')
			</if>
			<if test="tDispatchInfo.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
				AND a.PROVIDENT_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.providentHouseholdName}), '%')
			</if>
			<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
				${tDispatchInfo.authSql}
			</if>
			<if test="tDispatchInfo.exportFundFlag != null and tDispatchInfo.exportFundFlag.trim() != ''">
				AND a.EXPORT_FUND_FLAG = ${tDispatchInfo.exportFundFlag}
fangxinjiang's avatar
fangxinjiang committed
2255
			</if>
huyuchen's avatar
huyuchen committed
2256
		</if>
fangxinjiang's avatar
fangxinjiang committed
2257
	</sql>
fangxinjiang's avatar
fangxinjiang committed
2258

huyuchen's avatar
huyuchen committed
2259 2260 2261
	<sql id="where_getSocialDisRecord">
		a.DELETE_FLAG = 0
		AND a.social_id is not null
huyuchen's avatar
huyuchen committed
2262

fangxinjiang's avatar
fangxinjiang committed
2263 2264 2265 2266 2267
		<if test="tDispatchInfo.socialId != null and tDispatchInfo.socialId.trim() != ''">
			AND a.SOCIAL_ID = #{tDispatchInfo.socialId}
		</if>
		<if test="tDispatchInfo.syFlag != null and tDispatchInfo.syFlag.trim() == '1'">
			AND a.STATUS = '2'
huyuchen's avatar
huyuchen committed
2268
		</if>
2269
		<!-- dispatch-status 未提交1待审核2审核通过3审核不通过4办理完成5待SSC审核 -->
fangxinjiang's avatar
fangxinjiang committed
2270
		<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "0" '>
2271 2272
			AND a.STATUS in ('2','4')
		</if>
fangxinjiang's avatar
fangxinjiang committed
2273
		<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "1" '>
fangxinjiang's avatar
fangxinjiang committed
2274
			AND a.STATUS in ('1','5')
2275
		</if>
huyuchen's avatar
huyuchen committed
2276
		AND a.DISPATCH_ITEM like concat('%','医疗','%')
huyuchen's avatar
huyuchen committed
2277 2278 2279 2280 2281 2282 2283 2284 2285 2286
		<if test="tDispatchInfo != null">
			<if test="tDispatchInfo.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
				AND a.SOCIAL_HOUSEHOLD_NAME = #{tDispatchInfo.socialHouseholdName}
			</if>
			<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
				AND a.TYPE = #{tDispatchInfo.type}
			</if>
			<if test="tDispatchInfo.disMonth != null and tDispatchInfo.disMonth.trim() != ''">
				AND replace(DATE_FORMAT(a.CREATE_TIME,"%Y-%m"),'-','') = #{tDispatchInfo.disMonth}
			</if>
huyuchen's avatar
huyuchen committed
2287
			<if test="tDispatchInfo.socialHandleStatus != null and tDispatchInfo.socialHandleStatus.trim() != '' and tDispatchInfo.socialHandleStatus != 1">
huyuchen's avatar
huyuchen committed
2288 2289
				AND a.SOCIAL_HANDLE_STATUS = #{tDispatchInfo.socialHandleStatus}
			</if>
huyuchen's avatar
huyuchen committed
2290 2291 2292
			<if test="tDispatchInfo.socialHandleStatus != null and tDispatchInfo.socialHandleStatus.trim() != '' and tDispatchInfo.socialHandleStatus == 1">
				AND a.SOCIAL_HANDLE_STATUS in ('1','3')
			</if>
huyuchen's avatar
huyuchen committed
2293 2294 2295 2296 2297 2298
			<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
				${tDispatchInfo.authSql}
			</if>
		</if>
	</sql>

2299 2300 2301 2302 2303
	<sql id="where_getFundDisRecord">
		a.DELETE_FLAG = 0
		AND a.fund_id is not null
		AND a.DISPATCH_ITEM like concat('%','公积金','%')
		<if test="tDispatchInfo != null">
2304 2305 2306 2307 2308 2309 2310
			<!-- dispatch-status 未提交1待审核2审核通过3审核不通过4办理完成5待SSC审核 -->
			<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "0" '>
				AND a.STATUS in ('2','4')
			</if>
			<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "1" '>
				AND a.STATUS in ('1','5')
			</if>
2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327
			<if test="tDispatchInfo.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
				AND a.PROVIDENT_HOUSEHOLD_NAME = #{tDispatchInfo.providentHouseholdName}
			</if>
			<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
				AND a.TYPE = #{tDispatchInfo.type}
			</if>
			<if test="tDispatchInfo.disMonth != null and tDispatchInfo.disMonth.trim() != ''">
				AND replace(DATE_FORMAT(a.CREATE_TIME,"%Y-%m"),'-','') = #{tDispatchInfo.disMonth}
			</if>
			<if test="tDispatchInfo.fundHandleStatus != null and tDispatchInfo.fundHandleStatus.trim() != ''">
				AND a.FUND_HANDLE_STATUS = #{tDispatchInfo.fundHandleStatus}
			</if>
			<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
				${tDispatchInfo.authSql}
			</if>
		</if>

2328 2329 2330 2331
	</sql>
	<sql id="where_getFund">
		a.DELETE_FLAG = 0
		AND a.fund_id is not null
2332
		AND ((PERIOD_DIFF(#{tDispatchInfo.disMonth},REPLACE ( DATE_FORMAT( s.PROVIDENT_START, "%Y-%m" ), '-', '' )))+1) >0
2333
		AND a.DISPATCH_ITEM like concat('%','公积金','%')
2334
		AND a.Type=0
2335
		<if test="tDispatchInfo != null">
2336 2337 2338 2339 2340 2341 2342
			<!-- dispatch-status 未提交1待审核2审核通过3审核不通过4办理完成5待SSC审核 -->
			<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "0" '>
				AND a.STATUS in ('2','4')
			</if>
			<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "1" '>
				AND a.STATUS in ('1','5')
			</if>
2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359
			<if test="tDispatchInfo.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
				AND a.PROVIDENT_HOUSEHOLD_NAME = #{tDispatchInfo.providentHouseholdName}
			</if>
			<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
				AND a.TYPE = #{tDispatchInfo.type}
			</if>
			<if test="tDispatchInfo.disMonth != null and tDispatchInfo.disMonth.trim() != ''">
				AND replace(DATE_FORMAT(a.CREATE_TIME,"%Y-%m"),'-','') = #{tDispatchInfo.disMonth}
			</if>
			<if test="tDispatchInfo.fundHandleStatus != null and tDispatchInfo.fundHandleStatus.trim() != ''">
				AND a.FUND_HANDLE_STATUS = #{tDispatchInfo.fundHandleStatus}
			</if>
			<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
				${tDispatchInfo.authSql}
			</if>
		</if>

2360 2361
	</sql>

huyuchen's avatar
huyuchen committed
2362 2363 2364
	<sql id="where_getSocialPersionDisRecord">
		a.DELETE_FLAG = 0
		AND a.social_id is not null
fangxinjiang's avatar
fangxinjiang committed
2365 2366
		<if test="tDispatchInfo.socialId != null and tDispatchInfo.socialId.trim() != ''">
			AND a.SOCIAL_ID = #{tDispatchInfo.socialId}
huyuchen's avatar
huyuchen committed
2367
		</if>
fangxinjiang's avatar
fangxinjiang committed
2368 2369 2370 2371
		<if test="tDispatchInfo.syFlag != null and tDispatchInfo.syFlag.trim() == '1'">
			AND a.STATUS = '2'
		</if>

2372
		<!-- dispatch-status 未提交1待审核2审核通过3审核不通过4办理完成5待SSC审核 -->
fangxinjiang's avatar
fangxinjiang committed
2373
		<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "0"'>
2374 2375
			AND a.STATUS in ('2','4')
		</if>
fangxinjiang's avatar
fangxinjiang committed
2376
		<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "1"'>
fangxinjiang's avatar
fangxinjiang committed
2377
			AND a.STATUS in ('1','5')
2378 2379
		</if>

huyuchen's avatar
huyuchen committed
2380
		AND (a.DISPATCH_ITEM like concat('%','工伤','%') or a.DISPATCH_ITEM like concat('%','养老','%') or a.DISPATCH_ITEM like concat('%','失业','%'))
huyuchen's avatar
huyuchen committed
2381 2382 2383 2384 2385 2386 2387 2388 2389 2390
		<if test="tDispatchInfo != null">
			<if test="tDispatchInfo.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
				AND a.SOCIAL_HOUSEHOLD_NAME = #{tDispatchInfo.socialHouseholdName}
			</if>
			<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
				AND a.TYPE = #{tDispatchInfo.type}
			</if>
			<if test="tDispatchInfo.disMonth != null and tDispatchInfo.disMonth.trim() != ''">
				AND replace(DATE_FORMAT(a.CREATE_TIME,"%Y-%m"),'-','') = #{tDispatchInfo.disMonth}
			</if>
huyuchen's avatar
huyuchen committed
2391
			<if test="tDispatchInfo.socialHandleStatus != null and tDispatchInfo.socialHandleStatus.trim() != '' and tDispatchInfo.socialHandleStatus != 1">
huyuchen's avatar
huyuchen committed
2392 2393
				AND a.SOCIAL_HANDLE_STATUS = #{tDispatchInfo.socialHandleStatus}
			</if>
huyuchen's avatar
huyuchen committed
2394 2395 2396
			<if test="tDispatchInfo.socialHandleStatus != null and tDispatchInfo.socialHandleStatus.trim() != '' and tDispatchInfo.socialHandleStatus == 1">
				AND a.SOCIAL_HANDLE_STATUS in ('1','3')
			</if>
huyuchen's avatar
huyuchen committed
2397 2398 2399 2400 2401 2402 2403
			<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
				${tDispatchInfo.authSql}
			</if>
		</if>
	</sql>


fangxinjiang's avatar
fangxinjiang committed
2404 2405 2406 2407
	<!-- 获取当日最大的编码 -->
	<select id="getMaxDispatchCode" resultType="java.lang.String">
		SELECT ifnull(max(right(e.APPLY_NO,4)),0) APPLY_NO FROM t_dispatch_info e where e.DELETE_FLAG = 0 and e.CREATE_TIME>DATE_FORMAT(now(),'%Y-%m-%d')
	</select>
2408 2409

	<update id="updateExportSocialFlagById">
huyuchen's avatar
huyuchen committed
2410
		update  t_dispatch_info a set a.EXPORT_SOCIAL_FLAG = #{status} WHERE a.id = #{id}
2411 2412
	</update>
	<update id="updateExportFundFlagById">
2413
		update  t_dispatch_info a set a.EXPORT_FUND_FLAG = #{status} WHERE a.id = #{id}
2414
	</update>
2415 2416 2417 2418

	<!--tDispatchInfo 社保医疗花名册派单数据-->
	<select id="getFundPersionExportVo" resultMap="FundExport">
		SELECT
2419 2420 2421 2422 2423 2424 2425 2426 2427 2428
		(@i :=@i+1) as NUM,
		a.EMP_NAME,
		a.EMP_IDCARD,
		s.UNIT_PROVIDENG_CARDINAL AS DEPOSIT_BASE ,
		IF(a.TYPE=0 ,s.UNIT_PROVIDENT_FEE*2,NULL) as  MOTHLY_INCREASE,
		IF(a.TYPE=1 ,s.UNIT_PROVIDENT_FEE*2,NULL) as  MOTHLY_DECREASE,
		case when a.TYPE=0 then "新增"
		else "减少" end as CAUSE_CHANGE
		FROM t_dispatch_info a
		left join t_provident_fund s on s.id=a.FUND_ID
2429 2430 2431
		<where>
			<include refid="where_getFundDisRecord"/>
		</where>
2432 2433 2434
		ORDER BY
		a.TYPE

2435 2436 2437 2438 2439 2440
	</select>

	<!--tDispatchInfo 社保医疗花名册派单数据-->
	<select id="getFundSupplementarynExportVo" resultMap="FundSupplementaryExport">

		SELECT
2441
		( @i := @i + 1 ) AS NUM,
2442 2443
		a.EMP_NAME,
		a.EMP_IDCARD,
2444 2445 2446
		s.UNIT_PROVIDENG_CARDINAL AS DEPOSIT_BASE,
		REPLACE ( DATE_FORMAT( s.PROVIDENT_START, "%Y-%m" ), '-', '' ) AS ORIGINATE,
		#{tDispatchInfo.disMonth} AS END,
2447
		ROUND(((PERIOD_DIFF(#{tDispatchInfo.disMonth},REPLACE ( DATE_FORMAT( s.PROVIDENT_START, "%Y-%m" ), '-', '' )))+1)*s.UNIT_PROVIDENT_FEE*2 ) AS SUPPLEMENTART_AMOUNT
2448 2449 2450 2451 2452 2453
		FROM
		t_dispatch_info a
		LEFT JOIN t_provident_fund s ON s.id = a.FUND_ID,(
		SELECT
		@i := 0
		) AS itable
2454
		<where>
2455
			<include refid="where_getFund"/>
2456 2457 2458 2459
		</where>
	</select>
	<select id="getFundSumExportVo" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchFundSumExportVo">
		SELECT
2460 2461 2462 2463 2464 2465 2466 2467 2468 2469
		sum(h.NUM_ONE) as NUM_ONE,
		sum(h.NUM_TWO) as NUM_TWO,
		sum(h.MONENY_ONE) AS MONENY_ONE ,
		sum(h.MONENY_TWO)  AS MONENY_TWO
		FROM(
		SELECT
		IF(a.TYPE=1, 1,0) as NUM_ONE ,
		IF(a.TYPE=0, 1,0) as NUM_TWO,
		SUM(IF(a.TYPE=0 ,s.UNIT_PROVIDENT_FEE*2,NULL)) AS MONENY_ONE ,
		SUM(IF(a.TYPE=1 ,s.UNIT_PROVIDENT_FEE*2,NULL)) AS MONENY_TWO
2470 2471 2472 2473 2474
		FROM t_dispatch_info a
		left join t_provident_fund s on s.id=a.FUND_ID
		<where>
			<include refid="where_getFundDisRecord"/>
		</where>
2475 2476 2477 2478 2479 2480
		GROUP BY
		a.EMP_IDCARD,
		a.TYPE
		ORDER BY
		a.TYPE
		)h, (select @i:=0) as itable
2481 2482
	</select>
	<select id="getFundSumExportVoOne" resultMap="FundSupplementary">
2483
		SELECT
2484
		count(a.EMP_IDCARD) as NUMBER,
2485
		SUM(ROUND(((PERIOD_DIFF(#{tDispatchInfo.disMonth},REPLACE ( DATE_FORMAT( s.PROVIDENT_START, "%Y-%m" ), '-', '' )))+1)*s.UNIT_PROVIDENT_FEE*2 ))  AS SUPPLEMENTART_AMOUNT_SUM
2486
		FROM t_dispatch_info a
huyuchen's avatar
huyuchen committed
2487
		left join t_provident_fund s on s.id = a.FUND_ID
2488
		<where>
2489
			<include refid="where_getFund"/>
2490 2491 2492 2493 2494
		</where>
	</select>

	<select id="getFundPersionExportVoOne" resultMap="CompanyProVo">
		SELECT
huyuchen's avatar
huyuchen committed
2495
			F.COMPANY_PRO AS COMPANY_PRO
2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508
		FROM `sys_house_hold_info` A
				 LEFT JOIN sys_area B ON A.PROVINCE = B.ID
				 LEFT JOIN sys_area C ON A.CITY = C.ID
				 LEFT JOIN sys_area D ON A.TOWN = D.ID
				 LEFT JOIN sys_base_set_info E ON A.ID = E.DEPART_ID
				 LEFT JOIN sys_pay_proportion F ON E.ID = F.SYS_BASE_SET_ID
		WHERE A.TYPE = '1' AND A.`NAME` IN  (#{houseName})
		GROUP BY A.`NAME`
	</select>


	<select id="getFundSumExportVoTwo" resultMap="HouseNameConfigVo">
		SELECT
huyuchen's avatar
huyuchen committed
2509 2510 2511
			A.CUSTOMER_NO,
			A.FUND_BANK,
			F.COMPANY_PRO AS COMPANY_PRO
2512
		FROM
huyuchen's avatar
huyuchen committed
2513 2514 2515 2516 2517 2518
			`sys_house_hold_info` A
				LEFT JOIN sys_area B ON A.PROVINCE = B.ID
				LEFT JOIN sys_area C ON A.CITY = C.ID
				LEFT JOIN sys_area D ON A.TOWN = D.ID
				LEFT JOIN sys_base_set_info E ON A.ID = E.DEPART_ID
				LEFT JOIN sys_pay_proportion F ON E.ID = F.SYS_BASE_SET_ID
2519
		WHERE
huyuchen's avatar
huyuchen committed
2520 2521 2522 2523 2524 2525 2526 2527
			A.TYPE = '1'
		  AND A.`NAME` IN (#{houseName})
		  AND E.`STATUS` = '0'
		  AND
				(PERIOD_DIFF(#{tDispatchInfo.disMonth},REPLACE ( DATE_FORMAT( E.APPLY_START_DATE , "%Y-%m" ), '-', '' )))>0
		  and
			((PERIOD_DIFF(#{tDispatchInfo.disMonth},REPLACE ( DATE_FORMAT( E.APPLY_END_DATE , "%Y-%m" ), '-', '' ))) <![CDATA[ < ]]>0
				OR ( APPLY_END_DATE IS NULL OR APPLY_END_DATE = '' ))
2528
		GROUP BY A.`NAME`
2529
	</select>
2530 2531 2532 2533 2534 2535
	<resultMap id="autoFlagMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.AutoFlagVo">
		<result property="dispatchId" column="dispatchId"/>
		<result property="autoFlag" column="autoFlag"/>
	</resultMap>
	<select id="getAutoFlag" resultMap="autoFlagMap">
		select a.id as "dispatchId",
huyuchen's avatar
huyuchen committed
2536
		b.AUTO_STATUS as 'autoFlag'
2537 2538 2539 2540 2541
		FROM  t_dispatch_info a
		LEFT JOIN sys_house_hold_info b  on a.SOCIAL_HOUSEHOLD_NAME=b.`NAME` and b.TYPE='0'
		where a.SOCIAL_HOUSEHOLD_NAME is not null
		and a.id in
		<foreach item="item" index="index" collection="idsList" open="(" separator="," close=")">
2542
			#{item}
2543 2544
		</foreach>
	</select>
fangxinjiang's avatar
fangxinjiang committed
2545
</mapper>