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

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

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

<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TForecastLibraryMapper">

	<resultMap id="tForecastLibraryMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary">
		<id property="id" column="ID"/>
		<result property="empId" column="EMP_ID"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="socialId" column="SOCIAL_ID"/>
		<result property="settleDomainId" column="SETTLE_DOMAIN_ID"/>
		<result property="unitId" column="UNIT_ID"/>
		<result property="providentId" column="PROVIDENT_ID"/>
		<result property="unitPensionFee" column="UNIT_PENSION_FEE"/>
		<result property="unitMedicalFee" column="UNIT_MEDICAL_FEE"/>
		<result property="unitUnemploymentFee" column="UNIT_UNEMPLOYMENT_FEE"/>
		<result property="unitWorkInjuryFee" column="UNIT_WORK_INJURY_FEE"/>
		<result property="unitBirthFee" column="UNIT_BIRTH_FEE"/>
		<result property="unitBitailmentFee" column="UNIT_BITAILMENT_FEE"/>
		<result property="personalPensionFee" column="PERSONAL_PENSION_FEE"/>
		<result property="personalMedicalFee" column="PERSONAL_MEDICAL_FEE"/>
		<result property="personalUnemploymentFee" column="PERSONAL_UNEMPLOYMENT_FEE"/>
		<result property="personalBigailmentFee" column="PERSONAL_BIGAILMENT_FEE"/>
		<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
		<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
		<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
		<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="unitFundSum" column="UNIT_FUND_SUM"/>
		<result property="personalSocialSum" column="PERSONAL_SOCIAL_SUM"/>
		<result property="personalFundSum" column="PERSONAL_FUND_SUM"/>
		<result property="sumAll" column="SUM_ALL"/>
		<result property="fundProvince" column="FUND_PROVINCE"/>
		<result property="fundCity" column="FUND_CITY"/>
		<result property="fundTown" column="FUND_TOWN"/>
		<result property="socialProvince" column="SOCIAL_PROVINCE"/>
		<result property="socialCity" column="SOCIAL_CITY"/>
		<result property="socialTown" column="SOCIAL_TOWN"/>
		<result property="unitPensionBase" column="UNIT_PENSION_BASE"/>
		<result property="unitMedicalBase" column="UNIT_MEDICAL_BASE"/>
		<result property="unitUnemploymentBase" column="UNIT_UNEMPLOYMENT_BASE"/>
		<result property="unitInjuryBase" column="UNIT_INJURY_BASE"/>
		<result property="unitBirthBase" column="UNIT_BIRTH_BASE"/>
		<result property="unitBigailmentBase" column="UNIT_BIGAILMENT_BASE"/>
		<result property="personalPensionBase" column="PERSONAL_PENSION_BASE"/>
		<result property="personalMedicalBase" column="PERSONAL_MEDICAL_BASE"/>
		<result property="personalUnemploymentBase" column="PERSONAL_UNEMPLOYMENT_BASE"/>
		<result property="personalBigailmentBase" column="PERSONAL_BIGAILMENT_BASE"/>
		<result property="unitPersionPro" column="UNIT_PERSION_PRO"/>
		<result property="unitMedicalPro" column="UNIT_MEDICAL_PRO"/>
		<result property="unitUnemploymentPro" column="UNIT_UNEMPLOYMENT_PRO"/>
		<result property="unitInjuryPro" column="UNIT_INJURY_PRO"/>
		<result property="unitBirthPro" column="UNIT_BIRTH_PRO"/>
		<result property="unitBigailmentPro" column="UNIT_BIGAILMENT_PRO"/>
		<result property="personalPersionPro" column="PERSONAL_PERSION_PRO"/>
		<result property="personalMedicalPro" column="PERSONAL_MEDICAL_PRO"/>
		<result property="personalUnemploymentPro" column="PERSONAL_UNEMPLOYMENT_PRO"/>
		<result property="personalBigailmentPro" column="PERSONAL_BIGAILMENT_PRO"/>
		<result property="unitFundBase" column="UNIT_FUND_BASE"/>
		<result property="personalFundBase" column="PERSONAL_FUND_BASE"/>
		<result property="unitFundProp" column="UNIT_FUND_PROP"/>
		<result property="personalFundProp" column="PERSONAL_FUND_PROP"/>
		<result property="remark" column="REMARK"/>
		<result property="projectId" column="PROJECT_ID"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="deptName" column="DEPT_NAME"/>
		<result property="deptNo" column="DEPT_NO"/>
		<result property="empNatrue" column="EMP_NATRUE"/>
		<result property="unitInterestFee" column="UNIT_INTEREST_FEE"/>
		<result property="personalInterestFee" column="PERSONAL_INTEREST_FEE"/>
		<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
		<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
		<result property="providentHousehold" column="PROVIDENT_HOUSEHOLD"/>
		<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
		<result property="dataPush" column="DATA_PUSH"/>
		<result property="dataType" column="DATA_TYPE"/>
		<result property="diffType" column="DIFF_TYPE"/>
		<result property="createBy" column="CREATE_BY"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="createTime" column="CREATE_TIME"/>
		<result property="updateBy" column="UPDATE_BY"/>
		<result property="updateTime" column="UPDATE_TIME"/>
		<result property="salarySocialFlag" column="SALARY_SOCIAL_FLAG"/>
		<result property="salaryFundFlag" column="SALARY_FUND_FLAG"/>
	</resultMap>
	<!-- 导出 -->
	<resultMap id="exportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TForecastLibraryExportVo">
		<id property="id" column="ID"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="deptName" column="DEPT_NAME"/>
		<result property="deptNo" column="DEPT_NO"/>
		<result property="unitPensionFee" column="UNIT_PENSION_FEE"/>
		<result property="unitMedicalFee" column="UNIT_MEDICAL_FEE"/>
		<result property="unitUnemploymentFee" column="UNIT_UNEMPLOYMENT_FEE"/>
		<result property="unitWorkInjuryFee" column="UNIT_WORK_INJURY_FEE"/>
		<result property="unitBirthFee" column="UNIT_BIRTH_FEE"/>
		<result property="personalPensionFee" column="PERSONAL_PENSION_FEE"/>
		<result property="personalMedicalFee" column="PERSONAL_MEDICAL_FEE"/>
		<result property="personalUnemploymentFee" column="PERSONAL_UNEMPLOYMENT_FEE"/>
		<result property="personalBigailmentFee" column="PERSONAL_BIGAILMENT_FEE"/>
		<result property="unitBitailmentFee" column="UNIT_BITAILMENT_FEE"/>
		<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
		<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
		<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
		<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
		<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
		<result property="unitFundSum" column="UNIT_FUND_SUM"/>
		<result property="personalSocialSum" column="PERSONAL_SOCIAL_SUM"/>
		<result property="personalFundSum" column="PERSONAL_FUND_SUM"/>
		<result property="sumAll" column="SUM_ALL"/>
		<result property="fundProvince" column="FUND_PROVINCE"/>
		<result property="fundCity" column="FUND_CITY"/>
		<result property="fundTown" column="FUND_TOWN"/>
		<result property="socialProvince" column="SOCIAL_PROVINCE"/>
		<result property="socialCity" column="SOCIAL_CITY"/>
		<result property="socialTown" column="SOCIAL_TOWN"/>
		<result property="unitPensionBase" column="UNIT_PENSION_BASE"/>
		<result property="unitMedicalBase" column="UNIT_MEDICAL_BASE"/>
		<result property="unitUnemploymentBase" column="UNIT_UNEMPLOYMENT_BASE"/>
		<result property="unitInjuryBase" column="UNIT_INJURY_BASE"/>
		<result property="unitBirthBase" column="UNIT_BIRTH_BASE"/>
		<result property="personalPensionBase" column="PERSONAL_PENSION_BASE"/>
		<result property="personalMedicalBase" column="PERSONAL_MEDICAL_BASE"/>
		<result property="personalUnemploymentBase" column="PERSONAL_UNEMPLOYMENT_BASE"/>
		<result property="personalBigailmentBase" column="PERSONAL_BIGAILMENT_BASE"/>
		<result property="unitBigailmentBase" column="UNIT_BIGAILMENT_BASE"/>
		<result property="unitPersionPro" column="UNIT_PERSION_PRO"/>
		<result property="unitMedicalPro" column="UNIT_MEDICAL_PRO"/>
		<result property="unitUnemploymentPro" column="UNIT_UNEMPLOYMENT_PRO"/>
		<result property="unitInjuryPro" column="UNIT_INJURY_PRO"/>
		<result property="unitBirthPro" column="UNIT_BIRTH_PRO"/>
		<result property="personalPersionPro" column="PERSONAL_PERSION_PRO"/>
		<result property="personalMedicalPro" column="PERSONAL_MEDICAL_PRO"/>
		<result property="personalUnemploymentPro" column="PERSONAL_UNEMPLOYMENT_PRO"/>
		<result property="personalBigailmentPro" column="PERSONAL_BIGAILMENT_PRO"/>
		<result property="unitBigailmentPro" column="UNIT_BIGAILMENT_PRO"/>
		<result property="unitFundBase" column="UNIT_FUND_BASE"/>
		<result property="personalFundBase" column="PERSONAL_FUND_BASE"/>
		<result property="unitFundProp" column="UNIT_FUND_PROP"/>
		<result property="personalFundProp" column="PERSONAL_FUND_PROP"/>
		<result property="dataPush" column="DATA_PUSH"/>
		<result property="createTime" column="CREATE_TIME"/>
		<result property="diffType" column="DIFF_TYPE"/>
		<result property="dataType" column="DATA_TYPE"/>
	</resultMap>
	<sql id="Base_Column_List">
		a.ID,
		a.EMP_ID,
		a.EMP_NO,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.SOCIAL_ID,
		a.SETTLE_DOMAIN_ID,
		a.UNIT_ID,
		a.PROVIDENT_ID,
		a.UNIT_PENSION_FEE,
		a.UNIT_MEDICAL_FEE,
		a.UNIT_UNEMPLOYMENT_FEE,
		a.UNIT_WORK_INJURY_FEE,
		a.UNIT_BIRTH_FEE,
		a.UNIT_BITAILMENT_FEE,
		a.PERSONAL_PENSION_FEE,
		a.PERSONAL_MEDICAL_FEE,
		a.PERSONAL_UNEMPLOYMENT_FEE,
		a.PERSONAL_BIGAILMENT_FEE,
		a.SOCIAL_PAY_MONTH,
		a.SOCIAL_CREATE_MONTH,
		a.PROVIDENT_PAY_MONTH,
		a.PROVIDENT_CREATE_MONTH,
		a.UNIT_SOCIAL_SUM,
		a.UNIT_FUND_SUM,
		a.PERSONAL_SOCIAL_SUM,
		a.PERSONAL_FUND_SUM,
		a.SUM_ALL,
		a.FUND_PROVINCE,
		a.FUND_CITY,
		a.FUND_TOWN,
		a.SOCIAL_PROVINCE,
		a.SOCIAL_CITY,
		a.SOCIAL_TOWN,
		a.UNIT_PENSION_BASE,
		a.UNIT_MEDICAL_BASE,
		a.UNIT_UNEMPLOYMENT_BASE,
		a.UNIT_INJURY_BASE,
		a.UNIT_BIRTH_BASE,
		a.UNIT_BIGAILMENT_BASE,
		a.PERSONAL_PENSION_BASE,
		a.PERSONAL_MEDICAL_BASE,
		a.PERSONAL_UNEMPLOYMENT_BASE,
		a.PERSONAL_BIGAILMENT_BASE,
		a.UNIT_PERSION_PRO,
		a.UNIT_MEDICAL_PRO,
		a.UNIT_UNEMPLOYMENT_PRO,
		a.UNIT_INJURY_PRO,
		a.UNIT_BIRTH_PRO,
		a.UNIT_BIGAILMENT_PRO,
		a.PERSONAL_PERSION_PRO,
		a.PERSONAL_MEDICAL_PRO,
		a.PERSONAL_UNEMPLOYMENT_PRO,
		a.PERSONAL_BIGAILMENT_PRO,
		a.UNIT_FUND_BASE,
		a.PERSONAL_FUND_BASE,
		a.UNIT_FUND_PROP,
		a.PERSONAL_FUND_PROP,
		a.REMARK,
		a.PROJECT_ID,
		a.UNIT_NAME,
		a.DEPT_NAME,
		a.DEPT_NO,
		a.EMP_NATRUE,
		a.UNIT_INTEREST_FEE,
		a.PERSONAL_INTEREST_FEE,
		a.SOCIAL_HOUSEHOLD,
		a.SOCIAL_HOUSEHOLD_NAME,
		a.PROVIDENT_HOUSEHOLD,
		a.PROVIDENT_HOUSEHOLD_NAME,
		a.DATA_PUSH,
		a.DATA_TYPE,
		a.DIFF_TYPE,
		a.CREATE_BY,
		a.CREATE_NAME,
		a.CREATE_TIME,
		a.UPDATE_BY,
		a.SALARY_SOCIAL_FLAG,
		a.SALARY_FUND_FLAG,
		a.UPDATE_TIME
	</sql>
	<sql id="tForecastLibrary_where">
		<if test="tForecastLibrary != null">
			<if test="tForecastLibrary.idList != null">
				AND a.ID in
				<foreach item="idStr" index="index" collection="tForecastLibrary.idList" open="(" separator="," close=")">
					#{idStr}
				</foreach>
			</if>
			<if test="tForecastLibrary.id != null and tForecastLibrary.id.trim() != ''">
				AND a.ID = #{tForecastLibrary.id}
			</if>
			<if test="tForecastLibrary.empId != null and tForecastLibrary.empId.trim() != ''">
				AND a.EMP_ID = #{tForecastLibrary.empId}
			</if>
			<if test="tForecastLibrary.empNo != null and tForecastLibrary.empNo.trim() != ''">
				AND a.EMP_NO = #{tForecastLibrary.empNo}
			</if>
			<if test="tForecastLibrary.empName != null and tForecastLibrary.empName.trim() != ''">
				AND a.EMP_NAME = #{tForecastLibrary.empName}
			</if>
			<if test="tForecastLibrary.empIdcard != null and tForecastLibrary.empIdcard.trim() != ''">
				AND a.EMP_IDCARD = #{tForecastLibrary.empIdcard}
			</if>
			<if test="tForecastLibrary.socialId != null and tForecastLibrary.socialId.trim() != ''">
				AND a.SOCIAL_ID = #{tForecastLibrary.socialId}
			</if>
			<if test="tForecastLibrary.settleDomainId != null and tForecastLibrary.settleDomainId.trim() != ''">
				AND a.SETTLE_DOMAIN_ID = #{tForecastLibrary.settleDomainId}
			</if>
			<if test="tForecastLibrary.unitId != null and tForecastLibrary.unitId.trim() != ''">
				AND a.UNIT_ID = #{tForecastLibrary.unitId}
			</if>
			<if test="tForecastLibrary.providentId != null and tForecastLibrary.providentId.trim() != ''">
				AND a.PROVIDENT_ID = #{tForecastLibrary.providentId}
			</if>
			<if test="tForecastLibrary.unitPensionFee != null">
				AND a.UNIT_PENSION_FEE = #{tForecastLibrary.unitPensionFee}
			</if>
			<if test="tForecastLibrary.unitMedicalFee != null">
				AND a.UNIT_MEDICAL_FEE = #{tForecastLibrary.unitMedicalFee}
			</if>
			<if test="tForecastLibrary.unitUnemploymentFee != null">
				AND a.UNIT_UNEMPLOYMENT_FEE = #{tForecastLibrary.unitUnemploymentFee}
			</if>
			<if test="tForecastLibrary.unitWorkInjuryFee != null">
				AND a.UNIT_WORK_INJURY_FEE = #{tForecastLibrary.unitWorkInjuryFee}
			</if>
			<if test="tForecastLibrary.unitBirthFee != null">
				AND a.UNIT_BIRTH_FEE = #{tForecastLibrary.unitBirthFee}
			</if>
			<if test="tForecastLibrary.unitBitailmentFee != null">
				AND a.UNIT_BITAILMENT_FEE = #{tForecastLibrary.unitBitailmentFee}
			</if>
			<if test="tForecastLibrary.personalPensionFee != null">
				AND a.PERSONAL_PENSION_FEE = #{tForecastLibrary.personalPensionFee}
			</if>
			<if test="tForecastLibrary.personalMedicalFee != null">
				AND a.PERSONAL_MEDICAL_FEE = #{tForecastLibrary.personalMedicalFee}
			</if>
			<if test="tForecastLibrary.personalUnemploymentFee != null">
				AND a.PERSONAL_UNEMPLOYMENT_FEE = #{tForecastLibrary.personalUnemploymentFee}
			</if>
			<if test="tForecastLibrary.personalBigailmentFee != null">
				AND a.PERSONAL_BIGAILMENT_FEE = #{tForecastLibrary.personalBigailmentFee}
			</if>
			<if test="tForecastLibrary.socialPayMonth != null and tForecastLibrary.socialPayMonth.trim() != ''">
				AND a.SOCIAL_PAY_MONTH = #{tForecastLibrary.socialPayMonth}
			</if>
			<if test="tForecastLibrary.socialCreateMonth != null and tForecastLibrary.socialCreateMonth.trim() != ''">
				AND a.SOCIAL_CREATE_MONTH = #{tForecastLibrary.socialCreateMonth}
			</if>
			<if test="tForecastLibrary.providentPayMonth != null and tForecastLibrary.providentPayMonth.trim() != ''">
				AND a.PROVIDENT_PAY_MONTH = #{tForecastLibrary.providentPayMonth}
			</if>
			<if test="tForecastLibrary.providentCreateMonth != null and tForecastLibrary.providentCreateMonth.trim() != ''">
				AND a.PROVIDENT_CREATE_MONTH = #{tForecastLibrary.providentCreateMonth}
			</if>
			<if test="tForecastLibrary.unitSocialSum != null">
				AND a.UNIT_SOCIAL_SUM = #{tForecastLibrary.unitSocialSum}
			</if>
			<if test="tForecastLibrary.unitFundSum != null">
				AND a.UNIT_FUND_SUM = #{tForecastLibrary.unitFundSum}
			</if>
			<if test="tForecastLibrary.personalSocialSum != null">
				AND a.PERSONAL_SOCIAL_SUM = #{tForecastLibrary.personalSocialSum}
			</if>
			<if test="tForecastLibrary.personalFundSum != null">
				AND a.PERSONAL_FUND_SUM = #{tForecastLibrary.personalFundSum}
			</if>
			<if test="tForecastLibrary.fundProvince != null and tForecastLibrary.fundProvince.trim() != ''">
				AND a.FUND_PROVINCE = #{tForecastLibrary.fundProvince}
			</if>
			<if test="tForecastLibrary.fundCity != null and tForecastLibrary.fundCity.trim() != ''">
				AND a.FUND_CITY = #{tForecastLibrary.fundCity}
			</if>
			<if test="tForecastLibrary.fundTown != null and tForecastLibrary.fundTown.trim() != ''">
				AND a.FUND_TOWN = #{tForecastLibrary.fundTown}
			</if>
			<if test="tForecastLibrary.socialProvince != null and tForecastLibrary.socialProvince.trim() != ''">
				AND a.SOCIAL_PROVINCE = #{tForecastLibrary.socialProvince}
			</if>
			<if test="tForecastLibrary.socialCity != null and tForecastLibrary.socialCity.trim() != ''">
				AND a.SOCIAL_CITY = #{tForecastLibrary.socialCity}
			</if>
			<if test="tForecastLibrary.socialTown != null and tForecastLibrary.socialTown.trim() != ''">
				AND a.SOCIAL_TOWN = #{tForecastLibrary.socialTown}
			</if>
			<if test="tForecastLibrary.unitPensionBase != null">
				AND a.UNIT_PENSION_BASE = #{tForecastLibrary.unitPensionBase}
			</if>
			<if test="tForecastLibrary.unitMedicalBase != null">
				AND a.UNIT_MEDICAL_BASE = #{tForecastLibrary.unitMedicalBase}
			</if>
			<if test="tForecastLibrary.unitUnemploymentBase != null">
				AND a.UNIT_UNEMPLOYMENT_BASE = #{tForecastLibrary.unitUnemploymentBase}
			</if>
			<if test="tForecastLibrary.unitInjuryBase != null">
				AND a.UNIT_INJURY_BASE = #{tForecastLibrary.unitInjuryBase}
			</if>
			<if test="tForecastLibrary.unitBirthBase != null">
				AND a.UNIT_BIRTH_BASE = #{tForecastLibrary.unitBirthBase}
			</if>
			<if test="tForecastLibrary.unitBigailmentBase != null">
				AND a.UNIT_BIGAILMENT_BASE = #{tForecastLibrary.unitBigailmentBase}
			</if>
			<if test="tForecastLibrary.personalPensionBase != null">
				AND a.PERSONAL_PENSION_BASE = #{tForecastLibrary.personalPensionBase}
			</if>
			<if test="tForecastLibrary.personalMedicalBase != null">
				AND a.PERSONAL_MEDICAL_BASE = #{tForecastLibrary.personalMedicalBase}
			</if>
			<if test="tForecastLibrary.personalUnemploymentBase != null">
				AND a.PERSONAL_UNEMPLOYMENT_BASE = #{tForecastLibrary.personalUnemploymentBase}
			</if>
			<if test="tForecastLibrary.personalBigailmentBase != null">
				AND a.PERSONAL_BIGAILMENT_BASE = #{tForecastLibrary.personalBigailmentBase}
			</if>
			<if test="tForecastLibrary.unitPersionPro != null">
				AND a.UNIT_PERSION_PRO = #{tForecastLibrary.unitPersionPro}
			</if>
			<if test="tForecastLibrary.unitMedicalPro != null">
				AND a.UNIT_MEDICAL_PRO = #{tForecastLibrary.unitMedicalPro}
			</if>
			<if test="tForecastLibrary.unitUnemploymentPro != null">
				AND a.UNIT_UNEMPLOYMENT_PRO = #{tForecastLibrary.unitUnemploymentPro}
			</if>
			<if test="tForecastLibrary.unitInjuryPro != null">
				AND a.UNIT_INJURY_PRO = #{tForecastLibrary.unitInjuryPro}
			</if>
			<if test="tForecastLibrary.unitBirthPro != null">
				AND a.UNIT_BIRTH_PRO = #{tForecastLibrary.unitBirthPro}
			</if>
			<if test="tForecastLibrary.unitBigailmentPro != null">
				AND a.UNIT_BIGAILMENT_PRO = #{tForecastLibrary.unitBigailmentPro}
			</if>
			<if test="tForecastLibrary.personalPersionPro != null">
				AND a.PERSONAL_PERSION_PRO = #{tForecastLibrary.personalPersionPro}
			</if>
			<if test="tForecastLibrary.personalMedicalPro != null">
				AND a.PERSONAL_MEDICAL_PRO = #{tForecastLibrary.personalMedicalPro}
			</if>
			<if test="tForecastLibrary.personalUnemploymentPro != null">
				AND a.PERSONAL_UNEMPLOYMENT_PRO = #{tForecastLibrary.personalUnemploymentPro}
			</if>
			<if test="tForecastLibrary.personalBigailmentPro != null">
				AND a.PERSONAL_BIGAILMENT_PRO = #{tForecastLibrary.personalBigailmentPro}
			</if>
			<if test="tForecastLibrary.unitFundBase != null">
				AND a.UNIT_FUND_BASE = #{tForecastLibrary.unitFundBase}
			</if>
			<if test="tForecastLibrary.personalFundBase != null">
				AND a.PERSONAL_FUND_BASE = #{tForecastLibrary.personalFundBase}
			</if>
			<if test="tForecastLibrary.unitFundProp != null">
				AND a.UNIT_FUND_PROP = #{tForecastLibrary.unitFundProp}
			</if>
			<if test="tForecastLibrary.personalFundProp != null">
				AND a.PERSONAL_FUND_PROP = #{tForecastLibrary.personalFundProp}
			</if>
			<if test="tForecastLibrary.remark != null and tForecastLibrary.remark.trim() != ''">
				AND a.REMARK = #{tForecastLibrary.remark}
			</if>
			<if test="tForecastLibrary.projectId != null and tForecastLibrary.projectId.trim() != ''">
				AND a.PROJECT_ID = #{tForecastLibrary.projectId}
			</if>
			<if test="tForecastLibrary.unitName != null and tForecastLibrary.unitName.trim() != ''">
				AND a.UNIT_NAME = #{tForecastLibrary.unitName}
			</if>
			<if test="tForecastLibrary.deptName != null and tForecastLibrary.deptName.trim() != ''">
				AND a.DEPT_NAME = #{tForecastLibrary.deptName}
			</if>
			<if test="tForecastLibrary.deptNo != null and tForecastLibrary.deptNo.trim() != ''">
				AND a.DEPT_NO = #{tForecastLibrary.deptNo}
			</if>
			<if test="tForecastLibrary.empNatrue != null and tForecastLibrary.empNatrue.trim() != ''">
				AND a.EMP_NATRUE = #{tForecastLibrary.empNatrue}
			</if>
			<if test="tForecastLibrary.unitInterestFee != null">
				AND a.UNIT_INTEREST_FEE = #{tForecastLibrary.unitInterestFee}
			</if>
			<if test="tForecastLibrary.personalInterestFee != null">
				AND a.PERSONAL_INTEREST_FEE = #{tForecastLibrary.personalInterestFee}
			</if>
			<if test="tForecastLibrary.socialHousehold != null and tForecastLibrary.socialHousehold.trim() != ''">
				AND a.SOCIAL_HOUSEHOLD = #{tForecastLibrary.socialHousehold}
			</if>
			<if test="tForecastLibrary.socialHouseholdName != null and tForecastLibrary.socialHouseholdName.trim() != ''">
				AND a.SOCIAL_HOUSEHOLD_NAME = #{tForecastLibrary.socialHouseholdName}
			</if>
			<if test="tForecastLibrary.providentHousehold != null and tForecastLibrary.providentHousehold.trim() != ''">
				AND a.PROVIDENT_HOUSEHOLD = #{tForecastLibrary.providentHousehold}
			</if>
			<if test="tForecastLibrary.providentHouseholdName != null and tForecastLibrary.providentHouseholdName.trim() != ''">
				AND a.PROVIDENT_HOUSEHOLD_NAME = #{tForecastLibrary.providentHouseholdName}
			</if>
			<if test="tForecastLibrary.dataPush != null">
				AND a.DATA_PUSH = #{tForecastLibrary.dataPush}
			</if>
			<if test="tForecastLibrary.dataType != null">
				AND a.DATA_TYPE = #{tForecastLibrary.dataType}
			</if>
			<if test="tForecastLibrary.diffType != null and tForecastLibrary.diffType.trim() != ''">
				AND a.DIFF_TYPE = #{tForecastLibrary.diffType}
			</if>
			<if test="tForecastLibrary.createBy != null and tForecastLibrary.createBy.trim() != ''">
				AND a.CREATE_BY = #{tForecastLibrary.createBy}
			</if>
			<if test="tForecastLibrary.createName != null and tForecastLibrary.createName.trim() != ''">
				AND a.CREATE_NAME = #{tForecastLibrary.createName}
			</if>
			<if test="tForecastLibrary.createTime != null">
				AND a.CREATE_TIME = #{tForecastLibrary.createTime}
			</if>
			<if test="tForecastLibrary.updateBy != null and tForecastLibrary.updateBy.trim() != ''">
				AND a.UPDATE_BY = #{tForecastLibrary.updateBy}
			</if>
			<if test="tForecastLibrary.updateTime != null">
				AND a.UPDATE_TIME = #{tForecastLibrary.updateTime}
			</if>
			<if test="tForecastLibrary.createTimeStart != null">
				AND a.CREATE_TIME >= #{tForecastLibrary.createTimeStart}
			</if>
			<if test="tForecastLibrary.createTimeEnd != null">
				AND a.CREATE_TIME <![CDATA[ <= ]]> #{tForecastLibrary.createTimeEnd}
			</if>
			<if test="tForecastLibrary.authSql != null and tForecastLibrary.authSql.trim() != ''">
				${tForecastLibrary.authSql}
			</if>
		</if>
	</sql>
	<!--tForecastLibrary简单分页查询-->
	<select id="getTForecastLibraryPage" resultMap="tForecastLibraryMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_forecast_library a
		<where>
			1=1
			<include refid="tForecastLibrary_where"/>
		</where>
		order by a.CREATE_TIME desc
	</select>

	<!-- 导出 -->
	<select id="exportLibrary" resultMap="exportMap">
		select
		    a.ID,
			a.EMP_NO,
			a.EMP_NAME,
			a.EMP_IDCARD,
			a.UNIT_NAME,
			a.DEPT_NAME,
			a.DEPT_NO,
			a.UNIT_PENSION_FEE,
			a.UNIT_MEDICAL_FEE,
			a.UNIT_UNEMPLOYMENT_FEE,
			a.UNIT_WORK_INJURY_FEE,
			a.UNIT_BIRTH_FEE,
			a.UNIT_BITAILMENT_FEE,
			a.PERSONAL_PENSION_FEE,
			a.PERSONAL_MEDICAL_FEE,
			a.PERSONAL_UNEMPLOYMENT_FEE,
			a.PERSONAL_BIGAILMENT_FEE,
			a.SOCIAL_PAY_MONTH,
			a.SOCIAL_CREATE_MONTH,
			a.PROVIDENT_PAY_MONTH,
			a.PROVIDENT_CREATE_MONTH,
			a.UNIT_SOCIAL_SUM,
			a.UNIT_FUND_SUM,
			a.PERSONAL_SOCIAL_SUM,
			a.PERSONAL_FUND_SUM,
			a.SUM_ALL,
			a.FUND_PROVINCE,
			a.FUND_CITY,
			a.FUND_TOWN,
			a.SOCIAL_PROVINCE,
			a.SOCIAL_CITY,
			a.SOCIAL_TOWN,
			a.UNIT_PENSION_BASE,
			a.UNIT_MEDICAL_BASE,
			a.UNIT_UNEMPLOYMENT_BASE,
			a.UNIT_INJURY_BASE,
			a.UNIT_BIRTH_BASE,
			a.PERSONAL_PENSION_BASE,
			a.PERSONAL_MEDICAL_BASE,
			a.PERSONAL_UNEMPLOYMENT_BASE,
			a.PERSONAL_BIGAILMENT_BASE,
			a.UNIT_BIGAILMENT_BASE,
			a.UNIT_PERSION_PRO,
			a.UNIT_MEDICAL_PRO,
			a.UNIT_UNEMPLOYMENT_PRO,
			a.UNIT_INJURY_PRO,
			a.UNIT_BIRTH_PRO,
			a.PERSONAL_PERSION_PRO,
			a.PERSONAL_MEDICAL_PRO,
			a.PERSONAL_UNEMPLOYMENT_PRO,
			a.PERSONAL_BIGAILMENT_PRO,
			a.UNIT_BIGAILMENT_PRO,
			a.UNIT_FUND_BASE,
			a.PERSONAL_FUND_BASE,
			a.UNIT_FUND_PROP,
			a.PERSONAL_FUND_PROP,
			a.DATA_PUSH,
			a.CREATE_TIME,
			a.DIFF_TYPE,
			a.DATA_TYPE
		from t_forecast_library a
		<where>
			1=1
			<include refid="tForecastLibrary_where"/>
		</where>
		order by a.CREATE_TIME desc
		<if test="tForecastLibrary.limitStart != null">
			limit #{tForecastLibrary.limitStart},#{tForecastLibrary.limitEnd}
		</if>
	</select>

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

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

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

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

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

	</update>

	<!-- 更改预估社保推送状态 -->
	<update id="updatePushStatus">
		update t_forecast_library set DATA_PUSH = 1
		where
		ID in
		<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
			#{item}
		</foreach>
	</update>

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

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

</mapper>