TDispatchInfoMapper.xml 39.9 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 75 76 77 78 79 80 81 82 83
    <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="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
84
	<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
fangxinjiang's avatar
fangxinjiang committed
85
    <result property="belongUnitName" column="BELONG_UNIT_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
86 87
	<result property="dispatchCode" column="DISPATCH_CODE"/>
	<result property="contractSubName" column="CONTRACT_SUB_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
88 89 90 91 92 93 94 95
	<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
96
	<result property="applyNo" column="APPLY_NO"/>
97 98 99
	<result property="createTime" column="CREATE_TIME"/>
	<result property="orderId" column="ORDER_ID"/>

fangxinjiang's avatar
fangxinjiang committed
100
  </resultMap>
fangxinjiang's avatar
fangxinjiang committed
101 102 103 104
	<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>
105 106 107
	<!-- 派单导出vo -->
	<resultMap id="exportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoExportVo">
		<id property="id" column="ID"/>
hongguangwu's avatar
hongguangwu committed
108
		<result property="applyNo" column="APPLY_NO"/>
109 110 111 112 113 114 115 116 117 118 119 120 121 122
		<result property="empNo" column="EMP_NO"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="empType" column="EMP_TYPE"/>
		<result property="typeSub" column="TYPE_SUB"/>
		<result property="belongUnitName" column="BELONG_UNIT_NAME"/>
		<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
		<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
		<result property="type" column="TYPE"/>
		<result property="dispatchItem" column="DISPATCH_ITEM"/>
		<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
		<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
		<result property="status" column="STATUS"/>
		<result property="socialHandleStatus" column="SOCIAL_HANDLE_STATUS"/>
123 124 125 126 127 128
		<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"/>
		<result property="bigailmentHandle" column="BIGAILMENT_HANDLE"/>
129 130 131 132 133 134
		<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"/>
	</resultMap>

135

fangxinjiang's avatar
fangxinjiang committed
136 137 138 139 140 141 142 143 144 145
	<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>
146

fangxinjiang's avatar
fangxinjiang committed
147
    <sql id="Base_Column_List">
fangxinjiang's avatar
fangxinjiang committed
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 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
		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,
		a.AUDIT_TIME,
		a.WORKING_HOURS,
		a.CREATE_BY,
		a.UPDATE_BY,
		a.CREATE_NAME,
hongguangwu's avatar
hongguangwu committed
202
		a.CREATE_TIME,
fangxinjiang's avatar
fangxinjiang committed
203 204 205 206 207 208 209
		a.UPDATE_TIME,
		a.ORGAN_NAME,
		a.DISPATCH_ITEM,
		a.SETTLE_DOMAIN_NAME,
		a.BELONG_UNIT_NAME,
		a.DISPATCH_CODE,
		a.SETTLE_DOMAIN_CODE,
210
		a.CONTRACT_SUB_NAME,
fangxinjiang's avatar
fangxinjiang committed
211 212 213 214 215 216
		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
217
		a.ID_CARD_ADDRESS,
218 219
		a.APPLY_NO,
		a.ORDER_ID
fangxinjiang's avatar
fangxinjiang committed
220 221 222
    </sql>
    <sql id="tDispatchInfo_where">
        <if test="tDispatchInfo != null">
fangxinjiang's avatar
fangxinjiang committed
223
					<if test="tDispatchInfo.idList != null and tDispatchInfo.idList.size >0">
224 225 226 227 228
						AND a.ID in
						<foreach item="idStr" index="index" collection="tDispatchInfo.idList" open="(" separator="," close=")">
							#{idStr}
						</foreach>
					</if>
fangxinjiang's avatar
fangxinjiang committed
229 230 231
                    <if test="tDispatchInfo.id != null and tDispatchInfo.id.trim() != ''">
                        AND a.ID = #{tDispatchInfo.id}
                    </if>
232 233 234
					<if test="tDispatchInfo.orderId != null and tDispatchInfo.orderId.trim() != ''">
						AND a.ORDER_ID = #{tDispatchInfo.orderId}
					</if>
fangxinjiang's avatar
fangxinjiang committed
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 270 271 272 273 274 275 276
                    <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 = #{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 = #{tDispatchInfo.empIdcard}
                    </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
277
					<if test="tDispatchInfo.settleDomainName != null and tDispatchInfo.settleDomainName.trim() != ''">
hongguangwu's avatar
hongguangwu committed
278
						AND a.SETTLE_DOMAIN_NAME like CONCAT(#{tDispatchInfo.settleDomainName}, '%')
fangxinjiang's avatar
fangxinjiang committed
279 280 281 282 283
					</if>
					<if test="tDispatchInfo.settleDomainCode != null and tDispatchInfo.settleDomainCode.trim() != ''">
						AND a.SETTLE_DOMAIN_CODE = #{tDispatchInfo.settleDomainCode}
					</if>

fangxinjiang's avatar
fangxinjiang committed
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 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 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 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 409
                    <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.auditTime != null">
                        AND a.AUDIT_TIME = #{tDispatchInfo.auditTime}
                    </if>
                    <if test="tDispatchInfo.workingHours != null and tDispatchInfo.workingHours.trim() != ''">
                        AND a.WORKING_HOURS = #{tDispatchInfo.workingHours}
                    </if>
                    <if test="tDispatchInfo.createBy != null and tDispatchInfo.createBy.trim() != ''">
                        AND a.CREATE_BY = #{tDispatchInfo.createBy}
                    </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
410

hongguangwu's avatar
hongguangwu committed
411
					<if test="tDispatchInfo.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
412
						AND s.SOCIAL_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.socialHouseholdName}), '%')
fangxinjiang's avatar
fangxinjiang committed
413
					</if>
hongguangwu's avatar
hongguangwu committed
414
					<if test="tDispatchInfo.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
415
						AND f.PROVIDENT_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.providentHouseholdName}), '%')
fangxinjiang's avatar
fangxinjiang committed
416
					</if>
fangxinjiang's avatar
fangxinjiang committed
417
					<if test="tDispatchInfo.createTimeStart != null">
hongguangwu's avatar
hongguangwu committed
418 419
						AND a.CREATE_TIME <![CDATA[ >= ]]> #{tDispatchInfo.createTimeStart}
					</if>
fangxinjiang's avatar
fangxinjiang committed
420
					<if test="tDispatchInfo.createTimeEnd != null">
hongguangwu's avatar
hongguangwu committed
421 422
						AND a.CREATE_TIME <![CDATA[ <= ]]> #{tDispatchInfo.createTimeEnd}
					</if>
fangxinjiang's avatar
fangxinjiang committed
423
		</if>
fangxinjiang's avatar
fangxinjiang committed
424 425
    </sql>
    <!--tDispatchInfo简单分页查询-->
fangxinjiang's avatar
fangxinjiang committed
426
    <select id="getTDispatchInfoPage" resultMap="dispatchPageMap">
fangxinjiang's avatar
fangxinjiang committed
427
        SELECT
fangxinjiang's avatar
fangxinjiang committed
428 429 430
        <include refid="Base_Column_List"/>,
               s.SOCIAL_HOUSEHOLD_NAME,
               f.PROVIDENT_HOUSEHOLD_NAME
fangxinjiang's avatar
fangxinjiang committed
431
        FROM t_dispatch_info a
fangxinjiang's avatar
fangxinjiang committed
432 433
		left join t_social_info s on s.id=a.SOCIAL_ID
		left join t_provident_fund f on f.id=a.FUND_ID
fangxinjiang's avatar
fangxinjiang committed
434 435 436 437
        <where>
            1=1
            <include refid="tDispatchInfo_where"/>
        </where>
438 439 440 441 442 443 444
		order by a.CREATE_TIME desc
    </select>

	<!-- 派单导出 -->
    <select id="exportDispatch" resultMap="exportMap">
		select
			a.ID,
hongguangwu's avatar
hongguangwu committed
445
			a.APPLY_NO,
446 447 448 449 450 451 452 453 454 455 456 457 458 459
			a.EMP_NO,
			a.EMP_NAME,
			a.EMP_IDCARD,
			a.EMP_TYPE,
			a.TYPE_SUB,
			a.BELONG_UNIT_NAME,
			a.SETTLE_DOMAIN_NAME,
			a.SETTLE_DOMAIN_CODE,
			a.TYPE,
			a.DISPATCH_ITEM,
			s.SOCIAL_HOUSEHOLD_NAME,
			f.PROVIDENT_HOUSEHOLD_NAME,
			a.STATUS,
			a.SOCIAL_HANDLE_STATUS,
460 461 462 463
			s.PENSION_HANDLE,
			s.MEDICAL_HANDLE,
			s.UNEMPLOY_HANDLE,
			s.WORK_INJURY_HANDLE,
hongguangwu's avatar
hongguangwu committed
464
			s.BIRTH_HANDLE,
465
			s.BIGAILMENT_HANDLE,
466 467 468 469 470 471 472 473
			a.FUND_HANDLE_STATUS,
			a.CREATE_NAME,
			a.ORGAN_NAME,
			a.CREATE_TIME
		from t_dispatch_info a
		left join t_social_info s on s.id=a.SOCIAL_ID
		left join t_provident_fund f on f.id=a.FUND_ID
        <where>
474
            a.DELETE_FLAG = '0'
475 476 477
            <include refid="tDispatchInfo_where"/>
        </where>
		order by a.CREATE_TIME desc
hongguangwu's avatar
hongguangwu committed
478
		<if test="tDispatchInfo.limitStart != null">
479 480
			limit #{tDispatchInfo.limitStart},#{tDispatchInfo.limitEnd}
		</if>
fangxinjiang's avatar
fangxinjiang committed
481
    </select>
fangxinjiang's avatar
fangxinjiang committed
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
	<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"/>
		<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
503
		<result property="createUserName" column="CREATE_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533

		<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"/>
fangxinjiang's avatar
fangxinjiang committed
534
		<result property="createUserName" column="CREATE_NAME"/>
fangxinjiang's avatar
fangxinjiang 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 564 565 566 567 568 569 570 571 572 573 574

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

	</resultMap>
	<!--tDispatchInfo 社保花名册数据查询-->
	<select id="getSocialRecordRosterList" resultMap="socialHandleExportMap">
		SELECT
		a.TYPE,
		a.SOCIAL_HANDLE_STATUS,
		IF(a.TYPE='0',b.PENSION_HANDLE,IF(b.PENSION_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "PENSION_HANDLE",
		IF(a.TYPE='0',b.MEDICAL_HANDLE,IF(b.MEDICAL_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "MEDICAL_HANDLE",
		IF(a.TYPE='0',b.UNEMPLOY_HANDLE,IF(b.UNEMPLOY_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "UNEMPLOY_HANDLE",
		IF(a.TYPE='0',b.WORK_INJURY_HANDLE,IF(b.WORK_INJURY_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "WORK_INJURY_HANDLE",
		IF(a.TYPE='0',b.BIRTH_HANDLE,IF(b.BIRTH_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "BIRTH_HANDLE",
		IF(a.TYPE='0',b.BIGAILMENT_HANDLE,IF(b.BIGAILMENT_HANDLE='2',"--",a.SOCIAL_HANDLE_STATUS)) as "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.EMP_REGIS_TYPE,
		a.EMP_NATIONAL,
		a.WORKING_HOURS,
		a.CONTRACT_TERM,
		a.CONTRACT_START,
		a.CONTRACT_END,
fangxinjiang's avatar
fangxinjiang committed
575
		a.CREATE_NAME,
fangxinjiang's avatar
fangxinjiang committed
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
		b.RECORD_BASE,
		b.PAYMENT_TYPE,
		b.SOCIAL_HOUSEHOLD_NAME,
		b.SOCIAL_PROVINCE,
		b.SOCIAL_CITY,
		b.SOCIAL_TOWN,
		b.PENSION_START,
		b.UNIT_PENSION_CARDINAL,
		b.MEDICAL_START,
		b.UNIT_MEDICAL_CARDINAL,
		b.UNEMPLOY_START,
		b.UNIT_UNEMPLOYMENT_CARDINAL,
		b.WORK_INJURY_START,
		b.UNIT_WORK_INJURY_CARDINAL,
		b.BIRTH_START,
		b.UNIT_BIRTH_CARDINAL,
		b.BIGAILMENT_START,
		b.UNIT_BIGAILMENT_CARDINAL,
		b.UNIT_BIGAILMENT_MONEY,
		b.PERSONAL_BIGAILMENT_MONEY,
		b.TRUST_REMARK socailTrustRemark,
		a.REDUCE_REASON
		<include refid="where_getSocialRecordRoster"/>
	</select>

	<!--tDispatchInfo 社保花名册数据查询count-->
	<select id="getSocialRecordRosterListCount" resultType="java.lang.Integer">
		SELECT
		count(1)
		<include refid="where_getSocialRecordRoster"/>
	</select>

	<!--tDispatchInfo 社保办理数据查询-->
fangxinjiang's avatar
fangxinjiang committed
609
	<select id="getTDispatchSocialHandlePage" resultMap="dispatchPageMap">
fangxinjiang's avatar
fangxinjiang committed
610
		SELECT
fangxinjiang's avatar
fangxinjiang committed
611 612
		<include refid="Base_Column_List"/>,
		       b.SOCIAL_HOUSEHOLD_NAME
fangxinjiang's avatar
fangxinjiang committed
613 614 615
		<include refid="where_getSocialRecordRoster"/>
	</select>
	<!--tDispatchInfo 公积金办理数据查询-->
fangxinjiang's avatar
fangxinjiang committed
616
	<select id="getTDispatchFundHandlePage" resultMap="dispatchPageMap">
fangxinjiang's avatar
fangxinjiang committed
617
		SELECT
fangxinjiang's avatar
fangxinjiang committed
618 619
		<include refid="Base_Column_List"/>,
		c.PROVIDENT_HOUSEHOLD_NAME
fangxinjiang's avatar
fangxinjiang committed
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671
		<include refid="where_getFundRecord"/>
	</select>

	<!--tDispatchInfo 公积金变更清册cout-->
	<select id="getFundRecordCount" resultType="java.lang.Integer">
		SELECT
		count(1)
		<include refid="where_getFundRecord"/>
	</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,
		a.CREATE_NAME,

		c.PROVIDENT_HOUSEHOLD_NAME,
		c.PROVIDENT_START,
		c.UNIT_PROVIDENG_CARDINAL,
		c.PERSONAL_PROVIDENT_CARDINAL,
		c.UNIT_PROVIDENT_PER,
		c.PERSONAL_PROVIDENT_PER,
		c.UNIT_PROVIDENT_FEE,
		c.PERSONAL_PROVIDENT_FEE,
		c.FUND_PROVINCE,
		c.FUND_CITY,
		c.FUND_TOWN
		<include refid="where_getFundRecord"/>
	</select>

	<!--tDispatchInfo 公积金补交清册-->
	<select id="getFundSupplementaryRecords" resultMap="fundSupplementaryMap">
		SELECT
		c.PROVIDENT_START,
		c.UNIT_PROVIDENG_CARDINAL,
		c.PERSONAL_PROVIDENT_CARDINAL,
		c.UNIT_PROVIDENT_PER,
		c.PERSONAL_PROVIDENT_PER,
		c.UNIT_PROVIDENT_FEE,
		c.PERSONAL_PROVIDENT_FEE,
		c.EMP_NAME
		<include refid="where_getFundRecord"/>
	</select>
	<sql id="where_getSocialRecordRoster">
		FROM t_dispatch_info a
		left join t_social_info b on a.SOCIAL_ID = b.id
		<where>
			1=1 and b.DELETE_FLAG = 0
fangxinjiang's avatar
fangxinjiang committed
672
			<if test="idsStr != null and idsStr.size > 0">
fangxinjiang's avatar
fangxinjiang committed
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706
				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 (b.HANDLE_STATUS = "0" or b.HANDLE_STATUS = "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 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">
fangxinjiang's avatar
fangxinjiang committed
707 708 709
				<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
					AND a.TYPE = #{tDispatchInfo.type}
				</if>
fangxinjiang's avatar
fangxinjiang committed
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745
				<if test="tDispatchInfo.socialProvince != null and tDispatchInfo.socialProvince!= null">
					AND  b.social_province = #{tDispatchInfo.socialProvince}
					<if test="tDispatchInfo.socialCity != null and tDispatchInfo.socialCity!= null">
						AND  b.social_city = #{tDispatchInfo.socialCity}
					</if>
					<if test="tDispatchInfo.socialTown != null and tDispatchInfo.socialTown!= null">
						AND  b.social_town = #{tDispatchInfo.socialTown}
					</if>
				</if>
				<if test="tDispatchInfo.empName != null and tDispatchInfo.empName.trim() != ''">
					AND a.EMP_NAME = #{tDispatchInfo.empName}
				</if>
				<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD = #{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() != ''">
fangxinjiang's avatar
fangxinjiang committed
746
					AND a.SETTLE_DOMAIN_NAME like CONCAT(CONCAT(#{tDispatchInfo.settleDomainName}), '%')
fangxinjiang's avatar
fangxinjiang committed
747 748 749 750 751 752 753 754 755 756 757
				</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.socialHouseholdName != null and tDispatchInfo.socialHouseholdName.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
758
					AND b.SOCIAL_HOUSEHOLD_NAME  like CONCAT(CONCAT(#{tDispatchInfo.socialHouseholdName}), '%')
fangxinjiang's avatar
fangxinjiang committed
759 760 761 762 763 764 765 766 767 768 769 770 771 772
				</if>

			</if>
			<if test='sql != null and sql != ""'>
				and <![CDATA[sql]]>
			</if>
			order by a.CREATE_TIME desc
		</where>
	</sql>

	<sql id="where_getFundRecord">
		FROM t_dispatch_info a
		left join t_provident_fund c on a.FUND_ID = c.id
		<where>
fangxinjiang's avatar
fangxinjiang committed
773
			1=1 and a.DELETE_FLAG = 0
fangxinjiang's avatar
fangxinjiang committed
774
			<if test="idsStr != null and idsStr.size > 0">
fangxinjiang's avatar
fangxinjiang committed
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810
				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 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 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">
				<if test="tDispatchInfo.fundProvince != null and tDispatchInfo.fundProvince.trim() != ''">
					AND a.FUND_PROVINCE = #{tDispatchInfo.fundProvince}
				</if>
fangxinjiang's avatar
fangxinjiang committed
811 812 813
				<if test="tDispatchInfo.type != null and tDispatchInfo.type.trim() != ''">
					AND a.TYPE = #{tDispatchInfo.type}
				</if>
fangxinjiang's avatar
fangxinjiang committed
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846
				<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 = #{tDispatchInfo.empName}
				</if>
				<if test="tDispatchInfo.empIdcard != null and tDispatchInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD = #{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() != ''">
fangxinjiang's avatar
fangxinjiang committed
847
					AND a.SETTLE_DOMAIN_NAME like CONCAT(CONCAT(#{tDispatchInfo.settleDomainName}), '%')
fangxinjiang's avatar
fangxinjiang committed
848 849 850 851 852 853 854 855 856 857 858
				</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.providentHouseholdName != null and tDispatchInfo.providentHouseholdName.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
859
					AND c.PROVIDENT_HOUSEHOLD_NAME like CONCAT(CONCAT(#{tDispatchInfo.providentHouseholdName}), '%')
fangxinjiang's avatar
fangxinjiang committed
860 861 862 863 864 865 866 867 868
				</if>

			</if>
			<if test='sql != null and sql != ""'>
				and <![CDATA[sql]]>
			</if>
			order by a.CREATE_TIME desc
		</where>
	</sql>
fangxinjiang's avatar
fangxinjiang committed
869 870 871 872 873

	<!-- 获取当日最大的编码 -->
	<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
874
</mapper>