TDispatchInfoMapper.xml 58.2 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

fangxinjiang's avatar
fangxinjiang committed
26
  <resultMap id="tDispatchInfoMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TDispatchInfo">
fangxinjiang's avatar
fangxinjiang committed
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
    <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"/>
fangxinjiang's avatar
fangxinjiang committed
75
	  <result property="auditUserName" column="AUDIT_USER_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
76 77 78 79 80 81 82 83 84
    <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"/>
fangxinjiang's avatar
fangxinjiang committed
85
	<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
fangxinjiang's avatar
fangxinjiang committed
86
    <result property="belongUnitName" column="BELONG_UNIT_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
87 88
	<result property="dispatchCode" column="DISPATCH_CODE"/>
	<result property="contractSubName" column="CONTRACT_SUB_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
89 90 91 92 93 94 95 96
	<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"/>
fangxinjiang's avatar
fangxinjiang committed
97
	<result property="applyNo" column="APPLY_NO"/>
98 99 100
	<result property="createTime" column="CREATE_TIME"/>
	<result property="orderId" column="ORDER_ID"/>

fangxinjiang's avatar
fangxinjiang committed
101
  </resultMap>
fangxinjiang's avatar
fangxinjiang committed
102 103 104 105
	<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"/>
	</resultMap>
106 107 108 109 110 111 112 113 114 115 116
	<!-- 派单导出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"/>
117 118 119 120 121
		<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
122
		<result property="fundReduceDate" column="FUND_REDUCE_DATE"/>
123
		<result property="bigailmentHandle" column="BIGAILMENT_HANDLE"/>
124 125 126 127
		<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
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
		<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"/>
162 163
	</resultMap>

fangxinjiang's avatar
fangxinjiang committed
164 165 166 167 168 169 170 171 172 173
	<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>
174

huyuchen's avatar
huyuchen committed
175 176 177 178 179 180
	<!-- 派单审核导出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
181 182 183
		<result property="empMobile" column="EMP_MOBILE"/>
		<result property="idCardAddress" column="ID_CARD_ADDRESS"/>

huyuchen's avatar
huyuchen committed
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
		<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
211
		<result property="socialStartDate" column="SOCIAL_START_DATE"/>
huyuchen's avatar
huyuchen committed
212

huyuchen's avatar
huyuchen committed
213
		<result property="providentStart" column="PROVIDENT_START"/>
huyuchen's avatar
huyuchen committed
214 215 216 217 218 219
		<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"/>
	</resultMap>

fangxinjiang's avatar
fangxinjiang committed
220
    <sql id="Base_Column_List">
fangxinjiang's avatar
fangxinjiang committed
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
		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
270
		a.AUDIT_USER_NAME,
fangxinjiang's avatar
fangxinjiang committed
271 272 273 274 275
		a.AUDIT_TIME,
		a.WORKING_HOURS,
		a.CREATE_BY,
		a.UPDATE_BY,
		a.CREATE_NAME,
hongguangwu's avatar
hongguangwu committed
276
		a.CREATE_TIME,
fangxinjiang's avatar
fangxinjiang committed
277 278 279 280 281 282 283
		a.UPDATE_TIME,
		a.ORGAN_NAME,
		a.DISPATCH_ITEM,
		a.SETTLE_DOMAIN_NAME,
		a.BELONG_UNIT_NAME,
		a.DISPATCH_CODE,
		a.SETTLE_DOMAIN_CODE,
284
		a.CONTRACT_SUB_NAME,
fangxinjiang's avatar
fangxinjiang committed
285 286 287 288 289 290
		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
291
		a.ID_CARD_ADDRESS,
292 293
		a.APPLY_NO,
		a.ORDER_ID
fangxinjiang's avatar
fangxinjiang committed
294 295 296
    </sql>
    <sql id="tDispatchInfo_where">
        <if test="tDispatchInfo != null">
fangxinjiang's avatar
fangxinjiang committed
297 298 299
					<if test="tDispatchInfo.dispatchItems != null and tDispatchInfo.dispatchItems.size >0">
						AND
						<foreach item="item" index="index" collection="tDispatchInfo.dispatchItems" open="(" separator="or" close=")">
300
							 INSTR(a.DISPATCH_ITEM,#{item})
fangxinjiang's avatar
fangxinjiang committed
301 302
						</foreach>
					</if>
fangxinjiang's avatar
fangxinjiang committed
303
					<if test="tDispatchInfo.idList != null and tDispatchInfo.idList.size >0">
304 305 306 307 308
						AND a.ID in
						<foreach item="idStr" index="index" collection="tDispatchInfo.idList" open="(" separator="," close=")">
							#{idStr}
						</foreach>
					</if>
fangxinjiang's avatar
fangxinjiang committed
309 310 311
                    <if test="tDispatchInfo.id != null and tDispatchInfo.id.trim() != ''">
                        AND a.ID = #{tDispatchInfo.id}
                    </if>
312 313 314
					<if test="tDispatchInfo.orderId != null and tDispatchInfo.orderId.trim() != ''">
						AND a.ORDER_ID = #{tDispatchInfo.orderId}
					</if>
fangxinjiang's avatar
fangxinjiang committed
315 316 317 318
                    <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() != ''">
319
                        AND a.EMP_NAME like concat('%',#{tDispatchInfo.empName},'%')
fangxinjiang's avatar
fangxinjiang committed
320 321 322 323 324
                    </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() != ''">
325
                        AND a.EMP_IDCARD like concat('%',#{tDispatchInfo.empIdcard},'%')
fangxinjiang's avatar
fangxinjiang committed
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
                    </if>
                    <if test="tDispatchInfo.empType != null and tDispatchInfo.empType.trim() != ''">
                        AND a.EMP_TYPE = #{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>
fangxinjiang's avatar
fangxinjiang committed
357
					<if test="tDispatchInfo.settleDomainName != null and tDispatchInfo.settleDomainName.trim() != ''">
hongguangwu's avatar
hongguangwu committed
358
						AND a.SETTLE_DOMAIN_NAME like CONCAT(#{tDispatchInfo.settleDomainName}, '%')
fangxinjiang's avatar
fangxinjiang committed
359 360 361 362 363
					</if>
					<if test="tDispatchInfo.settleDomainCode != null and tDispatchInfo.settleDomainCode.trim() != ''">
						AND a.SETTLE_DOMAIN_CODE = #{tDispatchInfo.settleDomainCode}
					</if>

fangxinjiang's avatar
fangxinjiang committed
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 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
                    <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>
fangxinjiang's avatar
fangxinjiang committed
463 464 465
					<if test="tDispatchInfo.auditUserName != null and tDispatchInfo.auditUserName.trim() != ''">
						AND a.AUDIT_USER_NAME like concat('%',#{tDispatchInfo.auditUserName},'%')
					</if>
fangxinjiang's avatar
fangxinjiang committed
466 467 468
                    <if test="tDispatchInfo.auditTime != null">
                        AND a.AUDIT_TIME = #{tDispatchInfo.auditTime}
                    </if>
fangxinjiang's avatar
fangxinjiang committed
469 470 471 472 473 474 475
					<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
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
                    <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>
fangxinjiang's avatar
fangxinjiang committed
497

hongguangwu's avatar
hongguangwu committed
498
					<if test="tDispatchInfo.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
499
						AND a.SOCIAL_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.socialHouseholdName}), '%')
fangxinjiang's avatar
fangxinjiang committed
500
					</if>
hongguangwu's avatar
hongguangwu committed
501
					<if test="tDispatchInfo.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
502
						AND a.PROVIDENT_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.providentHouseholdName}), '%')
fangxinjiang's avatar
fangxinjiang committed
503
					</if>
fangxinjiang's avatar
fangxinjiang committed
504
					<if test="tDispatchInfo.createTimeStart != null">
hongguangwu's avatar
hongguangwu committed
505 506
						AND a.CREATE_TIME <![CDATA[ >= ]]> #{tDispatchInfo.createTimeStart}
					</if>
fangxinjiang's avatar
fangxinjiang committed
507
					<if test="tDispatchInfo.createTimeEnd != null">
hongguangwu's avatar
hongguangwu committed
508 509
						AND a.CREATE_TIME <![CDATA[ <= ]]> #{tDispatchInfo.createTimeEnd}
					</if>
huyuchen's avatar
huyuchen committed
510 511 512
					<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
						${tDispatchInfo.authSql}
					</if>
fangxinjiang's avatar
fangxinjiang committed
513
		</if>
fangxinjiang's avatar
fangxinjiang committed
514
    </sql>
huyuchen's avatar
huyuchen committed
515 516 517

	<sql id="tDispatchInfoAudit_where">
		<if test="tDispatchInfo != null">
518 519 520 521 522 523
			<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>
huyuchen's avatar
huyuchen committed
524 525 526 527 528 529 530
			<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.empName != null and tDispatchInfo.empName.trim() != ''">
531
				AND a.EMP_NAME like concat('%',#{tDispatchInfo.empName},'%')
huyuchen's avatar
huyuchen committed
532 533
			</if>
			<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
534
				AND a.EMP_IDCARD like concat('%',#{tDispatchInfo.empIdcard},'%')
huyuchen's avatar
huyuchen committed
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
			</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
564
				AND a.SOCIAL_HOUSEHOLD_NAME like CONCAT(#{tDispatchInfo.settleDomainName}, '%')
huyuchen's avatar
huyuchen committed
565 566
			</if>
			<if test="tDispatchInfo.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
huyuchen's avatar
huyuchen committed
567
				AND a.PROVIDENT_HOUSEHOLD_NAME like CONCAT(#{tDispatchInfo.providentHouseholdName}, '%')
huyuchen's avatar
huyuchen committed
568 569 570 571 572 573 574 575 576 577 578 579 580
			</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>
	</sql>

fangxinjiang's avatar
fangxinjiang committed
581
    <!--tDispatchInfo简单分页查询-->
fangxinjiang's avatar
fangxinjiang committed
582
    <select id="getTDispatchInfoPage" resultMap="dispatchPageMap">
fangxinjiang's avatar
fangxinjiang committed
583
        SELECT
fangxinjiang's avatar
fangxinjiang committed
584
        <include refid="Base_Column_List"/>,
fangxinjiang's avatar
fangxinjiang committed
585 586
               a.SOCIAL_HOUSEHOLD_NAME,
               a.PROVIDENT_HOUSEHOLD_NAME
fangxinjiang's avatar
fangxinjiang committed
587 588
        FROM t_dispatch_info a
        <where>
fangxinjiang's avatar
fangxinjiang committed
589 590 591
			1=1
			<include refid="tDispatchInfo_where"/>
		</where>
fangxinjiang's avatar
fangxinjiang committed
592
		order by a.APPLY_NO desc
593 594
    </select>

huyuchen's avatar
huyuchen committed
595 596 597 598 599 600 601 602 603 604 605 606
	<!--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
607
		order by a.APPLY_NO desc
huyuchen's avatar
huyuchen committed
608 609
	</select>

610 611 612
	<!-- 派单导出 -->
    <select id="exportDispatch" resultMap="exportMap">
		select
613 614 615 616 617 618 619 620 621
		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,
622 623 624
		case when s.HANDLE_STATUS = 0 then "派增待办理"
		when s.HANDLE_STATUS = 1 then "派增办理成功"
		when s.HANDLE_STATUS = 2 then "派增办理失败"
625
		when s.HANDLE_STATUS = 3 then "已派减"
626 627
		when s.HANDLE_STATUS = 4 then "派增办理中"
		when s.HANDLE_STATUS = 5 then "派增部分办理失败"
628 629
		when s.HANDLE_STATUS = 6 then "派减办理中"
		when s.HANDLE_STATUS = 7 then "派减部分办理失败"
630 631
		else null  end as "SOCIAL_HANDLE_STATUS",
		IF(a.TYPE='0',
632 633 634
		case when s.PENSION_HANDLE = 0 then "派增待办理"
		when s.PENSION_HANDLE = 1 then "派增办理成功"
		when s.PENSION_HANDLE = 2 then "派增办理失败"
635
		when s.PENSION_HANDLE = 3 then "已派减"
636
		when s.PENSION_HANDLE = 4 then "派减失败"
637
		when s.PENSION_HANDLE = 5 then "派减待办理"
638
		else null  end,
639
		IF(a.TYPE='1',
640 641 642
		case when s.PENSION_HANDLE = 0 then "派增待办理"
		when s.PENSION_HANDLE = 1 then "派增办理成功"
		when s.PENSION_HANDLE = 2 then "派增办理失败"
643 644
		when s.PENSION_HANDLE = 3 then "已派减"
		when s.PENSION_HANDLE = 4 then "派减失败"
645
		when s.PENSION_HANDLE = 5 then "派减待办理"
646
		else null  end,""
647 648 649
		))
		as PENSION_HANDLE,
		IF(a.TYPE='0',
650 651 652
		case when s.MEDICAL_HANDLE = 0 then "派增待办理"
		when s.MEDICAL_HANDLE = 1 then "派增办理成功"
		when s.MEDICAL_HANDLE = 2 then "派增办理失败"
653
		when s.MEDICAL_HANDLE = 3 then "已派减"
654
		when s.MEDICAL_HANDLE = 4 then "派减失败"
655
		when s.MEDICAL_HANDLE = 5 then "派减待办理"
656
		else null  end,
657
		IF(a.TYPE='1',
658 659 660
		case when s.MEDICAL_HANDLE = 0 then "派增待办理"
		when s.MEDICAL_HANDLE = 1 then "派增办理成功"
		when s.MEDICAL_HANDLE = 2 then "派增办理失败"
661 662
		when s.MEDICAL_HANDLE = 3 then "已派减"
		when s.MEDICAL_HANDLE = 4 then "派减失败"
663
		when s.MEDICAL_HANDLE = 5 then "派减待办理"
664
		else null  end,""
665 666 667
		))
		as MEDICAL_HANDLE,
		IF(a.TYPE='0',
668 669 670
		case when s.UNEMPLOY_HANDLE = 0 then "派增待办理"
		when s.UNEMPLOY_HANDLE = 1 then "派增办理成功"
		when s.UNEMPLOY_HANDLE = 2 then "派增办理失败"
671
		when s.UNEMPLOY_HANDLE = 3 then "已派减"
672
		when s.UNEMPLOY_HANDLE = 4 then "派减失败"
673
		when s.UNEMPLOY_HANDLE = 5 then "派减待办理"
674
		else null  end,
675
		IF(a.TYPE='1',
676 677 678
		case when s.UNEMPLOY_HANDLE = 0 then "派增待办理"
		when s.UNEMPLOY_HANDLE = 1 then "派增办理成功"
		when s.UNEMPLOY_HANDLE = 2 then "派增办理失败"
679 680
		when s.UNEMPLOY_HANDLE = 3 then "已派减"
		when s.UNEMPLOY_HANDLE = 4 then "派减失败"
681
		when s.UNEMPLOY_HANDLE = 5 then "派减待办理"
682
		else null  end,""
683 684 685
		))
		as UNEMPLOY_HANDLE,
		IF(a.TYPE='0',
686 687 688
		case when s.WORK_INJURY_HANDLE = 0 then "派增待办理"
		when s.WORK_INJURY_HANDLE = 1 then "派增办理成功"
		when s.WORK_INJURY_HANDLE = 2 then "派增办理失败"
689
		when s.WORK_INJURY_HANDLE = 3 then "已派减"
690
		when s.WORK_INJURY_HANDLE = 4 then "派减失败"
691
		when s.WORK_INJURY_HANDLE = 5 then "派减待办理"
692
		else null  end,
693
		IF(a.TYPE='1',
694 695 696
		case when s.WORK_INJURY_HANDLE = 0 then "派增待办理"
		when s.WORK_INJURY_HANDLE = 1 then "派增办理成功"
		when s.WORK_INJURY_HANDLE = 2 then "派增办理失败"
697 698
		when s.WORK_INJURY_HANDLE = 3 then "已派减"
		when s.WORK_INJURY_HANDLE = 4 then "派减失败"
699
		when s.WORK_INJURY_HANDLE = 5 then "派减待办理"
700
		else null  end,""
701 702 703
		))
		as WORK_INJURY_HANDLE,
		IF(a.TYPE='0',
704 705 706
		case when s.BIRTH_HANDLE = 0 then "派增待办理"
		when s.BIRTH_HANDLE = 1 then "派增办理成功"
		when s.BIRTH_HANDLE = 2 then "派增办理失败"
707
		when s.BIRTH_HANDLE = 3 then "已派减"
708
		when s.BIRTH_HANDLE = 4 then "派减失败"
709
		when s.BIRTH_HANDLE = 5 then "派减待办理"
710
		else null  end,
711
		IF(a.TYPE='1',
712 713 714
		case when s.BIRTH_HANDLE = 0 then "派增待办理"
		when s.BIRTH_HANDLE = 1 then "派增办理成功"
		when s.BIRTH_HANDLE = 2 then "派增办理失败"
715 716
		when s.BIRTH_HANDLE = 3 then "已派减"
		when s.BIRTH_HANDLE = 4 then "派减失败"
717
		when s.BIRTH_HANDLE = 5 then "派减待办理"
718
		else null  end,""
719 720 721
		))
		as BIRTH_HANDLE,
		IF(a.TYPE='0',
722 723 724
		case when s.BIGAILMENT_HANDLE = 0 then "派增待办理"
		when s.BIGAILMENT_HANDLE = 1 then "派增办理成功"
		when s.BIGAILMENT_HANDLE = 2 then "派增办理失败"
725
		when s.BIGAILMENT_HANDLE = 3 then "已派减"
726
		when s.BIGAILMENT_HANDLE = 4 then "派减失败"
727
		when s.BIGAILMENT_HANDLE = 5 then "派减待办理"
728
		else null  end,
729
		IF(a.TYPE='1',
730 731 732
		case when s.BIGAILMENT_HANDLE = 0 then "派增待办理"
		when s.BIGAILMENT_HANDLE = 1 then "派增办理成功"
		when s.BIGAILMENT_HANDLE = 2 then "派增办理失败"
733 734
		when s.BIGAILMENT_HANDLE = 3 then "已派减"
		when s.BIGAILMENT_HANDLE = 4 then "派减失败"
735
		when s.BIGAILMENT_HANDLE = 5 then "派减待办理"
736
		else null  end,""
737 738
		))
		as BIGAILMENT_HANDLE,
739 740 741
		case when a.FUND_HANDLE_STATUS = 0 then "派增待办理"
		when a.FUND_HANDLE_STATUS = 1 then "派增办理成功"
		when a.FUND_HANDLE_STATUS = 2 then "派增办理失败"
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775
		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 "已办结"
		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 "已办结"
		else null  end )
		) as FUND_AUDIT_STATUS,
776 777
		c.AUDIT_USER_NAME as FUND_AUDIT_USER,
		c.HANDLE_USER_NAME as FUND_HANDLE_USER,
778
		c.HANDLE_TIME as FUND_HANDLE_TIME,
779
		s.AUDIT_USER_NAME as AUDIT_USER_NAME,
780 781 782 783 784 785 786 787 788 789 790
		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 "已办结"
		else null  end )
		) as AUDIT_STATUS,
		s.SOCIAL_START_DATE,
		a.SOCIAL_REDUCE_DATE,
		s.RECORD_BASE,
huyuchen's avatar
huyuchen committed
791
		s.HANDLE_USER_NAME as HANDLE_USER,
792 793 794 795 796 797
		s.HANDLE_TIME,
		s.UNIT_PENSION_CARDINAL,
		s.UNIT_MEDICAL_CARDINAL,
		s.UNIT_UNEMPLOYMENT_CARDINAL,
		s.UNIT_BIGAILMENT_CARDINAL,
		s.UNIT_WORK_INJURY_CARDINAL,
798
		s.UNIT_BIRTH_CARDINAL,
799 800 801
		c.PROVIDENT_HOUSEHOLD_NAME,
		c.UNIT_PROVIDENG_CARDINAL,
		c.UNIT_PROVIDENT_PER
802

803 804
		from t_dispatch_info a
		left join t_social_info s on s.id=a.SOCIAL_ID
huyuchen's avatar
huyuchen committed
805
		left join t_provident_fund c on c.id=a.FUND_ID
806
        <where>
807
            a.DELETE_FLAG = '0'
808 809
            <include refid="tDispatchInfo_where"/>
        </where>
fangxinjiang's avatar
fangxinjiang committed
810
		order by a.APPLY_NO desc
hongguangwu's avatar
hongguangwu committed
811
		<if test="tDispatchInfo.limitStart != null">
812 813
			limit #{tDispatchInfo.limitStart},#{tDispatchInfo.limitEnd}
		</if>
fangxinjiang's avatar
fangxinjiang committed
814
    </select>
huyuchen's avatar
huyuchen committed
815 816 817 818 819 820

	<!-- 派单审核导出 -->
	<select id="exportAuditDispatch" resultMap="exportAuditMap">
		select
		a.EMP_NAME,
		a.EMP_IDCARD,
hongguangwu's avatar
hongguangwu committed
821 822
		a.EMP_MOBILE,
		a.ID_CARD_ADDRESS,
huyuchen's avatar
huyuchen committed
823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838
		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,
huyuchen's avatar
huyuchen committed
839
		b.SOCIAL_START_DATE,
huyuchen's avatar
huyuchen committed
840 841 842 843 844 845 846 847 848 849 850 851 852
		b.PAYMENT_TYPE,
		b.RECORD_BASE,
		b.UNIT_PENSION_CARDINAL,
		b.UNIT_MEDICAL_CARDINAL,
		b.UNIT_UNEMPLOYMENT_CARDINAL,
		b.UNIT_WORK_INJURY_CARDINAL,
		b.UNIT_BIRTH_CARDINAL,
		b.PERSONAL_PENSION_CARDINAL,
		b.PERSONAL_MEDICAL_CARDINAL,
		b.PERSONAL_UNEMPLOYMENT_CARDINAL,
		b.PERSONAL_BIGAILMENT_MONEY,
		b.UNIT_BIGAILMENT_MONEY,
		c.UNIT_PROVIDENG_CARDINAL,
huyuchen's avatar
huyuchen committed
853
		c.PROVIDENT_START,
huyuchen's avatar
huyuchen committed
854 855 856 857 858 859 860
		c.PERSONAL_PROVIDENT_CARDINAL,
		c.UNIT_PROVIDENT_PER,
		c.PERSONAL_PROVIDENT_PER
		from t_dispatch_info a
		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>
huyuchen's avatar
huyuchen committed
861 862
			a.DELETE_FLAG = '0' and a.STATUS = '1'
			<include refid="tDispatchInfoAudit_where"/>
huyuchen's avatar
huyuchen committed
863
		</where>
fangxinjiang's avatar
fangxinjiang committed
864
		order by a.APPLY_NO desc
huyuchen's avatar
huyuchen committed
865 866 867 868 869
		<if test="tDispatchInfo.limitStart != null">
			limit #{tDispatchInfo.limitStart},#{tDispatchInfo.limitEnd}
		</if>
	</select>

huyuchen's avatar
huyuchen committed
870 871 872 873 874 875 876 877 878 879
	<select id="selectExportCount" resultType="java.lang.Long">
		SELECT
		count(1)
		from t_dispatch_info a
		<where>
			a.DELETE_FLAG = '0' and a.STATUS = '1'
			<include refid="tDispatchInfoAudit_where"/>
		</where>
	</select>

fangxinjiang's avatar
fangxinjiang committed
880 881 882 883 884
	<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
885
		<result property="idCardAddress" column="ID_CARD_ADDRESS"/>
fangxinjiang's avatar
fangxinjiang committed
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901
		<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
902
		<result property="createUserName" column="CREATE_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932

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

	</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
933
		<result property="idCardAddress" column="ID_CARD_ADDRESS"/>
fangxinjiang's avatar
fangxinjiang committed
934
		<result property="createUserName" column="CREATE_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
935 936 937 938 939 940 941 942 943 944 945 946 947

		<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
948
		<result property="fundTrustRemark" column="TRUST_REMARK"/>
fangxinjiang's avatar
fangxinjiang committed
949 950 951 952 953 954 955

	</resultMap>
	<!--tDispatchInfo 社保花名册数据查询-->
	<select id="getSocialRecordRosterList" resultMap="socialHandleExportMap">
		SELECT
		a.TYPE,
		a.SOCIAL_HANDLE_STATUS,
956
		/*IF(a.TYPE='0',s.PENSION_HANDLE,IF(s.PENSION_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "PENSION_HANDLE",
huyuchen's avatar
huyuchen committed
957 958 959 960
		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",
961 962 963 964 965 966 967
		IF(a.TYPE='0',s.BIGAILMENT_HANDLE,IF(s.BIGAILMENT_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "BIGAILMENT_HANDLE",*/
		s.PENSION_HANDLE,
		s.MEDICAL_HANDLE,
		s.UNEMPLOY_HANDLE,
		s.WORK_INJURY_HANDLE,
		s.BIRTH_HANDLE,
		s.BIGAILMENT_HANDLE,
fangxinjiang's avatar
fangxinjiang committed
968 969 970 971 972 973 974 975
		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
976
		a.ID_CARD_ADDRESS,
fangxinjiang's avatar
fangxinjiang committed
977 978 979 980 981 982
		a.EMP_REGIS_TYPE,
		a.EMP_NATIONAL,
		a.WORKING_HOURS,
		a.CONTRACT_TERM,
		a.CONTRACT_START,
		a.CONTRACT_END,
fangxinjiang's avatar
fangxinjiang committed
983
		a.CREATE_NAME,
huyuchen's avatar
huyuchen committed
984 985
		s.RECORD_BASE,
		s.PAYMENT_TYPE,
fangxinjiang's avatar
fangxinjiang committed
986
		a.SOCIAL_HOUSEHOLD_NAME,
huyuchen's avatar
huyuchen committed
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003
		s.SOCIAL_PROVINCE,
		s.SOCIAL_CITY,
		s.SOCIAL_TOWN,
		s.PENSION_START,
		s.UNIT_PENSION_CARDINAL,
		s.MEDICAL_START,
		s.UNIT_MEDICAL_CARDINAL,
		s.UNEMPLOY_START,
		s.UNIT_UNEMPLOYMENT_CARDINAL,
		s.WORK_INJURY_START,
		s.UNIT_WORK_INJURY_CARDINAL,
		s.BIRTH_START,
		s.UNIT_BIRTH_CARDINAL,
		s.BIGAILMENT_START,
		s.UNIT_BIGAILMENT_CARDINAL,
		s.UNIT_BIGAILMENT_MONEY,
		s.PERSONAL_BIGAILMENT_MONEY,
hongguangwu's avatar
hongguangwu committed
1004
		a.TRUST_REMARK,
fangxinjiang's avatar
fangxinjiang committed
1005 1006 1007 1008 1009 1010 1011
		a.REDUCE_REASON
		<include refid="where_getSocialRecordRoster"/>
	</select>

	<!--tDispatchInfo 社保花名册数据查询count-->
	<select id="getSocialRecordRosterListCount" resultType="java.lang.Integer">
		SELECT
huyuchen's avatar
huyuchen committed
1012 1013 1014 1015 1016
		count(1) from
		(
		SELECT
		a.id
		<include refid="where_getSocialRecordRoster"/>) a
fangxinjiang's avatar
fangxinjiang committed
1017 1018 1019
	</select>

	<!--tDispatchInfo 社保办理数据查询-->
fangxinjiang's avatar
fangxinjiang committed
1020
	<select id="getTDispatchSocialHandlePage" resultMap="dispatchPageMap">
fangxinjiang's avatar
fangxinjiang committed
1021
		SELECT
fangxinjiang's avatar
fangxinjiang committed
1022
		<include refid="Base_Column_List"/>,
fangxinjiang's avatar
fangxinjiang committed
1023
		       a.SOCIAL_HOUSEHOLD_NAME
fangxinjiang's avatar
fangxinjiang committed
1024 1025 1026
		<include refid="where_getSocialRecordRoster"/>
	</select>
	<!--tDispatchInfo 公积金办理数据查询-->
fangxinjiang's avatar
fangxinjiang committed
1027
	<select id="getTDispatchFundHandlePage" resultMap="dispatchPageMap">
fangxinjiang's avatar
fangxinjiang committed
1028
		SELECT
fangxinjiang's avatar
fangxinjiang committed
1029
		<include refid="Base_Column_List"/>,
fangxinjiang's avatar
fangxinjiang committed
1030
		a.PROVIDENT_HOUSEHOLD_NAME
fangxinjiang's avatar
fangxinjiang committed
1031 1032 1033 1034 1035 1036
		<include refid="where_getFundRecord"/>
	</select>

	<!--tDispatchInfo 公积金变更清册cout-->
	<select id="getFundRecordCount" resultType="java.lang.Integer">
		SELECT
huyuchen's avatar
huyuchen committed
1037 1038 1039 1040
		count(1) from
		(SELECT
		a.id
		<include refid="where_getFundRecord"/>) a
fangxinjiang's avatar
fangxinjiang committed
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050
	</select>
	<!--tDispatchInfo 公积金变更清册查询-->
	<select id="getFundRecordList" resultMap="fundHandleMap">
		SELECT
		a.TYPE,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.BELONG_UNIT_NAME,
		a.SETTLE_DOMAIN_NAME,
		a.EMP_MOBILE,
hongguangwu's avatar
hongguangwu committed
1051
		a.ID_CARD_ADDRESS,
fangxinjiang's avatar
fangxinjiang committed
1052 1053
		a.CREATE_NAME,

fangxinjiang's avatar
fangxinjiang committed
1054
		a.PROVIDENT_HOUSEHOLD_NAME,
huyuchen's avatar
huyuchen committed
1055 1056 1057 1058 1059 1060 1061 1062 1063
		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.FUND_PROVINCE,
		f.FUND_CITY,
hongguangwu's avatar
hongguangwu committed
1064
		f.FUND_TOWN,
hongguangwu's avatar
hongguangwu committed
1065
		a.TRUST_REMARK
fangxinjiang's avatar
fangxinjiang committed
1066 1067 1068 1069 1070 1071
		<include refid="where_getFundRecord"/>
	</select>

	<!--tDispatchInfo 公积金补交清册-->
	<select id="getFundSupplementaryRecords" resultMap="fundSupplementaryMap">
		SELECT
huyuchen's avatar
huyuchen committed
1072 1073 1074 1075 1076 1077 1078 1079
		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
fangxinjiang's avatar
fangxinjiang committed
1080 1081 1082 1083
		<include refid="where_getFundRecord"/>
	</select>
	<sql id="where_getSocialRecordRoster">
		FROM t_dispatch_info a
huyuchen's avatar
huyuchen committed
1084
		left join t_social_info s on a.SOCIAL_ID = s.id
fangxinjiang's avatar
fangxinjiang committed
1085
		<where>
hongguangwu's avatar
hongguangwu committed
1086
			s.DELETE_FLAG = 0
fangxinjiang's avatar
fangxinjiang committed
1087
			<if test="idsStr != null and idsStr.size > 0">
fangxinjiang's avatar
fangxinjiang committed
1088 1089 1090 1091 1092 1093 1094 1095 1096
				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"
fangxinjiang's avatar
fangxinjiang committed
1097
			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'))
fangxinjiang's avatar
fangxinjiang committed
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121
			and a.SOCIAL_HANDLE_STATUS in ('0','4')

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

			<if test="tDispatchInfo != null">
1122 1123 1124 1125 1126 1127
				<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>
fangxinjiang's avatar
fangxinjiang committed
1128 1129 1130
				<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
					AND a.TYPE = #{tDispatchInfo.type}
				</if>
fangxinjiang's avatar
fangxinjiang committed
1131
				<if test="tDispatchInfo.socialProvince != null and tDispatchInfo.socialProvince!= null">
huyuchen's avatar
huyuchen committed
1132
					AND  s.social_province = #{tDispatchInfo.socialProvince}
fangxinjiang's avatar
fangxinjiang committed
1133
					<if test="tDispatchInfo.socialCity != null and tDispatchInfo.socialCity!= null">
huyuchen's avatar
huyuchen committed
1134
						AND  s.social_city = #{tDispatchInfo.socialCity}
fangxinjiang's avatar
fangxinjiang committed
1135 1136
					</if>
					<if test="tDispatchInfo.socialTown != null and tDispatchInfo.socialTown!= null">
huyuchen's avatar
huyuchen committed
1137
						AND  s.social_town = #{tDispatchInfo.socialTown}
fangxinjiang's avatar
fangxinjiang committed
1138 1139 1140
					</if>
				</if>
				<if test="tDispatchInfo.empName != null and tDispatchInfo.empName.trim() != ''">
1141
					AND a.EMP_NAME like concat('%',#{tDispatchInfo.empName},'%')
fangxinjiang's avatar
fangxinjiang committed
1142 1143
				</if>
				<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
1144
					AND a.EMP_IDCARD like concat('%',#{tDispatchInfo.empIdcard},'%')
fangxinjiang's avatar
fangxinjiang committed
1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166
				</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() != ''">
fangxinjiang's avatar
fangxinjiang committed
1167
					AND a.SETTLE_DOMAIN_NAME like CONCAT(CONCAT(#{tDispatchInfo.settleDomainName}), '%')
fangxinjiang's avatar
fangxinjiang committed
1168 1169 1170 1171 1172 1173 1174 1175 1176 1177
				</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>
fangxinjiang's avatar
fangxinjiang committed
1178 1179 1180 1181 1182 1183 1184 1185 1186
				<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>
fangxinjiang's avatar
fangxinjiang committed
1187
				<if test="tDispatchInfo.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
1188
					AND a.SOCIAL_HOUSEHOLD_NAME  like CONCAT(CONCAT(#{tDispatchInfo.socialHouseholdName}), '%')
huyuchen's avatar
huyuchen committed
1189 1190 1191
				</if>
				<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
					${tDispatchInfo.authSql}
fangxinjiang's avatar
fangxinjiang committed
1192 1193
				</if>
			</if>
huyuchen's avatar
huyuchen committed
1194
			group by a.id
fangxinjiang's avatar
fangxinjiang committed
1195
			order by a.APPLY_NO desc
fangxinjiang's avatar
fangxinjiang committed
1196 1197 1198 1199 1200
		</where>
	</sql>

	<sql id="where_getFundRecord">
		FROM t_dispatch_info a
huyuchen's avatar
huyuchen committed
1201
		left join t_provident_fund f on a.FUND_ID = f.id
fangxinjiang's avatar
fangxinjiang committed
1202
		<where>
hongguangwu's avatar
hongguangwu committed
1203
			a.DELETE_FLAG = 0
fangxinjiang's avatar
fangxinjiang committed
1204
			<if test="idsStr != null and idsStr.size > 0">
fangxinjiang's avatar
fangxinjiang committed
1205 1206 1207 1208 1209 1210 1211 1212 1213
				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"
huyuchen's avatar
huyuchen committed
1214
			and (( a.type = '0' AND f.HANDLE_STATUS = '0') or ( a.type ='1'  AND f.HANDLE_STATUS = '1' and f.REDUCE_CAN = '1'))
fangxinjiang's avatar
fangxinjiang committed
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237
			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 != ''">

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

			<if test="tDispatchInfo != null">
1238 1239 1240 1241 1242 1243
				<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>
fangxinjiang's avatar
fangxinjiang committed
1244 1245 1246
				<if test="tDispatchInfo.fundProvince != null and tDispatchInfo.fundProvince.trim() != ''">
					AND a.FUND_PROVINCE = #{tDispatchInfo.fundProvince}
				</if>
fangxinjiang's avatar
fangxinjiang committed
1247 1248 1249
				<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
					AND a.TYPE = #{tDispatchInfo.type}
				</if>
fangxinjiang's avatar
fangxinjiang committed
1250 1251 1252 1253 1254 1255 1256
				<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() != ''">
1257
					AND a.EMP_NAME like concat('%',#{tDispatchInfo.empName},'%')
fangxinjiang's avatar
fangxinjiang committed
1258 1259
				</if>
				<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
1260
					AND a.EMP_IDCARD like concat('%',#{tDispatchInfo.empIdcard},'%')
fangxinjiang's avatar
fangxinjiang committed
1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282
				</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() != ''">
fangxinjiang's avatar
fangxinjiang committed
1283
					AND a.SETTLE_DOMAIN_NAME like CONCAT(CONCAT(#{tDispatchInfo.settleDomainName}), '%')
fangxinjiang's avatar
fangxinjiang committed
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293
				</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>
fangxinjiang's avatar
fangxinjiang committed
1294 1295 1296 1297 1298 1299 1300 1301 1302
				<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>
fangxinjiang's avatar
fangxinjiang committed
1303
				<if test="tDispatchInfo.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
1304
					AND a.PROVIDENT_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.providentHouseholdName}), '%')
huyuchen's avatar
huyuchen committed
1305 1306 1307
				</if>
				<if test="tDispatchInfo.authSql != null and tDispatchInfo.authSql.trim() != ''">
					${tDispatchInfo.authSql}
fangxinjiang's avatar
fangxinjiang committed
1308 1309
				</if>
			</if>
huyuchen's avatar
huyuchen committed
1310
			group by a.id
fangxinjiang's avatar
fangxinjiang committed
1311
			order by a.APPLY_NO desc
fangxinjiang's avatar
fangxinjiang committed
1312 1313
		</where>
	</sql>
fangxinjiang's avatar
fangxinjiang committed
1314 1315 1316 1317 1318

	<!-- 获取当日最大的编码 -->
	<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>
fangxinjiang's avatar
fangxinjiang committed
1319
</mapper>