<?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.salary.mapper.TSalaryAccountMapper">

  <resultMap id="tSalaryAccountMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
    <id property="id" column="ID"/>
    <result property="invoiceTitle" column="INVOICE_TITLE"/>
    <result property="salaryFormId" column="SALARY_FORM_ID"/>
    <result property="salaryMonth" column="SALARY_MONTH"/>
    <result property="empId" column="EMP_ID"/>
    <result property="empName" column="EMP_NAME"/>
    <result property="empIdcard" column="EMP_IDCARD"/>
    <result property="bankNo" column="BANK_NO"/>
    <result property="bankName" column="BANK_NAME"/>
    <result property="deptId" column="DEPT_ID"/>
    <result property="deptNo" column="DEPT_NO"/>
    <result property="deptName" column="DEPT_NAME"/>
    <result property="salaryStyle" column="SALARY_STYLE"/>
    <result property="salaryGiveTime" column="SALARY_GIVE_TIME"/>
    <result property="distributionFlag" column="DISTRIBUTION_FLAG"/>
    <result property="deduSocialMonth" column="DEDU_SOCIAL_MONTH"/>
    <result property="deduProvidentMonth" column="DEDU_PROVIDENT_MONTH"/>
    <result property="formType" column="FORM_TYPE"/>
    <result property="settlementMonth" column="SETTLEMENT_MONTH"/>
    <result property="deleteFlag" column="DELETE_FLAG"/>
    <result property="socialPriority" column="SOCIAL_PRIORITY"/>
    <result property="fundPriority" column="FUND_PRIORITY"/>
    <result property="annualBonusType" column="ANNUAL_BONUS_TYPE"/>
    <result property="taxMonth" column="TAX_MONTH"/>
    <result property="isDeductSocial" column="IS_DEDUCT_SOCIAL"/>
    <result property="isDeductFund" column="IS_DEDUCT_FUND"/>
    <result property="province" column="PROVINCE"/>
    <result property="city" column="CITY"/>
    <result property="town" column="TOWN"/>
    <result property="empPhone" column="EMP_PHONE"/>
    <result property="ownFlag" column="OWN_FLAG"/>
    <result property="isRepeat" column="IS_REPEAT"/>
    <result property="bankSubName" column="BANK_SUB_NAME"/>
    <result property="bankProvince" column="BANK_PROVINCE"/>
    <result property="bankCity" column="BANK_CITY"/>
    <result property="isPersonTax" column="IS_PERSON_TAX"/>
    <result property="relaySalary" column="RELAY_SALARY"/>
    <result property="actualSalary" column="ACTUAL_SALARY"/>
    <result property="salaryTax" column="SALARY_TAX"/>
    <result property="relaySalaryUnit" column="RELAY_SALARY_UNIT"/>
    <result property="salaryTaxUnit" column="SALARY_TAX_UNIT"/>
	<result property="haveSalaryFlag" column="HAVE_SALARY_FLAG"/>
	<result property="haveSpecialFlag" column="HAVE_SPECIAL_FLAG"/>
	<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"/>
  </resultMap>
    <sql id="Base_Column_List">
                a.ID,
                a.INVOICE_TITLE,
                a.SALARY_FORM_ID,
                a.SALARY_MONTH,
                a.EMP_ID,
                a.EMP_NAME,
                a.EMP_IDCARD,
                a.BANK_NO,
                a.BANK_NAME,
                a.DEPT_ID,
                a.DEPT_NO,
                a.DEPT_NAME,
                a.SALARY_STYLE,
                a.SALARY_GIVE_TIME,
                a.DISTRIBUTION_FLAG,
                a.DEDU_SOCIAL_MONTH,
                a.DEDU_PROVIDENT_MONTH,
                a.FORM_TYPE,
                a.SETTLEMENT_MONTH,
                a.DELETE_FLAG,
                a.SOCIAL_PRIORITY,
                a.FUND_PRIORITY,
                a.ANNUAL_BONUS_TYPE,
                a.TAX_MONTH,
                a.IS_DEDUCT_SOCIAL,
                a.IS_DEDUCT_FUND,
                a.PROVINCE,
                a.CITY,
                a.TOWN,
                a.EMP_PHONE,
                a.OWN_FLAG,
                a.IS_REPEAT,
                a.BANK_SUB_NAME,
                a.BANK_PROVINCE,
                a.BANK_CITY,
                a.IS_PERSON_TAX,
                a.RELAY_SALARY,
                a.ACTUAL_SALARY,
                a.SALARY_TAX,
                a.RELAY_SALARY_UNIT,
                a.SALARY_TAX_UNIT,
                a.HAVE_SALARY_FLAG,
                a.HAVE_SPECIAL_FLAG,
				a.CREATE_BY,
                a.CREATE_NAME,
                a.CREATE_TIME,
                a.UPDATE_BY,
                a.UPDATE_TIME
    </sql>
    <sql id="tSalaryAccount_where">
        <if test="tSalaryAccount != null">
                    <if test="tSalaryAccount.id != null and tSalaryAccount.id.trim() != ''">
                        AND a.ID = #{tSalaryAccount.id}
                    </if>
                    <if test="tSalaryAccount.invoiceTitle != null and tSalaryAccount.invoiceTitle.trim() != ''">
                        AND a.INVOICE_TITLE = #{tSalaryAccount.invoiceTitle}
                    </if>
                    <if test="tSalaryAccount.salaryFormId != null and tSalaryAccount.salaryFormId.trim() != ''">
                        AND a.SALARY_FORM_ID = #{tSalaryAccount.salaryFormId}
                    </if>
                    <if test="tSalaryAccount.salaryMonth != null and tSalaryAccount.salaryMonth.trim() != ''">
                        AND a.SALARY_MONTH = #{tSalaryAccount.salaryMonth}
                    </if>
                    <if test="tSalaryAccount.empId != null and tSalaryAccount.empId.trim() != ''">
                        AND a.EMP_ID = #{tSalaryAccount.empId}
                    </if>
                    <if test="tSalaryAccount.empName != null and tSalaryAccount.empName.trim() != ''">
                        AND a.EMP_NAME = #{tSalaryAccount.empName}
                    </if>
                    <if test="tSalaryAccount.empIdcard != null and tSalaryAccount.empIdcard.trim() != ''">
                        AND a.EMP_IDCARD = #{tSalaryAccount.empIdcard}
                    </if>
                    <if test="tSalaryAccount.bankNo != null and tSalaryAccount.bankNo.trim() != ''">
                        AND a.BANK_NO = #{tSalaryAccount.bankNo}
                    </if>
                    <if test="tSalaryAccount.bankName != null and tSalaryAccount.bankName.trim() != ''">
                        AND a.BANK_NAME = #{tSalaryAccount.bankName}
                    </if>
                    <if test="tSalaryAccount.deptId != null and tSalaryAccount.deptId.trim() != ''">
                        AND a.DEPT_ID = #{tSalaryAccount.deptId}
                    </if>
                    <if test="tSalaryAccount.deptNo != null and tSalaryAccount.deptNo.trim() != ''">
                        AND a.DEPT_NO = #{tSalaryAccount.deptNo}
                    </if>
                    <if test="tSalaryAccount.deptName != null and tSalaryAccount.deptName.trim() != ''">
                        AND a.DEPT_NAME = #{tSalaryAccount.deptName}
                    </if>
                    <if test="tSalaryAccount.salaryStyle != null and tSalaryAccount.salaryStyle.trim() != ''">
                        AND a.SALARY_STYLE = #{tSalaryAccount.salaryStyle}
                    </if>
                    <if test="tSalaryAccount.salaryGiveTime != null and tSalaryAccount.salaryGiveTime.trim() != ''">
                        AND a.SALARY_GIVE_TIME = #{tSalaryAccount.salaryGiveTime}
                    </if>
                    <if test="tSalaryAccount.distributionFlag != null and tSalaryAccount.distributionFlag.trim() != ''">
                        AND a.DISTRIBUTION_FLAG = #{tSalaryAccount.distributionFlag}
                    </if>
                    <if test="tSalaryAccount.deduSocialMonth != null and tSalaryAccount.deduSocialMonth.trim() != ''">
                        AND a.DEDU_SOCIAL_MONTH = #{tSalaryAccount.deduSocialMonth}
                    </if>
                    <if test="tSalaryAccount.deduProvidentMonth != null and tSalaryAccount.deduProvidentMonth.trim() != ''">
                        AND a.DEDU_PROVIDENT_MONTH = #{tSalaryAccount.deduProvidentMonth}
                    </if>
                    <if test="tSalaryAccount.formType != null and tSalaryAccount.formType.trim() != ''">
                        AND a.FORM_TYPE = #{tSalaryAccount.formType}
                    </if>
                    <if test="tSalaryAccount.settlementMonth != null and tSalaryAccount.settlementMonth.trim() != ''">
                        AND a.SETTLEMENT_MONTH = #{tSalaryAccount.settlementMonth}
                    </if>
                    <if test="tSalaryAccount.deleteFlag != null">
                        AND a.DELETE_FLAG = #{tSalaryAccount.deleteFlag}
                    </if>
                    <if test="tSalaryAccount.socialPriority != null and tSalaryAccount.socialPriority.trim() != ''">
                        AND a.SOCIAL_PRIORITY = #{tSalaryAccount.socialPriority}
                    </if>
                    <if test="tSalaryAccount.fundPriority != null and tSalaryAccount.fundPriority.trim() != ''">
                        AND a.FUND_PRIORITY = #{tSalaryAccount.fundPriority}
                    </if>
                    <if test="tSalaryAccount.annualBonusType != null and tSalaryAccount.annualBonusType.trim() != ''">
                        AND a.ANNUAL_BONUS_TYPE = #{tSalaryAccount.annualBonusType}
                    </if>
                    <if test="tSalaryAccount.taxMonth != null and tSalaryAccount.taxMonth.trim() != ''">
                        AND a.TAX_MONTH = #{tSalaryAccount.taxMonth}
                    </if>
                    <if test="tSalaryAccount.isDeductSocial != null and tSalaryAccount.isDeductSocial.trim() != ''">
                        AND a.IS_DEDUCT_SOCIAL = #{tSalaryAccount.isDeductSocial}
                    </if>
                    <if test="tSalaryAccount.isDeductFund != null and tSalaryAccount.isDeductFund.trim() != ''">
                        AND a.IS_DEDUCT_FUND = #{tSalaryAccount.isDeductFund}
                    </if>
                    <if test="tSalaryAccount.province != null">
                        AND a.PROVINCE = #{tSalaryAccount.province}
                    </if>
                    <if test="tSalaryAccount.city != null">
                        AND a.CITY = #{tSalaryAccount.city}
                    </if>
                    <if test="tSalaryAccount.town != null">
                        AND a.TOWN = #{tSalaryAccount.town}
                    </if>
                    <if test="tSalaryAccount.empPhone != null and tSalaryAccount.empPhone.trim() != ''">
                        AND a.EMP_PHONE = #{tSalaryAccount.empPhone}
                    </if>
                    <if test="tSalaryAccount.ownFlag != null">
                        AND a.OWN_FLAG = #{tSalaryAccount.ownFlag}
                    </if>
                    <if test="tSalaryAccount.isRepeat != null">
                        AND a.IS_REPEAT = #{tSalaryAccount.isRepeat}
                    </if>
                    <if test="tSalaryAccount.bankSubName != null and tSalaryAccount.bankSubName.trim() != ''">
                        AND a.BANK_SUB_NAME = #{tSalaryAccount.bankSubName}
                    </if>
                    <if test="tSalaryAccount.bankProvince != null">
                        AND a.BANK_PROVINCE = #{tSalaryAccount.bankProvince}
                    </if>
                    <if test="tSalaryAccount.bankCity != null">
                        AND a.BANK_CITY = #{tSalaryAccount.bankCity}
                    </if>
                    <if test="tSalaryAccount.isPersonTax != null and tSalaryAccount.isPersonTax.trim() != ''">
                        AND a.IS_PERSON_TAX = #{tSalaryAccount.isPersonTax}
                    </if>
                    <if test="tSalaryAccount.relaySalary != null">
                        AND a.RELAY_SALARY = #{tSalaryAccount.relaySalary}
                    </if>
                    <if test="tSalaryAccount.actualSalary != null">
                        AND a.ACTUAL_SALARY = #{tSalaryAccount.actualSalary}
                    </if>
                    <if test="tSalaryAccount.salaryTax != null">
                        AND a.SALARY_TAX = #{tSalaryAccount.salaryTax}
                    </if>
                    <if test="tSalaryAccount.relaySalaryUnit != null">
                        AND a.RELAY_SALARY_UNIT = #{tSalaryAccount.relaySalaryUnit}
                    </if>
                    <if test="tSalaryAccount.salaryTaxUnit != null">
                        AND a.SALARY_TAX_UNIT = #{tSalaryAccount.salaryTaxUnit}
                    </if>
        </if>
    </sql>
    <!--tSalaryAccount简单分页查询-->
    <select id="getTSalaryAccountPage" resultMap="tSalaryAccountMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_salary_account a
		LEFT JOIN t_dept_see d ON a.DEPT_NO = d.DEPT_NO
        <where>
			a.DELETE_FLAG = 0 AND (d.CAN_SEE = 0 OR d.id is null)
			<include refid="tSalaryAccount_where"/>
        </where>
		order by a.CREATE_TIME desc
    </select>

	<!-- 获取校验的报账明细 ### 格式：身份证号_工资月份_报表类型_应发金额 -->
	<select id="getAccountCheckList" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo">
		select
			CONCAT(a.EMP_IDCARD,"_",a.SALARY_MONTH,"_",a.FORM_TYPE) title,ifnull(ifnull(relaySalary.SALARY_MONEY,actSalary.SALARY_MONEY),0) relaySalary
		from t_salary_account a
				 left join t_salary_account_item relaySalary on relaySalary.SALARY_ACCOUNT_ID = a.id and relaySalary.JAVA_FIED_NAME='relaySalary'
				 left join t_salary_account_item actSalary on actSalary.SALARY_ACCOUNT_ID = a.id and actSalary.JAVA_FIED_NAME='actualSalarySum'
		where a.DELETE_FLAG = 0 and a.DEPT_ID = #{settleId} and a.SALARY_MONTH = #{settleMonth}
	</select>

	<!-- 获取校验的报账明细 ### 格式：身份证号_工资月份_报表类型_应发金额 -->
	<select id="getAccountSpecialList" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo">
		select
			a.EMP_IDCARD title,sum(ifnull(relaySalary.SALARY_MONEY,0)) relaySalary
		from t_salary_account a
		left join t_salary_standard s on a.SALARY_FORM_ID = s.id
		left join t_salary_account_item relaySalary on relaySalary.SALARY_ACCOUNT_ID = a.id and relaySalary.JAVA_FIED_NAME='relaySalary'
		where a.DELETE_FLAG = 0 and s.UNIT_ID = #{unitId} and a.SALARY_MONTH = #{salaryMonth} and a.INVOICE_TITLE = #{invoiceTitle}
		and a.FORM_TYPE !='3' and a.FORM_TYPE !='4'
		group by a.EMP_IDCARD
	</select>

	<!-- 获取校验的报账明细 ### 格式：身份证号_工资月份_报表类型_应发金额 -->
	<select id="getAccountCheckListLabor" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo">
		select
			CONCAT(a.EMP_IDCARD,"_",a.SALARY_MONTH,"_",a.FORM_TYPE) title,ifnull(actSalary.SALARY_MONEY,0) relaySalary
		from t_salary_account a
				 left join t_salary_account_item actSalary on actSalary.SALARY_ACCOUNT_ID = a.id and actSalary.JAVA_FIED_NAME='actualSalarySum'
		where a.DELETE_FLAG = 0 and a.DEPT_ID = #{settleId} and a.SALARY_MONTH = #{settleMonth}
	</select>

	<!-- 获取当前年最小计税月 -->
	<select id="getMinTaxMonthByNowYear" resultType="java.lang.String">
		select
			concat(min(a.TAX_MONTH - 0),'')
		from t_salary_account a
		where a.EMP_IDCARD = #{empIdCard} and a.DELETE_FLAG = 0 and a.SETTLEMENT_MONTH like concat(#{nowYear},"%")
		  and a.FORM_TYPE != '3' and a.FORM_TYPE != '4'
	</select>

	<select id="getLastMonthTHaveSalaryNosocial"  resultType="com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial">
		select a.EMP_ID           employee_id
			 , a.EMP_IDCARD       employee_id_card
			 , a.EMP_NAME         employee_name
			 , GROUP_CONCAT(a.relaySalary)    relay_salary
			 , a.CREATE_BY      CREATE_USER_ID
			 , GROUP_CONCAT(a.SALARY_MONTH)      month
			 , a.EMP_NAME         employee_name
			 , a.EMP_IDCARD       employee_id_card
			 , a.DEPT_ID          settle_domain_id
			 , a.DEPT_NAME        SETTLEMENT_ORGAN_NAME
			 , a.DEPT_NO          SETTLEMENT_ORGAN_NO
			 , a.SETTLEMENT_MONTH SETTLE_MONTH
		from (
				 select a.id
					  , s.DEPT_ID
					  , s.DEPT_NAME
					  , s.DEPT_NO
					  , s.CREATE_BY
					  , a.SALARY_FORM_ID
					  , a.EMP_ID
					  , a.EMP_IDCARD
					  , a.EMP_NAME
					  , a.SALARY_MONTH
					  , a.SETTLEMENT_MONTH
					  , if(item.JAVA_FIED_NAME = 'relaySalary', item.SALARY_MONEY, 0) relaySalary
					  , sum(if(item.JAVA_FIED_NAME in
							   ('unitSocial', 'personalSocial', 'withholidingUnitSocial', 'withholidingPersonSocial'),
							   item.SALARY_MONEY, 0))                                 social
				 from mvp_salary.t_salary_account a
						  left join mvp_salary.t_salary_account_item item on item.SALARY_ACCOUNT_ID = a.id
						  LEFT JOIN mvp_salary.t_salary_standard s on a.SALARY_FORM_ID = s.id

				 where
					 a.DELETE_FLAG = 0
				   and s.send_month in ( #{month} , #{month2} , #{month3})
				   AND s.STATUS IN (3, 4)
				 GROUP BY a.EMP_IDCARD, a.SALARY_MONTH limit 10
			 ) a
		where a.relaySalary > 0
		  and a.social = 0
		GROUP BY a.EMP_IDCARD  HAVING count(1) = 3
	</select>

	<!-- 薪资类型互斥校验 获取本年度身份证号列表 -->
	<select id="getAccountYearCheckList" resultType="java.lang.String">
		select a.EMP_IDCARD
		from t_salary_account a
		where a.DELETE_FLAG = 0 and a.FORM_TYPE = '0' and a.SALARY_MONTH like concat(DATE_FORMAT(NOW(), '%Y'), '%')
	</select>

	<select id="noPageDiy" resultMap="tSalaryAccountMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_salary_account a
		LEFT JOIN t_dept_see d ON a.DEPT_NO = d.DEPT_NO
		<where>
			a.DELETE_FLAG = 0 AND (d.CAN_SEE = 0 OR d.id is null)
			<include refid="where_export"/>
			ORDER BY a.CREATE_TIME desc
			<if test="searchVo != null">
				<if test="searchVo.limitStart != null">
					limit #{searchVo.limitStart},#{searchVo.limitEnd}
				</if>
			</if>
		</where>

	</select>
	<select id="noPageCountDiy"  resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM t_salary_account a
		LEFT JOIN t_dept_see d ON a.DEPT_NO = d.DEPT_NO
		<where>
			a.DELETE_FLAG = 0 AND (d.CAN_SEE = 0 OR d.id is null)
			<include refid="where_export"/>
		</where>
	</select>
	<sql id="where_export">
		<if test="idList != null and idList.size>0">
			AND a.id in
			<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
				#{idStr}
			</foreach>
		</if>
		<if test="searchVo != null">
			<if test="searchVo.id != null and searchVo.id.trim() != ''">
				AND a.ID = #{searchVo.id}
			</if>
			<if test="searchVo.invoiceTitle != null and searchVo.invoiceTitle.trim() != ''">
				AND a.INVOICE_TITLE = #{searchVo.invoiceTitle}
			</if>
			<if test="searchVo.salaryFormId != null and searchVo.salaryFormId.trim() != ''">
				AND a.SALARY_FORM_ID = #{searchVo.salaryFormId}
			</if>
			<if test="searchVo.salaryMonth != null and searchVo.salaryMonth.trim() != ''">
				AND a.SALARY_MONTH = #{searchVo.salaryMonth}
			</if>
			<if test="searchVo.empId != null and searchVo.empId.trim() != ''">
				AND a.EMP_ID = #{searchVo.empId}
			</if>
			<if test="searchVo.empName != null and searchVo.empName.trim() != ''">
				AND a.EMP_NAME = #{searchVo.empName}
			</if>
			<if test="searchVo.empIdcard != null and searchVo.empIdcard.trim() != ''">
				AND a.EMP_IDCARD = #{searchVo.empIdcard}
			</if>
			<if test="searchVo.bankNo != null and searchVo.bankNo.trim() != ''">
				AND a.BANK_NO = #{searchVo.bankNo}
			</if>
			<if test="searchVo.bankName != null and searchVo.bankName.trim() != ''">
				AND a.BANK_NAME = #{searchVo.bankName}
			</if>
			<if test="searchVo.deptId != null and searchVo.deptId.trim() != ''">
				AND a.DEPT_ID = #{searchVo.deptId}
			</if>
			<if test="searchVo.deptNo != null and searchVo.deptNo.trim() != ''">
				AND a.DEPT_NO = #{searchVo.deptNo}
			</if>
			<if test="searchVo.deptName != null and searchVo.deptName.trim() != ''">
				AND a.DEPT_NAME = #{searchVo.deptName}
			</if>
			<if test="searchVo.salaryStyle != null and searchVo.salaryStyle.trim() != ''">
				AND a.SALARY_STYLE = #{searchVo.salaryStyle}
			</if>
			<if test="searchVo.salaryGiveTime != null and searchVo.salaryGiveTime.trim() != ''">
				AND a.SALARY_GIVE_TIME = #{searchVo.salaryGiveTime}
			</if>
			<if test="searchVo.distributionFlag != null and searchVo.distributionFlag.trim() != ''">
				AND a.DISTRIBUTION_FLAG = #{searchVo.distributionFlag}
			</if>
			<if test="searchVo.deduSocialMonth != null and searchVo.deduSocialMonth.trim() != ''">
				AND a.DEDU_SOCIAL_MONTH = #{searchVo.deduSocialMonth}
			</if>
			<if test="searchVo.deduProvidentMonth != null and searchVo.deduProvidentMonth.trim() != ''">
				AND a.DEDU_PROVIDENT_MONTH = #{searchVo.deduProvidentMonth}
			</if>
			<if test="searchVo.formType != null and searchVo.formType.trim() != ''">
				AND a.FORM_TYPE = #{searchVo.formType}
			</if>
			<if test="searchVo.settlementMonth != null and searchVo.settlementMonth.trim() != ''">
				AND a.SETTLEMENT_MONTH = #{searchVo.settlementMonth}
			</if>
			<if test="searchVo.deleteFlag != null">
				AND a.DELETE_FLAG = #{searchVo.deleteFlag}
			</if>
			<if test="searchVo.socialPriority != null and searchVo.socialPriority.trim() != ''">
				AND a.SOCIAL_PRIORITY = #{searchVo.socialPriority}
			</if>
			<if test="searchVo.fundPriority != null and searchVo.fundPriority.trim() != ''">
				AND a.FUND_PRIORITY = #{searchVo.fundPriority}
			</if>
			<if test="searchVo.annualBonusType != null and searchVo.annualBonusType.trim() != ''">
				AND a.ANNUAL_BONUS_TYPE = #{searchVo.annualBonusType}
			</if>
			<if test="searchVo.taxMonth != null and searchVo.taxMonth.trim() != ''">
				AND a.TAX_MONTH = #{searchVo.taxMonth}
			</if>
			<if test="searchVo.isDeductSocial != null and searchVo.isDeductSocial.trim() != ''">
				AND a.IS_DEDUCT_SOCIAL = #{searchVo.isDeductSocial}
			</if>
			<if test="searchVo.isDeductFund != null and searchVo.isDeductFund.trim() != ''">
				AND a.IS_DEDUCT_FUND = #{searchVo.isDeductFund}
			</if>
			<if test="searchVo.province != null">
				AND a.PROVINCE = #{searchVo.province}
			</if>
			<if test="searchVo.city != null">
				AND a.CITY = #{searchVo.city}
			</if>
			<if test="searchVo.town != null">
				AND a.TOWN = #{searchVo.town}
			</if>
			<if test="searchVo.empPhone != null and searchVo.empPhone.trim() != ''">
				AND a.EMP_PHONE = #{searchVo.empPhone}
			</if>
			<if test="searchVo.ownFlag != null">
				AND a.OWN_FLAG = #{searchVo.ownFlag}
			</if>
			<if test="searchVo.isRepeat != null">
				AND a.IS_REPEAT = #{searchVo.isRepeat}
			</if>
			<if test="searchVo.bankSubName != null and searchVo.bankSubName.trim() != ''">
				AND a.BANK_SUB_NAME = #{searchVo.bankSubName}
			</if>
			<if test="searchVo.bankProvince != null">
				AND a.BANK_PROVINCE = #{searchVo.bankProvince}
			</if>
			<if test="searchVo.bankCity != null">
				AND a.BANK_CITY = #{searchVo.bankCity}
			</if>
			<if test="searchVo.isPersonTax != null and searchVo.isPersonTax.trim() != ''">
				AND a.IS_PERSON_TAX = #{searchVo.isPersonTax}
			</if>
			<if test="searchVo.relaySalary != null">
				AND a.RELAY_SALARY = #{searchVo.relaySalary}
			</if>
			<if test="searchVo.actualSalary != null">
				AND a.ACTUAL_SALARY = #{searchVo.actualSalary}
			</if>
			<if test="searchVo.salaryTax != null">
				AND a.SALARY_TAX = #{searchVo.salaryTax}
			</if>
			<if test="searchVo.relaySalaryUnit != null">
				AND a.RELAY_SALARY_UNIT = #{searchVo.relaySalaryUnit}
			</if>
			<if test="searchVo.salaryTaxUnit != null">
				AND a.SALARY_TAX_UNIT = #{searchVo.salaryTaxUnit}
			</if>
		</if>
	</sql>
</mapper>
