TSalaryAccountMapper.xml 83.2 KB
Newer Older
hongguangwu's avatar
hongguangwu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<?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"/>
39 40 41
	<result property="unitId" column="UNIT_ID"/>
	<result property="unitName" column="UNIT_NAME"/>
	<result property="unitNo" column="UNIT_NO"/>
hongguangwu's avatar
hongguangwu committed
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
    <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"/>
hongguangwu's avatar
hongguangwu committed
71 72
	<result property="haveSalaryFlag" column="HAVE_SALARY_FLAG"/>
	<result property="haveSpecialFlag" column="HAVE_SPECIAL_FLAG"/>
hongguangwu's avatar
hongguangwu committed
73 74 75 76 77
	<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"/>
hongguangwu's avatar
hongguangwu committed
78 79 80 81 82
	<result property="sendStatus" column="SEND_STATUS"/>
	<result property="sendTime" column="SEND_TIME"/>
	<result property="sendUser" column="SEND_USER"/>
	<result property="sendUserName" column="SEND_USER_NAME"/>
	<result property="sendMonth" column="SEND_MONTH"/>
83
	<result property="orderId" column="ORDER_ID"/>
hongguangwu's avatar
hongguangwu committed
84 85 86 87 88 89 90 91 92 93 94 95 96

	<result property="unitSocial" column="UNIT_SOCIAL"/>
	<result property="personSocial" column="PERSON_SOCIAL"/>
	<result property="unitFund" column="UNIT_FUND"/>
	<result property="personFund" column="PERSON_FUND"/>
	<result property="costReduction" column="COST_REDUCTION"/>
	<result property="annualBonusTax" column="ANNUAL_BONUS_TAX"/>
	<result property="sumChildEduMoney" column="SUM_CHILD_EDU_MONEY"/>
	<result property="sumHousingLoanMoney" column="SUM_HOUSING_LOAN_MONEY"/>
	<result property="sumHousingRentMoney" column="SUM_HOUSING_RENT_MONEY"/>
	<result property="sumSupportElderlyMoney" column="SUM_SUPPORT_ELDERLY_MONEY"/>
	<result property="sumContinuingEducationMoney" column="SUM_CONTINUING_EDUCATION_MONEY"/>
	<result property="sumBabyMoney" column="SUM_BABY_MONEY"/>
97
	<result property="sumPrivatePension" column="SUM_PRIVATE_PENSION"/>
huyuchen's avatar
huyuchen committed
98 99
	<result property="incomeSettleFlag" column="INCOME_SETTLE_FLAG"/>
	<result property="incomeCollectFlag" column="INCOME_COLLECT_FLAG"/>
hongguangwu's avatar
hongguangwu committed
100 101
	<result property="paySettleFlag" column="PAY_SETTLE_FLAG"/>
	<result property="payCollectFlag" column="PAY_COLLECT_FLAG"/>
hongguangwu's avatar
hongguangwu committed
102
	<result property="isDiff" column="IS_DIFF"/>
hongguangwu's avatar
hongguangwu committed
103
  </resultMap>
hongguangwu's avatar
hongguangwu committed
104

hongguangwu's avatar
hongguangwu committed
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
	<resultMap id="tSalaryAccountWebExportMap" 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="unitId" column="UNIT_ID"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="unitNo" column="UNIT_NO"/>
		<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"/>
		<result property="sendStatus" column="SEND_STATUS"/>
		<result property="sendTime" column="SEND_TIME"/>
		<result property="sendUser" column="SEND_USER"/>
		<result property="sendUserName" column="SEND_USER_NAME"/>
		<result property="sendMonth" column="SEND_MONTH"/>
		<result property="orderId" column="ORDER_ID"/>

		<result property="unitSocial" column="UNIT_SOCIAL"/>
		<result property="personSocial" column="PERSON_SOCIAL"/>
		<result property="unitFund" column="UNIT_FUND"/>
		<result property="personFund" column="PERSON_FUND"/>
		<result property="costReduction" column="COST_REDUCTION"/>
		<result property="annualBonusTax" column="ANNUAL_BONUS_TAX"/>
		<result property="sumChildEduMoney" column="SUM_CHILD_EDU_MONEY"/>
		<result property="sumHousingLoanMoney" column="SUM_HOUSING_LOAN_MONEY"/>
		<result property="sumHousingRentMoney" column="SUM_HOUSING_RENT_MONEY"/>
		<result property="sumSupportElderlyMoney" column="SUM_SUPPORT_ELDERLY_MONEY"/>
		<result property="sumContinuingEducationMoney" column="SUM_CONTINUING_EDUCATION_MONEY"/>
		<result property="sumBabyMoney" column="SUM_BABY_MONEY"/>
		<result property="sumPrivatePension" column="SUM_PRIVATE_PENSION"/>
		<result property="incomeSettleFlag" column="INCOME_SETTLE_FLAG"/>
		<result property="incomeCollectFlag" column="INCOME_COLLECT_FLAG"/>
		<result property="paySettleFlag" column="PAY_SETTLE_FLAG"/>
		<result property="payCollectFlag" column="PAY_COLLECT_FLAG"/>
		<result property="isDiff" column="IS_DIFF"/>
		<result property="enterpriseAnnuity" column="ENTERPRISE_ANNUITY"/>
		<result property="pdeductionMoney" column="PDEDUCTION_MONEY"/>
	</resultMap>

186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
	<!-- B端薪酬第一个统计列表 -->
	<resultMap id="settlementFormVoMap" type="com.yifu.cloud.plus.v1.yifu.salary.vo.SettlementFormVo">
		<result property="salaryMonth" column="SALARY_MONTH"/>
		<result property="personTime" column="PERSON_TIME"/>
		<result property="salarySum" column="SALARY_SUM"/>
		<result property="cardPay" column="CARD_PAY"/>
		<result property="laborCosts" column="LABOR_COSTS"/>
	</resultMap>

	<!-- B端工资报账信息 -->
	<resultMap id="salaryAccountAndItemVoMap" type="com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountAndItemVo">
		<id property="id" column="ID"/>
		<result property="salaryDate" column="SALARY_DATE"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<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="salaryType" column="SALARY_TYPE"/>
		<result property="settlementMonth" column="SETTLEMENT_MONTH"/>
		<result property="relaySalary" column="RELAY_SALARY"/>
		<result property="actualSalarySum" column="ACTUAL_SALARY_SUM"/>
		<result property="salaryTax" column="SALARY_TAX"/>
		<result property="unitSocial" column="UNIT_SOCIAL"/>
		<result property="personalSocial" column="PERSONAL_SOCIAL"/>
		<result property="unitFund" column="UNIT_FUND"/>
		<result property="personalFund" column="PERSONAL_FUND"/>
		<result property="revenueTime" column="REVENUE_TIME"/>
	</resultMap>

hongguangwu's avatar
hongguangwu committed
217
	<!-- 对接EKP的参数 -->
218
	<resultMap id="ekpSalaryParamVoMap" type="com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo">
hongguangwu's avatar
hongguangwu committed
219
		<result property="fd_3b10af838eab5c" column="fd_3b10af838eab5c"/>
hongguangwu's avatar
hongguangwu committed
220 221 222 223 224 225 226 227 228
		<result property="fd_3adfedf98ccba2" column="fd_3adfedf98ccba2"/>
		<result property="fd_3adfedf9d2bf1c" column="fd_3adfedf9d2bf1c"/>
		<result property="fd_3adfedfacd65d6" column="fd_3adfedfacd65d6"/>
		<result property="fd_3adfedfb174068" column="fd_3adfedfb174068"/>
		<result property="fd_3adfedfb5a68a2" column="fd_3adfedfb5a68a2"/>
		<result property="fd_3adfedfb8f76d4" column="fd_3adfedfb8f76d4"/>
		<result property="fd_3adfedfbd23ab8" column="fd_3adfedfbd23ab8"/>
		<result property="fd_3adfedfcb17f1e" column="fd_3adfedfcb17f1e"/>
		<result property="fd_3adfedfc453cc4" column="fd_3adfedfc453cc4"/>
229
		<result property="fd_3b73de2809465a" column="fd_3b73de2809465a"/>
hongguangwu's avatar
hongguangwu committed
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
		<result property="fd_3adfee063acff0" column="fd_3adfee063acff0"/>
		<result property="fd_3adfee0690737c" column="fd_3adfee0690737c"/>
		<result property="fd_3adfee01668666" column="fd_3adfee01668666"/>
		<result property="fd_3adfedfed8bb28" column="fd_3adfedfed8bb28"/>
		<result property="fd_3adfedff3a7430" column="fd_3adfedff3a7430"/>
		<result property="fd_3adfee0009d070" column="fd_3adfee0009d070"/>
		<result property="fd_3adfee01dea2fa" column="fd_3adfee01dea2fa"/>
		<result property="fd_3adfee12cb8840" column="fd_3adfee12cb8840"/>
		<result property="fd_3adfee1374ed7a" column="fd_3adfee1374ed7a"/>
		<result property="fd_3adfee1e2b2f78" column="fd_3adfee1e2b2f78"/>
		<result property="fd_3adfee1e88723e" column="fd_3adfee1e88723e"/>
		<result property="fd_3adfee1ee24680" column="fd_3adfee1ee24680"/>
		<result property="fd_3adfee1f32fa24" column="fd_3adfee1f32fa24"/>
		<result property="fd_3adfee1f901c46" column="fd_3adfee1f901c46"/>
		<result property="fd_3adfee20fe5ba4" column="fd_3adfee20fe5ba4"/>
		<result property="fd_3af9d49d165e90" column="fd_3af9d49d165e90"/>
		<result property="fd_3afab1895feea2" column="fd_3afab1895feea2"/>
hongguangwu's avatar
hongguangwu committed
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
		<result property="fd_3adfedfa4410aa" column="fd_3adfedfa4410aa"/>
		<result property="fd_3adfee1ff1ca6a" column="fd_3adfee1ff1ca6a"/>
		<result property="fd_3adfee203f86b2" column="fd_3adfee203f86b2"/>
		<result property="fd_3adfee21802434" column="fd_3adfee21802434"/>
		<result property="fd_3adfee4ba5ad36" column="fd_3adfee4ba5ad36"/>
		<result property="fd_3adfee4c0c59ee" column="fd_3adfee4c0c59ee"/>
		<result property="fd_3adfee5dd14866" column="fd_3adfee5dd14866"/>
		<result property="fd_3adfee5e3d1638" column="fd_3adfee5e3d1638"/>
		<result property="fd_3adfeeb34ea0ea" column="fd_3adfeeb34ea0ea"/>
		<result property="fd_3adfeededfb5a6" column="fd_3adfeededfb5a6"/>
		<result property="fd_3adfeed3a20598" column="fd_3adfeed3a20598"/>
		<result property="fd_3aea30866d0c30" column="fd_3aea30866d0c30"/>
		<result property="fd_3aea309696d32e" column="fd_3aea309696d32e"/>
		<result property="fd_3adfeec6db8766" column="fd_3adfeec6db8766"/>
		<result property="fd_3adfeef8ef38fc" column="fd_3adfeef8ef38fc"/>
		<result property="fd_3adfeedd08222c" column="fd_3adfeedd08222c"/>
		<result property="fd_3aeadede4cea84" column="fd_3aeadede4cea84"/>
		<result property="fd_3aeadee1cf1266" column="fd_3aeadee1cf1266"/>
		<result property="fd_3adfeec730ec44" column="fd_3adfeec730ec44"/>
		<result property="fd_3adfeef9440ab2" column="fd_3adfeef9440ab2"/>
		<result property="fd_3adfeedd5f3cb2" column="fd_3adfeedd5f3cb2"/>
		<result property="fd_3aeadf17522642" column="fd_3aeadf17522642"/>
		<result property="fd_3aeadf17b7d03a" column="fd_3aeadf17b7d03a"/>
		<result property="fd_3adfeec782070a" column="fd_3adfeec782070a"/>
		<result property="fd_3adfeef9b9fb3e" column="fd_3adfeef9b9fb3e"/>
		<result property="fd_3adfeeddacf6d4" column="fd_3adfeeddacf6d4"/>
		<result property="fd_3aeadf182ef6a2" column="fd_3aeadf182ef6a2"/>
		<result property="fd_3aeadf1892fdb2" column="fd_3aeadf1892fdb2"/>
		<result property="fd_3adfeec7ccdd1c" column="fd_3adfeec7ccdd1c"/>
		<result property="fd_3adfeefa1eba32" column="fd_3adfeefa1eba32"/>
		<result property="fd_3adfeede08d430" column="fd_3adfeede08d430"/>
		<result property="fd_3aeadf191c62a0" column="fd_3aeadf191c62a0"/>
		<result property="fd_3aeadf1992544c" column="fd_3aeadf1992544c"/>
		<result property="fd_3af9d49d165e90" column="fd_3af9d49d165e90"/>
		<result property="fd_3afab1895feea2" column="fd_3afab1895feea2"/>
282 283 284 285 286 287
		<result property="fd_3b16ce48a9735c" column="fd_3b16ce48a9735c"/>
		<result property="fd_3b16ce4b7fc42a" column="fd_3b16ce4b7fc42a"/>
		<result property="deduSocialMonth" column="DEDU_SOCIAL_MONTH"/>
		<result property="deduProvidentMonth" column="DEDU_PROVIDENT_MONTH"/>
		<result property="socialSum" column="social_sum"/>
		<result property="fundSum" column="fund_sum"/>
hongguangwu's avatar
hongguangwu committed
288
		<result property="fd_3b178f0ded2114" column="fd_3b178f0ded2114"/>
hongguangwu's avatar
hongguangwu committed
289
		<result property="fd_3b3bef19b61c38" column="fd_3b3bef19b61c38"/>
hongguangwu's avatar
hongguangwu committed
290
		<result property="fd_3bbbfdd1fc2950" column="fd_3bbbfdd1fc2950"/>
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307

		<!-- 客服导出额外字段 -->
		<result property="fd_3bcd41d65d5bb2" column="fd_3bcd41d65d5bb2"/>
		<result property="fd_3bcd41dc41cf6a" column="fd_3bcd41dc41cf6a"/>
		<result property="fd_3bcd41dfb9f00e" column="fd_3bcd41dfb9f00e"/>
		<result property="fd_3bcd41d857b764" column="fd_3bcd41d857b764"/>
		<result property="fd_3bcd41d939aa64" column="fd_3bcd41d939aa64"/>
		<result property="fd_3bcd41d453de50" column="fd_3bcd41d453de50"/>
		<result property="fd_3bcd41dd8b4232" column="fd_3bcd41dd8b4232"/>
		<result property="fd_3bcd41d0ae6648" column="fd_3bcd41d0ae6648"/>
		<result property="fd_3bcd41d550a756" column="fd_3bcd41d550a756"/>
		<result property="fd_3bcd41d1f6f58a" column="fd_3bcd41d1f6f58a"/>
		<result property="fd_3bcd41de98a582" column="fd_3bcd41de98a582"/>
		<result property="fd_3bcd41d361534e" column="fd_3bcd41d361534e"/>
		<result property="fd_3bcd41db081b72" column="fd_3bcd41db081b72"/>
		<result property="fd_3bcd41da212afe" column="fd_3bcd41da212afe"/>
		<result property="fd_3bcd41d77e4812" column="fd_3bcd41d77e4812"/>
308
		<result property="fd_3bcdee91cacb6c" column="fd_3bcdee91cacb6c"/>
309
		<result property="fd_3c3e5ff65115a2" column="fd_3c3e5ff65115a2"/>
310

hongguangwu's avatar
hongguangwu committed
311
	</resultMap>
hongguangwu's avatar
hongguangwu committed
312 313 314 315 316 317 318 319 320 321 322 323 324
    <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,
325 326 327
				a.UNIT_ID,
                a.UNIT_NAME,
                a.UNIT_NO,
hongguangwu's avatar
hongguangwu committed
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
                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,
hongguangwu's avatar
hongguangwu committed
356 357
                a.SALARY_TAX_UNIT,
                a.HAVE_SALARY_FLAG,
hongguangwu's avatar
hongguangwu committed
358 359 360 361 362
                a.HAVE_SPECIAL_FLAG,
				a.CREATE_BY,
                a.CREATE_NAME,
                a.CREATE_TIME,
                a.UPDATE_BY,
hongguangwu's avatar
hongguangwu committed
363 364 365 366 367
                a.UPDATE_TIME,
                a.SEND_STATUS,
                a.SEND_TIME,
                a.SEND_USER,
                a.SEND_USER_NAME,
368
                a.SEND_MONTH,
hongguangwu's avatar
hongguangwu committed
369 370 371 372 373 374 375 376 377 378 379 380
				a.ORDER_ID,
				a.UNIT_SOCIAL,
				a.PERSON_SOCIAL,
				a.UNIT_FUND,
				a.PERSON_FUND,
				a.COST_REDUCTION,
				a.ANNUAL_BONUS_TAX,
				a.SUM_CHILD_EDU_MONEY,
				a.SUM_HOUSING_LOAN_MONEY,
				a.SUM_HOUSING_RENT_MONEY,
				a.SUM_SUPPORT_ELDERLY_MONEY,
				a.SUM_CONTINUING_EDUCATION_MONEY,
381
				a.SUM_BABY_MONEY,
hongguangwu's avatar
hongguangwu committed
382
				a.SUM_PRIVATE_PENSION,
hongguangwu's avatar
hongguangwu committed
383 384
				a.IS_DIFF,
				a.PAY_SETTLE_FLAG
hongguangwu's avatar
hongguangwu committed
385
	</sql>
386

hongguangwu's avatar
hongguangwu committed
387 388 389 390 391 392 393 394
    <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>
395 396 397
					<if test="tSalaryAccount.orderId != null and tSalaryAccount.orderId.trim() != ''">
						AND a.ORDER_ID = #{tSalaryAccount.orderId}
					</if>
hongguangwu's avatar
hongguangwu committed
398 399 400 401 402 403
                    <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>
404 405 406 407 408 409
					<if test="tSalaryAccount.salaryMonthStart != null and tSalaryAccount.salaryMonthStart.trim() != ''">
						AND a.SALARY_MONTH >= #{tSalaryAccount.salaryMonthStart}
					</if>
					<if test="tSalaryAccount.salaryMonthEnd != null and tSalaryAccount.salaryMonthEnd.trim() != ''">
						AND a.SALARY_MONTH <![CDATA[<=]]> #{tSalaryAccount.salaryMonthEnd}
					</if>
410 411 412 413 414 415
					<if test="tSalaryAccount.settleMonthStart != null and tSalaryAccount.settleMonthStart.trim() != ''">
						AND a.SETTLEMENT_MONTH >= #{tSalaryAccount.settleMonthStart}
					</if>
					<if test="tSalaryAccount.settleMonthEnd != null and tSalaryAccount.settleMonthEnd.trim() != ''">
						AND a.SETTLEMENT_MONTH <![CDATA[<=]]> #{tSalaryAccount.settleMonthEnd}
					</if>
hongguangwu's avatar
hongguangwu committed
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439
                    <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>
440 441 442 443 444 445 446 447 448
					<if test="tSalaryAccount.unitId != null and tSalaryAccount.unitId.trim() != ''">
						AND a.UNIT_ID = #{tSalaryAccount.unitId}
					</if>
					<if test="tSalaryAccount.unitName != null and tSalaryAccount.unitName.trim() != ''">
						AND a.UNIT_NAME = #{tSalaryAccount.unitName}
					</if>
					<if test="tSalaryAccount.unitNo != null and tSalaryAccount.unitNo.trim() != ''">
						AND a.UNIT_NO = #{tSalaryAccount.unitNo}
					</if>
hongguangwu's avatar
hongguangwu committed
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534
                    <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}
hongguangwu's avatar
hongguangwu committed
535 536 537
                    </if>
					<if test="tSalaryAccount.sendStatus != null">
                        AND a.SEND_STATUS = #{tSalaryAccount.sendStatus}
hongguangwu's avatar
hongguangwu committed
538
                    </if>
hongguangwu's avatar
hongguangwu committed
539 540 541
					<if test="tSalaryAccount.isDiff != null and tSalaryAccount.isDiff.trim() != ''">
						AND a.IS_DIFF = #{tSalaryAccount.isDiff}
					</if>
hongguangwu's avatar
hongguangwu committed
542 543 544 545 546 547
        </if>
    </sql>
    <!--tSalaryAccount简单分页查询-->
    <select id="getTSalaryAccountPage" resultMap="tSalaryAccountMap">
        SELECT
        <include refid="Base_Column_List"/>
548 549 550 551 552 553 554
        FROM
			<if test="tSalaryAccount.salaryMonthStart == null or tSalaryAccount.salaryMonthStart.trim() >= '202201' ">
				t_salary_account a
			</if>
			<if test="tSalaryAccount.salaryMonthStart != null and tSalaryAccount.salaryMonthStart.trim() &lt; '202201' ">
				t_salary_account_hro_2021 a
			</if>
hongguangwu's avatar
hongguangwu committed
555
        <where>
hongguangwu's avatar
hongguangwu committed
556
			a.DELETE_FLAG = 0
557

hongguangwu's avatar
hongguangwu committed
558
			<include refid="tSalaryAccount_where"/>
fangxinjiang's avatar
fangxinjiang committed
559 560 561 562 563 564
			<if test="deptNos != null and deptNos.size>0">
				AND a.DEPT_NO not in
				<foreach item="no" index="index" collection="deptNos" open="(" separator="," close=")">
					#{no}
				</foreach>
			</if>
565 566 567
			<if test="tSalaryAccount.authSql != null and tSalaryAccount.authSql.trim() != ''">
				${tSalaryAccount.authSql}
			</if>
hongguangwu's avatar
hongguangwu committed
568
        </where>
hongguangwu's avatar
hongguangwu committed
569
		order by a.CREATE_TIME desc
hongguangwu's avatar
hongguangwu committed
570
    </select>
571

fangxinjiang's avatar
fangxinjiang committed
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604
	<!--tSalaryAccount简单分页查询-->
	<select id="getTSalaryAccountPageDiy" resultMap="tSalaryAccountMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM (select * from t_salary_account
		<if test="null != page and null != size">
			limit #{page},#{size}
		</if>
		) 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"/>
			<if test="tSalaryAccount.authSql != null and tSalaryAccount.authSql.trim() != ''">
				${tSalaryAccount.authSql}
			</if>
		</where>
		order by a.CREATE_TIME desc
	</select>
	<select id="getTSalaryAccountPageCountDiy" resultType="java.lang.Long">
		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="tSalaryAccount_where"/>
			<if test="tSalaryAccount.authSql != null and tSalaryAccount.authSql.trim() != ''">
				${tSalaryAccount.authSql}
			</if>
		</where>
		order by a.CREATE_TIME desc
	</select>
605 606 607
	<!-- 获取校验的报账明细 ### 格式:身份证号_工资月份_报表类型_应发金额 -->
	<select id="getAccountCheckList" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo">
		select
hongguangwu's avatar
hongguangwu committed
608
			CONCAT(a.EMP_IDCARD,"_",a.SALARY_MONTH,"_",a.FORM_TYPE) title,ifnull(ifnull(relaySalary.SALARY_MONEY,actSalary.SALARY_MONEY),0) relaySalary
609 610 611
		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'
612
		where a.DELETE_FLAG = 0 and a.DEPT_ID = #{settleId} and a.SALARY_MONTH = #{settleMonth}
613 614
	</select>

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

huyuchen's avatar
huyuchen committed
627 628 629 630 631 632 633 634 635
	<!-- 获取校验的报账明细 ### 格式:身份证号_工资月份_报表类型_应发金额 -->
	<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>

636 637 638
	<!-- 获取当前年最小计税月 -->
	<select id="getMinTaxMonthByNowYear" resultType="java.lang.String">
		select
639
			concat(min(a.TAX_MONTH - 0),'')
640 641
		from t_salary_account a
		where a.EMP_IDCARD = #{empIdCard} and a.DELETE_FLAG = 0 and a.SETTLEMENT_MONTH like concat(#{nowYear},"%")
hongguangwu's avatar
hongguangwu committed
642
		  and a.FORM_TYPE != '3' and a.FORM_TYPE != '4'
643
	</select>
fangxinjiang's avatar
fangxinjiang committed
644

645 646 647 648 649 650 651 652 653 654 655 656 657 658
	<!-- 获取当前年最小计税月 -->
	<select id="getMinTaxMonthByNowYearAndList" resultMap="tSalaryAccountMap">
		select
			a.EMP_IDCARD,concat(min(a.TAX_MONTH - 0),'') TAX_MONTH
		from t_salary_account a
		where a.EMP_IDCARD in
			<foreach collection="empIdCardList" item="ids" open="(" separator="," close=")">
				#{ids}
			</foreach>
		  and a.DELETE_FLAG = 0 and a.SETTLEMENT_MONTH like concat(#{nowYear},"%")
		  and a.FORM_TYPE != '3' and a.FORM_TYPE != '4'
		group by a.EMP_IDCARD
	</select>

fangxinjiang's avatar
fangxinjiang committed
659 660
	<select id="getLastMonthTHaveSalaryNosocial"  resultType="com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial">
		select a.EMP_ID           employee_id
661 662 663
			 , a.EMP_IDCARD       employee_id_card
			 , a.EMP_NAME         employee_name
			 , GROUP_CONCAT(a.relaySalary)    relay_salary
664
			 , a.CREATE_BY      CREATE_BY
665 666 667 668 669 670 671
			 , 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
672
		     ,a.CREATE_NAME,a.CREATE_TIME
fangxinjiang's avatar
fangxinjiang committed
673
		from (
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688
				 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
689
					  ,a.CREATE_NAME,a.CREATE_TIME
690 691 692
				 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
fangxinjiang's avatar
fangxinjiang committed
693

694 695
				 where
					 a.DELETE_FLAG = 0
fangxinjiang's avatar
fangxinjiang committed
696 697
				   and a.FORM_TYPE='0'
				   and a.SALARY_MONTH in ( #{month} , #{month2} , #{month3})
698
				   AND s.STATUS IN (3, 4)
699
				 GROUP BY a.EMP_IDCARD, a.SALARY_MONTH
700 701 702 703
			 ) a
		where a.relaySalary > 0
		  and a.social = 0
		GROUP BY a.EMP_IDCARD  HAVING count(1) = 3
fangxinjiang's avatar
fangxinjiang committed
704
	</select>
huyuchen's avatar
huyuchen committed
705 706 707 708 709

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

	<!-- 获取薪资明细 -->
hongguangwu's avatar
hongguangwu committed
714
	<select id="getEkpSalaryParamList" resultMap="ekpSalaryParamVoMap">
hongguangwu's avatar
hongguangwu committed
715
		select
hongguangwu's avatar
hongguangwu committed
716
			ifnull(a.id,'') fd_3b10af838eab5c
hongguangwu's avatar
hongguangwu committed
717 718 719 720 721 722 723 724 725 726
			 ,ifnull(a.DEPT_NO,'') fd_3adfedf98ccba2
			 ,ifnull(a.DEPT_NAME,'') fd_3adfedf9d2bf1c
			 ,'' fd_3adfedfa4410aa
			 ,ifnull(s.UNIT_NO,'') fd_3adfedfacd65d6
			 ,ifnull(s.UNIT_NAME,'') fd_3adfedfb174068
			 ,ifnull(a.EMP_NAME,'') fd_3adfedfb5a68a2
			 ,ifnull(a.EMP_IDCARD,'') fd_3adfedfb8f76d4
			 ,ifnull(a.EMP_PHONE,'') fd_3adfedfbd23ab8
			 ,ifnull(a.BANK_NO,'') fd_3adfedfcb17f1e
			 ,ifnull(a.BANK_NAME,'') fd_3adfedfc453cc4
727
			 ,ifnull(a.BANK_SUB_NAME,'') fd_3b73de2809465a
hongguangwu's avatar
hongguangwu committed
728 729
			 ,concat(left(ifnull(a.SALARY_MONTH,'1970'),4),'-',right(ifnull(a.SALARY_MONTH,'02'),2)) fd_3adfee063acff0
			 ,concat(left(ifnull(a.SETTLEMENT_MONTH,'1970'),4),'-',right(ifnull(a.SETTLEMENT_MONTH,'02'),2)) fd_3adfee0690737c
hongguangwu's avatar
hongguangwu committed
730 731 732 733 734
			 ,'是' fd_3adfee01668666
			 ,if(a.SOCIAL_PRIORITY='1','缴纳月','生成月') fd_3adfedfed8bb28
			 ,if(a.FUND_PRIORITY='1','缴纳月','生成月') fd_3adfedff3a7430
			 ,if(a.OWN_FLAG='1','是','否') fd_3adfee0009d070
			 ,if(a.ANNUAL_BONUS_TYPE='1','单独','合并') fd_3adfee01dea2fa
hongguangwu's avatar
hongguangwu committed
735
			 ,ifnull(a.RELAY_SALARY,'0') fd_3adfee12cb8840
736
			 ,ifnull(sum(ifnull(pdeduction.SALARY_MONEY,0))+ifnull(exemptionPersionTax.SALARY_MONEY,0),'') fd_3adfee1374ed7a
hongguangwu's avatar
hongguangwu committed
737 738 739 740
			 ,ifnull(ifnull(withholidingUnitSocial.SALARY_MONEY,unitSocial.SALARY_MONEY),'') fd_3adfee1e2b2f78
			 ,ifnull(ifnull(withholidingPersonSocial.SALARY_MONEY,personalSocial.SALARY_MONEY),'') fd_3adfee1e88723e
			 ,ifnull(ifnull(withholidingUnitFund.SALARY_MONEY,unitFund.SALARY_MONEY),'') fd_3adfee1ee24680
			 ,ifnull(ifnull(withholidingPersonFund.SALARY_MONEY,personalFund.SALARY_MONEY),'') fd_3adfee1f32fa24
741
			 ,ifnull(a.SALARY_TAX,'0') + ifnull(a.SALARY_TAX_UNIT,'0') + ifnull(a.ANNUAL_BONUS_TAX,'0') fd_3adfee1f901c46
742 743
			 ,ifnull(enterpriseAnnuityUnit.SALARY_MONEY,'0') fd_3adfee1ff1ca6a
			 ,ifnull(enterpriseAnnuity.SALARY_MONEY,'0') fd_3adfee203f86b2
hongguangwu's avatar
hongguangwu committed
744
			 ,ifnull(a.ACTUAL_SALARY,'0') fd_3adfee20fe5ba4
745
			 ,ifnull(a.RELAY_SALARY,'0') - ifnull(ifnull(withholidingPersonSocial.SALARY_MONEY,personalSocial.SALARY_MONEY),'0') - ifnull(ifnull(withholidingPersonFund.SALARY_MONEY,personalFund.SALARY_MONEY),'') fd_3adfee21802434
hongguangwu's avatar
hongguangwu committed
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774
			 ,'' fd_3adfee4ba5ad36
			 ,'' fd_3adfee4c0c59ee
			 ,'' fd_3adfee5dd14866
			 ,'' fd_3adfee5e3d1638
			 ,'' fd_3adfeeb34ea0ea
			 ,'' fd_3adfeededfb5a6
			 ,'' fd_3adfeed3a20598
			 ,'' fd_3aea30866d0c30
			 ,'' fd_3aea309696d32e
			 ,'' fd_3adfeec6db8766
			 ,'' fd_3adfeef8ef38fc
			 ,'' fd_3adfeedd08222c
			 ,'' fd_3aeadede4cea84
			 ,'' fd_3aeadee1cf1266
			 ,'' fd_3adfeec730ec44
			 ,'' fd_3adfeef9440ab2
			 ,'' fd_3adfeedd5f3cb2
			 ,'' fd_3aeadf17522642
			 ,'' fd_3aeadf17b7d03a
			 ,'' fd_3adfeec782070a
			 ,'' fd_3adfeef9b9fb3e
			 ,'' fd_3adfeeddacf6d4
			 ,'' fd_3aeadf182ef6a2
			 ,'' fd_3aeadf1892fdb2
			 ,'' fd_3adfeec7ccdd1c
			 ,'' fd_3adfeefa1eba32
			 ,'' fd_3adfeede08d430
			 ,'' fd_3aeadf191c62a0
			 ,'' fd_3aeadf1992544c
hongguangwu's avatar
hongguangwu committed
775
			 ,if(a.SALARY_GIVE_TIME='1','是','否') fd_3af9d49d165e90
hongguangwu's avatar
hongguangwu committed
776
			 ,ifnull(a.INVOICE_TITLE,'') fd_3afab1895feea2
777 778
			 ,ifnull(withholidingPersonSocial.SALARY_MONEY,'') fd_3b16ce48a9735c
			 ,ifnull(withholidingPersonFund.SALARY_MONEY,'') fd_3b16ce4b7fc42a
779 780
		     ,ifnull(withholidingUnitSocial.SALARY_MONEY,'') fd_3bcd41d857b764
			 ,ifnull(withholidingUnitFund.SALARY_MONEY,'') fd_3bcd41d77e4812
huyuchen's avatar
huyuchen committed
781 782
			 ,round(ifnull(withholidingUnitSocial.SALARY_MONEY,'0')+ifnull(withholidingPersonSocial.SALARY_MONEY,'0'),2) social_sum
			 ,round(ifnull(withholidingUnitFund.SALARY_MONEY,'0')+ifnull(withholidingPersonFund.SALARY_MONEY,'0'),2)  fund_sum
783 784
			 ,concat(left(ifnull(a.DEDU_SOCIAL_MONTH,'1970'),4),'-',right(ifnull(a.DEDU_SOCIAL_MONTH,'02'),2)) DEDU_SOCIAL_MONTH
			 ,concat(left(ifnull(a.DEDU_PROVIDENT_MONTH,'1970'),4),'-',right(ifnull(a.DEDU_PROVIDENT_MONTH,'02'),2)) DEDU_PROVIDENT_MONTH
hongguangwu's avatar
hongguangwu committed
785
			,ifnull(s.BPO_FLAG,'') fd_3b178f0ded2114
786
			,ifnull(s.APPLY_NO,'') fd_3b3bef19b61c38
hongguangwu's avatar
hongguangwu committed
787
			,if(a.SALARY_STYLE='0','现金','银行') fd_3bbbfdd1fc2950
788 789 790 791

			,ifnull(personalSocial.SALARY_MONEY,'') fd_3bcd41d0ae6648
			,ifnull(personalFund.SALARY_MONEY,'') fd_3bcd41d65d5bb2
			,ifnull(sum(ifnull(pdeduction.SALARY_MONEY,0)),'') fd_3bcd41d361534e
792
			,ifnull(GROUP_CONCAT(pdeduction.CN_NAME,':',pdeduction.SALARY_MONEY SEPARATOR ';'),'') fd_3bcd41dc41cf6a
793

794
			 ,ifnull(personalDebt.SALARY_MONEY,0)*(-1) fd_3bcd41dfb9f00e
795 796 797 798 799 800 801 802
			,ifnull(a.ANNUAL_BONUS_TAX,'0') fd_3bcd41d939aa64
			,ifnull(a.SALARY_TAX,'0') + ifnull(a.SALARY_TAX_UNIT,'0') fd_3bcd41d453de50
			,ifnull(exemptionPersionTax.SALARY_MONEY,0) fd_3bcd41dd8b4232
			,if(a.SALARY_GIVE_TIME='0',if(a.SALARY_STYLE='0',ifnull(a.ACTUAL_SALARY,'0'),'0'),'0') fd_3bcd41da212afe
			,if(a.SALARY_GIVE_TIME='0',if(a.SALARY_STYLE='0','0',ifnull(a.ACTUAL_SALARY,'0')),'0') fd_3bcd41d550a756
			,if(a.SALARY_GIVE_TIME='1',ifnull(a.ACTUAL_SALARY,'0'),'0') fd_3bcd41de98a582
			,ifnull(unitFund.SALARY_MONEY,'0') fd_3bcd41d1f6f58a
			,ifnull(unitSocial.SALARY_MONEY,'0') fd_3bcd41db081b72
803
			,ifnull(if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0,a.RELAY_SALARY_UNIT,a.RELAY_SALARY),'0') fd_3bcdee91cacb6c
804
			,ifnull(a.CREATE_NAME,'') fd_3c3e5ff65115a2
hongguangwu's avatar
hongguangwu committed
805 806 807 808 809 810 811 812 813 814 815 816
		from t_salary_account a
			 LEFT JOIN t_salary_standard s on a.SALARY_FORM_ID=s.ID
			 left join t_salary_account_item withholidingPersonSocial on withholidingPersonSocial.SALARY_ACCOUNT_ID = a.id and withholidingPersonSocial.JAVA_FIED_NAME='withholidingPersonSocial'
			 left join t_salary_account_item withholidingPersonFund on withholidingPersonFund.SALARY_ACCOUNT_ID = a.id and withholidingPersonFund.JAVA_FIED_NAME='withholidingPersonFund'
			 left join t_salary_account_item personalSocial on personalSocial.SALARY_ACCOUNT_ID = a.id and personalSocial.JAVA_FIED_NAME='personalSocial'
			 left join t_salary_account_item personalFund on personalFund.SALARY_ACCOUNT_ID = a.id and personalFund.JAVA_FIED_NAME='personalFund'
			 left join t_salary_account_item exemptionPersionTax on exemptionPersionTax.SALARY_ACCOUNT_ID = a.id and exemptionPersionTax.JAVA_FIED_NAME='exemptionPersionTax'
			 left join t_salary_account_item unitSocial on unitSocial.SALARY_ACCOUNT_ID = a.id and unitSocial.JAVA_FIED_NAME='unitSocial'
			 left join t_salary_account_item unitFund on unitFund.SALARY_ACCOUNT_ID = a.id and unitFund.JAVA_FIED_NAME='unitFund'
			 left join t_salary_account_item withholidingUnitSocial on withholidingUnitSocial.SALARY_ACCOUNT_ID = a.id and withholidingUnitSocial.JAVA_FIED_NAME='withholidingUnitSocial'
			 left join t_salary_account_item withholidingUnitFund on withholidingUnitFund.SALARY_ACCOUNT_ID = a.id and withholidingUnitFund.JAVA_FIED_NAME='withholidingUnitFund'
			 left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
817 818
			 left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
			 left join t_salary_account_item enterpriseAnnuityUnit on enterpriseAnnuityUnit.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuityUnit.JAVA_FIED_NAME='enterpriseAnnuityUnit'
819
			 left join t_salary_account_item personalDebt on personalDebt.SALARY_ACCOUNT_ID = a.id and personalDebt.JAVA_FIED_NAME='personalDebt'
hongguangwu's avatar
hongguangwu committed
820
		where a.DELETE_FLAG = 0 and a.SALARY_FORM_ID = #{salaryId} and a.SEND_STATUS = '0'
821
		GROUP BY a.id
hongguangwu's avatar
hongguangwu committed
822 823
	</select>

824

fangxinjiang's avatar
fangxinjiang committed
825 826
	<select id="noPageDiy" resultMap="tSalaryAccountMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
		SELECT
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848
			a.ID,
			a.INVOICE_TITLE,
			a.SALARY_MONTH,
			a.EMP_NAME,
			a.EMP_IDCARD,
			a.BANK_NO,
			a.BANK_NAME,
			a.DEPT_NO,
			a.DEPT_NAME,
			a.SALARY_GIVE_TIME,
			a.DEDU_SOCIAL_MONTH,
			a.DEDU_PROVIDENT_MONTH,
			a.SETTLEMENT_MONTH,
			a.ANNUAL_BONUS_TYPE,
			a.TAX_MONTH,
			a.IS_DEDUCT_SOCIAL,
			a.IS_DEDUCT_FUND,
			a.EMP_PHONE,
			a.BANK_SUB_NAME,
			ap.AREA_NAME BANK_PROVINCE,
			ac.AREA_NAME BANK_CITY,
			a.IS_PERSON_TAX,
849
			if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0,a.RELAY_SALARY_UNIT,ifnull(a.RELAY_SALARY,0)) RELAY_SALARY,
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865
			a.ACTUAL_SALARY,
			ifnull(a.SALARY_TAX,0) + ifnull(a.SALARY_TAX_UNIT,0)  SALARY_TAX,
			a.CREATE_NAME,
			a.CREATE_TIME,
			a.UNIT_SOCIAL,
			a.PERSON_SOCIAL,
			a.UNIT_FUND,
			a.PERSON_FUND,
			a.COST_REDUCTION,
			a.ANNUAL_BONUS_TAX,
			a.SUM_CHILD_EDU_MONEY,
			a.SUM_HOUSING_LOAN_MONEY,
			a.SUM_HOUSING_RENT_MONEY,
			a.SUM_SUPPORT_ELDERLY_MONEY,
			a.SUM_CONTINUING_EDUCATION_MONEY,
			a.SUM_BABY_MONEY,
866 867
			a.SUM_PRIVATE_PENSION,
		    case a.FORM_TYPE when '0' then '薪资' when '1' then '绩效' when '3' then '劳务费' when '4' then '稿酬' else '其他' end as FORM_TYPE
868 869 870 871 872 873 874
		FROM
			<if test="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201'">
				t_salary_account a
			</if>
			<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() &lt; '202201' ">
				t_salary_account_hro_2021 a
			</if>
875 876
			left join sys_area ap on ap.id=a.BANK_PROVINCE
			left join sys_area ac on ac.id=a.BANK_CITY
fangxinjiang's avatar
fangxinjiang committed
877
		<where>
878
			a.DELETE_FLAG = 0
fangxinjiang's avatar
fangxinjiang committed
879
			<include refid="where_export"/>
880 881 882
			<if test="searchVo.authSql != null and searchVo.authSql.trim() != ''">
				${searchVo.authSql}
			</if>
fangxinjiang's avatar
fangxinjiang committed
883 884 885 886 887 888 889 890 891
			ORDER BY a.CREATE_TIME desc
			<if test="searchVo != null">
				<if test="searchVo.limitStart != null">
					limit #{searchVo.limitStart},#{searchVo.limitEnd}
				</if>
			</if>
		</where>

	</select>
hongguangwu's avatar
hongguangwu committed
892

893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926
	<select id="auditExport" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportVo"
			parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
		select
			case a.FORM_TYPE when '0' then '薪资' when '1' then '绩效' when '3' then '劳务费' when '4' then '稿酬' else '其他' end as formType,
			a.EMP_PHONE as empPhone,
			a.TAX_MONTH as taxMonth,
			a.SETTLEMENT_MONTH as settlementMonth,
			a.SALARY_MONTH as salaryMonth,
			a.INVOICE_TITLE as invoiceTitle,
			a.UNIT_NAME as unitName,
			a.UNIT_NO as unitNo,
			a.DEPT_NAME as deptName,
			a.DEPT_NO as deptNo,
			a.EMP_NAME as empName,
			a.EMP_IDCARD as empIdcard,
			if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0, a.RELAY_SALARY_UNIT, ifnull(a.RELAY_SALARY,0)) as relaySalary,
			a.ACTUAL_SALARY as actualSalary,
			annualBonus.SALARY_MONEY as annualBonus,
			ifnull(a.SALARY_TAX,0) + ifnull(a.SALARY_TAX_UNIT,0) as salaryTax,
			a.ANNUAL_BONUS_TAX as annualBonusTax,
			a.PERSON_SOCIAL as personSocial,
			a.PERSON_FUND as personFund,
			exemptionPersionTax.SALARY_MONEY as exemptionPersionTax,
			enterpriseAnnuity.SALARY_MONEY as enterpriseAnnuity,
			a.UNIT_SOCIAL as unitSocial,
			a.UNIT_FUND as unitFund,
			a.SUM_BABY_MONEY as sumBabyMoney,
			a.SUM_CHILD_EDU_MONEY as sumChildEduMoney,
			a.SUM_CONTINUING_EDUCATION_MONEY as sumContinuingEducationMoney,
			a.SUM_HOUSING_LOAN_MONEY as sumHousingLoanMoney,
			a.SUM_HOUSING_RENT_MONEY as sumHousingRentMoney,
			a.SUM_PRIVATE_PENSION as sumPrivatePension,
			a.SUM_SUPPORT_ELDERLY_MONEY as sumSupportElderlyMoney,
			a.COST_REDUCTION as costReduction,
hongguangwu's avatar
hongguangwu committed
927
			a.CREATE_NAME as createName,
928
			GROUP_CONCAT(pdeduction.CN_NAME,':',pdeduction.SALARY_MONEY SEPARATOR ';') pdeductionDetail,
hongguangwu's avatar
hongguangwu committed
929
			sum(ifnull(pdeduction.SALARY_MONEY,0)) pdeductionMoney,
930
			if(a.PAY_SETTLE_FLAG = '0','已结算',if(a.PAY_SETTLE_FLAG = '1','结算中',if(a.PAY_SETTLE_FLAG = '2','未结算','-'))) paySettleFlag,
hongguangwu's avatar
hongguangwu committed
931
			case s.STATUS when 0 then '待提交' when 1 then '待审核' when 2 then '待推送明细' when 3 then '已推送待发放' when 4 then '已发放' when 5 then '审核不通过' when 6 then '确认不通过' when 7 then '财务退回' when 10 then '推送失败' when 11 then '已审核生成收入中' when 12 then '已审核生成收入失败' else '-' end as status
932 933 934 935
			,phoneSubsidy.SALARY_MONEY as phoneSubsidy
			,s.BUSINESS_PRIMARY_TYPE as businessPrimaryType
			,s.BUSINESS_SECOND_TYPE as businessSecondType
			,s.BUSINESS_THIRD_TYPE as businessThirdType
936 937
		from
		t_salary_account a
938
		left join t_salary_standard s on a.SALARY_FORM_ID = s.id
939 940 941
		left join t_salary_account_item annualBonus on annualBonus.SALARY_ACCOUNT_ID = a.id and annualBonus.JAVA_FIED_NAME = 'annualBonus'
		left join t_salary_account_item exemptionPersionTax on exemptionPersionTax.SALARY_ACCOUNT_ID = a.id and exemptionPersionTax.JAVA_FIED_NAME='exemptionPersionTax'
		left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
hongguangwu's avatar
hongguangwu committed
942
		left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
943
		left join t_salary_account_item phoneSubsidy on phoneSubsidy.SALARY_ACCOUNT_ID = a.id and phoneSubsidy.JAVA_FIED_NAME='phoneSubsidy'
944 945 946
		<where>
			a.DELETE_FLAG = 0
			<include refid="where_export"/>
947
			GROUP BY a.id ORDER BY a.SETTLEMENT_MONTH asc
948 949 950 951 952 953 954 955 956
			<if test="searchVo != null">
				<if test="searchVo.limitStart != null">
					limit #{searchVo.limitStart},#{searchVo.limitEnd}
				</if>
			</if>
		</where>

	</select>

hongguangwu's avatar
hongguangwu committed
957
	<select id="getAccountListBySalaryId" resultMap="tSalaryAccountWebExportMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
958 959
		SELECT
			<include refid="Base_Column_List"/>
hongguangwu's avatar
hongguangwu committed
960 961
			,enterpriseAnnuity.SALARY_MONEY as ENTERPRISE_ANNUITY
			,sum(ifnull(pdeduction.SALARY_MONEY,0)) PDEDUCTION_MONEY
962 963 964
		FROM
			<if test="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201'">
				t_salary_account a
hongguangwu's avatar
hongguangwu committed
965 966
				left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
				left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
967 968 969
			</if>
			<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() &lt; '202201' ">
				t_salary_account_hro_2021 a
hongguangwu's avatar
hongguangwu committed
970 971
				left join t_salary_account_item_hro_2021 enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
				left join t_salary_account_item_hro_2021 pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
972 973
			</if>
		where a.SALARY_FORM_ID = #{searchVo.salaryFormId}
hongguangwu's avatar
hongguangwu committed
974
		GROUP BY a.id ORDER BY a.ROW_INDEX ASC
975 976
	</select>

977 978 979
	<!-- 导出报账专用hgw -->
	<select id="getAccountListByApplyNo" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportByEkpVo">
		select
hongguangwu's avatar
hongguangwu committed
980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024
			a.EMP_PHONE as empPhone,
			a.TAX_MONTH as taxMonth,
			a.SETTLEMENT_MONTH as settlementMonth,
			a.SALARY_MONTH as salaryMonth,
			a.DEPT_NAME as deptName,
			a.DEPT_NO as deptNo,
			a.EMP_NAME as empName,
			a.EMP_IDCARD as empIdcard,
			if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0, a.RELAY_SALARY_UNIT, ifnull(a.RELAY_SALARY,0)) as relaySalary,
			a.ACTUAL_SALARY as actualSalary,
			ifnull(a.SALARY_TAX,0) + ifnull(a.SALARY_TAX_UNIT,0) as salaryTax,
			a.ANNUAL_BONUS_TAX as annualBonusTax,
			a.PERSON_SOCIAL as personSocial,
			a.PERSON_FUND as personFund,
			enterpriseAnnuity.SALARY_MONEY as enterpriseAnnuity,
			a.UNIT_SOCIAL as unitSocial,
			a.UNIT_FUND as unitFund,
			a.SUM_BABY_MONEY as sumBabyMoney,
			a.SUM_CHILD_EDU_MONEY as sumChildEduMoney,
			a.SUM_CONTINUING_EDUCATION_MONEY as sumContinuingEducationMoney,
			a.SUM_HOUSING_LOAN_MONEY as sumHousingLoanMoney,
			a.SUM_HOUSING_RENT_MONEY as sumHousingRentMoney,
			a.SUM_PRIVATE_PENSION as sumPrivatePension,
			a.SUM_SUPPORT_ELDERLY_MONEY as sumSupportElderlyMoney,
			a.COST_REDUCTION as costReduction,
			sum(ifnull(pdeduction.SALARY_MONEY,0)) pdeductionMoney,
			if(a.PAY_SETTLE_FLAG = '0','已结算',if(a.PAY_SETTLE_FLAG = '1','结算中',if(a.PAY_SETTLE_FLAG = '2','未结算','-'))) paySettleFlag,
			case s.STATUS when 0 then '待提交' when 1 then '待审核' when 2 then '待推送明细' when 3 then '已推送待发放' when 4 then '已发放' when 5 then '审核不通过' when 6 then '确认不通过' when 7 then '财务退回' when 10 then '推送失败' when 11 then '已审核生成收入中' when 12 then '已审核生成收入失败' else '-' end as status
			,a.BANK_NO as bankNo
			,a.BANK_NAME as bankName
			,if(a.ANNUAL_BONUS_TYPE='1','单独','合并') as annualBonusType
			,ap.AREA_NAME as bankProvince
			,ac.AREA_NAME as bankCity
			,a.BANK_SUB_NAME as bankSubName
			,if(a.SALARY_STYLE='0','现金','银行') as salaryStyle
			,if(a.SALARY_GIVE_TIME='1','暂停发','立即发') as salaryGiveTime
			,a.DEDU_SOCIAL_MONTH as deduSocialMonth
			,a.DEDU_PROVIDENT_MONTH as deduProvidentMonth
			,if(a.SOCIAL_PRIORITY='1','缴纳月','生成月') as socialPriority
			,if(a.FUND_PRIORITY='1','缴纳月','生成月') as fundPriority
			,if(a.IS_DEDUCT_SOCIAL='0','否','是') as isDeductSocial
			,if(a.IS_DEDUCT_FUND='0','否','是') as isDeductFund
			,if(a.IS_REPEAT='0','否','是') as isRepeat
			,if(a.OWN_FLAG='0','否','是') as ownFlag
			,if(a.HAVE_SPECIAL_FLAG='0','否','是') haveSpecialFlag
1025 1026 1027 1028 1029 1030
		from
		t_salary_account a
		left join t_salary_standard s on a.SALARY_FORM_ID = s.id
		left join t_salary_account_item annualBonus on annualBonus.SALARY_ACCOUNT_ID = a.id and annualBonus.JAVA_FIED_NAME = 'annualBonus'
		left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
		left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
hongguangwu's avatar
hongguangwu committed
1031 1032
		left join sys_area ap on ap.id=a.BANK_PROVINCE
		left join sys_area ac on ac.id=a.BANK_CITY
1033
		where s.APPLY_NO = #{applyNo} and a.DELETE_FLAG = 0
hongguangwu's avatar
hongguangwu committed
1034
		GROUP BY a.id ORDER BY a.ROW_INDEX ASC
1035 1036
	</select>

hongguangwu's avatar
hongguangwu committed
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046
	<!-- 计算收入需要的报账明细 -->
	<select id="getListByIncome" resultMap="tSalaryAccountMap">
		SELECT
			a.ID,
			a.SALARY_MONTH,
			a.EMP_NAME,
			a.EMP_IDCARD,
			a.DEPT_ID,
			a.DEPT_NO,
			a.DEPT_NAME,
hongguangwu's avatar
hongguangwu committed
1047
			ifnull(if(a.FORM_TYPE='3',a.RELAY_SALARY_UNIT,a.RELAY_SALARY),0)
hongguangwu's avatar
hongguangwu committed
1048 1049 1050 1051 1052 1053 1054
				-ifnull(personalSocial.SALARY_MONEY,0)
				-ifnull(personalFund.SALARY_MONEY,0) RELAY_SALARY
		FROM t_salary_account a
			 left join t_salary_account_item personalSocial on personalSocial.SALARY_ACCOUNT_ID = a.id and personalSocial.JAVA_FIED_NAME='personalSocial'
			 left join t_salary_account_item personalFund on personalFund.SALARY_ACCOUNT_ID = a.id and personalFund.JAVA_FIED_NAME='personalFund'
		where a.DELETE_FLAG = 0 and a.SALARY_FORM_ID = #{salaryId}
	</select>
fangxinjiang's avatar
fangxinjiang committed
1055 1056 1057
	<select id="noPageCountDiy"  resultType="java.lang.Integer">
		SELECT
		count(1)
1058 1059 1060 1061 1062 1063 1064
		FROM
			<if test="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201' ">
				t_salary_account a
			</if>
			<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() &lt; '202201' ">
				t_salary_account_hro_2021 a
			</if>
fangxinjiang's avatar
fangxinjiang committed
1065
		<where>
1066
			a.DELETE_FLAG = 0
fangxinjiang's avatar
fangxinjiang committed
1067
			<include refid="where_export"/>
1068 1069 1070
			<if test="searchVo.authSql != null and searchVo.authSql.trim() != ''">
				${searchVo.authSql}
			</if>
fangxinjiang's avatar
fangxinjiang committed
1071 1072
		</where>
	</select>
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082
	<select id="auditExportCount"  resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM
			t_salary_account a
		<where>
			a.DELETE_FLAG = 0
			<include refid="where_export"/>
		</where>
	</select>
fangxinjiang's avatar
fangxinjiang committed
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102
	<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>
1103 1104 1105 1106 1107 1108
			<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() != ''">
				AND a.SALARY_MONTH >= #{searchVo.salaryMonthStart}
			</if>
			<if test="searchVo.salaryMonthEnd != null and searchVo.salaryMonthEnd.trim() != ''">
				AND a.SALARY_MONTH <![CDATA[<=]]> #{searchVo.salaryMonthEnd}
			</if>
1109 1110 1111 1112 1113 1114
			<if test="searchVo.settleMonthStart != null and searchVo.settleMonthStart.trim() != ''">
				AND a.SETTLEMENT_MONTH >= #{searchVo.settleMonthStart}
			</if>
			<if test="searchVo.settleMonthEnd != null and searchVo.settleMonthEnd.trim() != ''">
				AND a.SETTLEMENT_MONTH <![CDATA[<=]]> #{searchVo.settleMonthEnd}
			</if>
fangxinjiang's avatar
fangxinjiang committed
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138
			<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>
1139 1140 1141 1142 1143 1144 1145 1146 1147
			<if test="searchVo.unitId != null and searchVo.unitId.trim() != ''">
				AND a.UNIT_ID = #{searchVo.unitId}
			</if>
			<if test="searchVo.unitName != null and searchVo.unitName.trim() != ''">
				AND a.UNIT_NAME = #{searchVo.unitName}
			</if>
			<if test="searchVo.unitNo != null and searchVo.unitNo.trim() != ''">
				AND a.UNIT_NO = #{searchVo.unitNo}
			</if>
fangxinjiang's avatar
fangxinjiang committed
1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236
			<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>
hongguangwu's avatar
hongguangwu committed
1237 1238 1239 1240 1241

	<!-- 退表回退状态 -->
	<update id="backSalaryBySalaryId" >
		update t_salary_account a set a.SEND_STATUS = '0' where a.SALARY_FORM_ID = #{salaryId}
	</update>
1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316

	<!-- B端薪酬第一个统计列表 -->
	<select id="getSettlementFormVoPage" resultMap="settlementFormVoMap">
		select s.SALARY_MONTH,count(1) PERSON_TIME,sum(ifnull(s.RELAY_SALARY,0)) SALARY_SUM,sum(ifnull(s.ACTUAL_SALARY,0)) CARD_PAY
		from t_salary_account s
		where s.SALARY_MONTH like '${settlementFormVo.years}%'
		<if test="settleDepartIdList != null">
			AND s.DEPT_ID in
			<foreach collection="settleDepartIdList" item="ids" open="(" separator="," close=")">
				#{ids}
			</foreach>
		</if>
		and s.DELETE_FLAG=0
		GROUP BY s.SALARY_MONTH desc
	</select>

	<!-- B端工资详情-上面的统计 -->
	<select id="getSettlementFormVoBySalaryFormId" resultMap="settlementFormVoMap">
		SELECT
			count(1) PERSON_TIME,
			sum(ifnull(s.RELAY_SALARY,0)) SALARY_SUM,
			sum(ifnull(s.ACTUAL_SALARY,0)) CARD_PAY,
			sum(ifnull(s.RELAY_SALARY,0)) + sum(ifnull(s.UNIT_SOCIAL, 0)) + sum(ifnull(s.UNIT_FUND, 0)) LABOR_COSTS
		FROM
			t_salary_account s
		where s.SALARY_FORM_ID = #{salaryFormId}
		GROUP BY s.SALARY_FORM_ID
	</select>

	<!--获取报账以及薪资 -->
	<select id="getSalaryAccountAndItemVoPage" resultMap="salaryAccountAndItemVoMap">
		select a.id,a.SALARY_MONTH SALARY_DATE,a.EMP_NAME,a.EMP_IDCARD,a.SALARY_GIVE_TIME
		,a.DISTRIBUTION_FLAG,a.DEDU_SOCIAL_MONTH,a.DEDU_PROVIDENT_MONTH
		,a.FORM_TYPE SALARY_TYPE,a.SETTLEMENT_MONTH
		,a.RELAY_SALARY RELAY_SALARY
		,a.ACTUAL_SALARY ACTUAL_SALARY_SUM
		,a.SALARY_TAX SALARY_TAX
		,a.UNIT_SOCIAL UNIT_SOCIAL
		,a.PERSON_SOCIAL PERSONAL_SOCIAL
		,a.UNIT_FUND UNIT_FUND
		,a.PERSON_FUND PERSONAL_FUND
		,a.SEND_TIME REVENUE_TIME
		from t_salary_account a
		where a.DELETE_FLAG = 0
		<if test="salaryAccountAndItemVo.salaryFormId != null and salaryAccountAndItemVo.salaryFormId.trim() != ''">
			AND a.SALARY_FORM_ID = #{salaryAccountAndItemVo.salaryFormId}
		</if>
		<if test="salaryAccountAndItemVo.empName != null and salaryAccountAndItemVo.empName.trim() != ''">
			AND a.EMP_NAME = #{salaryAccountAndItemVo.empName}
		</if>
		<if test="salaryAccountAndItemVo.empIdcard != null and salaryAccountAndItemVo.empIdcard.trim() != ''">
			AND a.EMP_IDCARD = #{salaryAccountAndItemVo.empIdcard}
		</if>
		<if test="salaryAccountAndItemVo.salaryGiveTime != null and salaryAccountAndItemVo.salaryGiveTime.trim() != ''">
			AND a.SALARY_GIVE_TIME = #{salaryAccountAndItemVo.salaryGiveTime}
		</if>
		<if test="salaryAccountAndItemVo.distributionFlag != null and salaryAccountAndItemVo.distributionFlag.trim() != ''">
			AND a.DISTRIBUTION_FLAG = #{salaryAccountAndItemVo.distributionFlag}
		</if>
		<if test="salaryAccountAndItemVo.deduSocialMonth != null and salaryAccountAndItemVo.deduSocialMonth.trim() != ''">
			AND a.DEDU_SOCIAL_MONTH = #{salaryAccountAndItemVo.deduSocialMonth}
		</if>
		<if test="salaryAccountAndItemVo.deduProvidentMonth != null and salaryAccountAndItemVo.deduProvidentMonth.trim() != ''">
			AND a.DEDU_PROVIDENT_MONTH = #{salaryAccountAndItemVo.deduProvidentMonth}
		</if>
		<if test="salaryAccountAndItemVo.salaryType != null and salaryAccountAndItemVo.salaryType.trim() != ''">
			AND a.FORM_TYPE = #{salaryAccountAndItemVo.salaryType}
		</if>
		<if test="salaryAccountAndItemVo.settlementMonth != null and salaryAccountAndItemVo.settlementMonth.trim() != ''">
			AND a.SETTLEMENT_MONTH = #{salaryAccountAndItemVo.settlementMonth}
		</if>
		<if test="salaryAccountAndItemVo.years != null and salaryAccountAndItemVo.years.trim() != ''">
			AND a.SALARY_MONTH like concat(#{salaryAccountAndItemVo.years},'%')
		</if>
	</select>
hongguangwu's avatar
hongguangwu committed
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327

	<!-- 根据idList获取报账信息 -->
	<select id="getListByIdList" resultMap="tSalaryAccountMap">
		select
			<include refid="Base_Column_List"/>
		from t_salary_account a
		where a.id in
		<foreach collection="idList" item="ids" open="(" separator="," close=")">
			#{ids}
		</foreach>
	</select>
hongguangwu's avatar
hongguangwu committed
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339

	<!-- 收入证明使用的 -->
	<select id="getAccountIdForProve" resultType="java.lang.String">
		SELECT a.id
		FROM t_salary_account a
		WHERE a.EMP_IDCARD = #{emIdCard}
		<if test="settleDepartId != null">
			and a.DEPT_ID = #{settleDepartId}
		</if>
		and a.DELETE_FLAG = 0
		AND PERIOD_DIFF(a.SALARY_MONTH, #{startMouth}) >= 0
		AND PERIOD_DIFF(#{endMouth}, a.SALARY_MONTH) >= 0
hongguangwu's avatar
hongguangwu committed
1340 1341
		AND a.FORM_TYPE != '3'
		AND a.FORM_TYPE != '4'
hongguangwu's avatar
hongguangwu committed
1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352
	</select>
	<select id="getAccountMonthForProve" resultType="java.lang.String">
		SELECT a.SALARY_MONTH
		FROM t_salary_account a
		WHERE a.EMP_IDCARD = #{emIdCard}
		<if test="settleDepartId != null">
			and a.DEPT_ID = #{settleDepartId}
		</if>
		and a.DELETE_FLAG = 0
		AND PERIOD_DIFF(a.SALARY_MONTH, #{startMouth}) >= 0
		AND PERIOD_DIFF(#{endMouth}, a.SALARY_MONTH) >= 0
hongguangwu's avatar
hongguangwu committed
1353 1354
		AND a.FORM_TYPE != '3'
		AND a.FORM_TYPE != '4'
hongguangwu's avatar
hongguangwu committed
1355 1356
		group by a.SALARY_MONTH
	</select>
hongguangwu's avatar
hongguangwu committed
1357 1358 1359

	<select id="getAccountSumBySalaryId" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSumVo">
		select
hongguangwu's avatar
hongguangwu committed
1360
			sum(ifnull(a.RELAY_SALARY,0)) RELAY_SALARY
hongguangwu's avatar
hongguangwu committed
1361 1362
			 ,sum(ifnull(a.ACTUAL_SALARY,0)) ACTUAL_SALARY
			 ,sum(ifnull(a.SALARY_TAX,0)) SALARY_TAX
hongguangwu's avatar
hongguangwu committed
1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373
			 ,sum(ifnull(annualBonus.SALARY_MONEY,0)) annual_Bonus
			 ,sum(ifnull(a.ANNUAL_BONUS_TAX,0)) ANNUAL_BONUS_TAX
			 ,sum(ifnull(a.UNIT_SOCIAL,0))+sum(ifnull(a.PERSON_SOCIAL,0)) ALL_SOCIAL
			 ,sum(ifnull(a.UNIT_FUND,0))+sum(ifnull(a.PERSON_FUND,0)) ALL_FUND
			 ,sum(ifnull(a.UNIT_SOCIAL,0)) UNIT_SOCIAL
			 ,sum(ifnull(a.UNIT_FUND,0)) UNIT_FUND
			 ,sum(ifnull(a.PERSON_SOCIAL,0)) PERSON_SOCIAL
			 ,sum(ifnull(a.PERSON_FUND,0)) PERSON_FUND
			 ,sum(ifnull(enterpriseAnnuity.SALARY_MONEY,0))+sum(ifnull(enterpriseAnnuityUnit.SALARY_MONEY,0)) ALL_enterprise_Annuity
			 ,sum(ifnull(enterpriseAnnuity.SALARY_MONEY,0)) enterprise_Annuity
			 ,sum(ifnull(enterpriseAnnuityUnit.SALARY_MONEY,0)) enterprise_Annuity_Unit
hongguangwu's avatar
hongguangwu committed
1374 1375
			 ,sum(ifnull(pdeduction.SALARY_MONEY,0)) pdeduction
			 ,sum(ifnull(exemptionPersionTax.SALARY_MONEY,0)) exemptionPersionTax
hongguangwu's avatar
hongguangwu committed
1376 1377
			 ,max(a.SALARY_MONTH) salaryMonth
			 ,count(distinct a.id) num
hongguangwu's avatar
hongguangwu committed
1378 1379 1380 1381
		from t_salary_account a
			 left join t_salary_account_item annualBonus on annualBonus.SALARY_ACCOUNT_ID = a.id and annualBonus.JAVA_FIED_NAME = 'annualBonus'
			 left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
			 left join t_salary_account_item enterpriseAnnuityUnit on enterpriseAnnuityUnit.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuityUnit.JAVA_FIED_NAME='enterpriseAnnuityUnit'
hongguangwu's avatar
hongguangwu committed
1382 1383
			 left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
			 left join t_salary_account_item exemptionPersionTax on exemptionPersionTax.SALARY_ACCOUNT_ID = a.id and exemptionPersionTax.JAVA_FIED_NAME='exemptionPersionTax'
hongguangwu's avatar
hongguangwu committed
1384 1385
		where a.DELETE_FLAG='0' and a.SALARY_FORM_ID = #{salaryId}
	</select>
1386 1387 1388 1389 1390 1391 1392

	<!-- 根据idList获取报账信息 -->
	<select id="allYearExport" resultMap="tSalaryAccountMap">
		select * from (
			select
			a.id,a.DEPT_NAME,a.DEPT_NO,a.EMP_NAME,a.EMP_IDCARD,a.EMP_PHONE,a.BANK_NO
			,a.BANK_NAME,a.BANK_PROVINCE,a.BANK_CITY,a.BANK_SUB_NAME,a.FORM_TYPE
hongguangwu's avatar
hongguangwu committed
1393 1394
			,a.SALARY_MONTH,a.SETTLEMENT_MONTH,if(a.FORM_TYPE='3',a.RELAY_SALARY_UNIT,a.RELAY_SALARY) RELAY_SALARY
			,a.ACTUAL_SALARY,ifnull(SALARY_TAX_UNIT,0) + ifnull(a.SALARY_TAX,0) SALARY_TAX
1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414
			FROM
			t_salary_account a
			where a.DELETE_FLAG = 0 AND a.EMP_IDCARD = #{tSalaryAccount.empIdcard}

			union all

			select
			a.id,a.DEPT_NAME,a.DEPT_NO,a.EMP_NAME,a.EMP_IDCARD,a.EMP_PHONE,a.BANK_NO
			,a.BANK_NAME,a.BANK_PROVINCE,a.BANK_CITY,a.BANK_SUB_NAME,a.FORM_TYPE
			,a.SALARY_MONTH,a.SETTLEMENT_MONTH,relaySalary.SALARY_MONEY RELAY_SALARY
			,actualSalarySum.SALARY_MONEY ACTUAL_SALARY,salaryTax.SALARY_MONEY SALARY_TAX
			FROM
			t_salary_account_hro_2021 a
			left join t_salary_account_item_hro_2021 relaySalary on relaySalary.SALARY_ACCOUNT_ID = a.id and relaySalary.JAVA_FIED_NAME='relaySalary'
			left join t_salary_account_item_hro_2021 actualSalarySum on actualSalarySum.SALARY_ACCOUNT_ID = a.id and actualSalarySum.JAVA_FIED_NAME='actualSalarySum'
			left join t_salary_account_item_hro_2021 salaryTax on salaryTax.SALARY_ACCOUNT_ID = a.id and salaryTax.JAVA_FIED_NAME='salaryTax'
			where a.DELETE_FLAG = 0 AND a.EMP_IDCARD = #{tSalaryAccount.empIdcard}
		) a
		where 1=1
		<include refid="tSalaryAccount_where"/>
hongguangwu's avatar
hongguangwu committed
1415
		order by a.SALARY_MONTH desc
1416 1417
	</select>

1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493

	<!-- 导出报账专用hgw -->
	<select id="getAccountThreeListByApplyNo" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryTypeThreeExportEkpVo">
		select
			case s.STATUS when 0 then '待提交' when 1 then '待审核' when 2 then '待推送明细' when 3 then '已推送待发放' when 4 then '已发放' when 5 then '审核不通过' when 6 then '确认不通过' when 7 then '财务退回' when 10 then '推送失败' when 11 then '已审核生成收入中' when 12 then '已审核生成收入失败' else '-' end as status
				,
			a.DEPT_NAME as deptName,
			a.DEPT_NO as deptNo,
			a.SETTLEMENT_MONTH as settlementMonth,
			a.SALARY_MONTH as salaryMonth,
			a.EMP_NAME as empName,
			a.EMP_IDCARD as empIdcard,
			a.EMP_PHONE as empPhone,
			a.BANK_NO as bankNo,
			a.BANK_NAME as bankName,
			ap.AREA_NAME as bankProvince,
			ac.AREA_NAME as bankCity,
			a.BANK_SUB_NAME as bankSubName,
			a.RELAY_SALARY as relaySalary,
			if(a.SALARY_GIVE_TIME='1','暂停发','立即发') as salaryGiveTime,
			if(a.IS_PERSON_TAX='1','个人承担部分税费',if(a.IS_PERSON_TAX='2','个人承担全部税费','公司承担全部税费')) as isPersonTax,
			a.SALARY_TAX as salaryTax,
			a.SALARY_TAX_UNIT as salaryTaxUnit,
			a.RELAY_SALARY_UNIT as relaySalaryUnit,
			a.ACTUAL_SALARY as actualSalary,
			if(a.IS_REPEAT='0','否','是') as isRepeat,
			if(a.OWN_FLAG='0','否','是') as ownFlag,
			if(a.HAVE_SALARY_FLAG='0','否','是') as haveSalaryFlag,
			if(a.PAY_SETTLE_FLAG = '0','已结算',if(a.PAY_SETTLE_FLAG = '1','结算中',if(a.PAY_SETTLE_FLAG = '2','未结算','-'))) paySettleFlag
		from
			t_salary_account a
				left join t_salary_standard s on a.SALARY_FORM_ID = s.id
				left join t_salary_account_item annualBonus on annualBonus.SALARY_ACCOUNT_ID = a.id and annualBonus.JAVA_FIED_NAME = 'annualBonus'
				left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
				left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
				left join sys_area ap on ap.id=a.BANK_PROVINCE
				left join sys_area ac on ac.id=a.BANK_CITY
		where s.APPLY_NO = #{applyNo} and a.DELETE_FLAG = 0
		GROUP BY a.id ORDER BY a.ROW_INDEX ASC
	</select>

	<!-- 导出报账专用hgw -->
	<select id="getAccountFourListByApplyNo" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryTypeFourExportEkpVo">
		select
			case s.STATUS when 0 then '待提交' when 1 then '待审核' when 2 then '待推送明细' when 3 then '已推送待发放' when 4 then '已发放' when 5 then '审核不通过' when 6 then '确认不通过' when 7 then '财务退回' when 10 then '推送失败' when 11 then '已审核生成收入中' when 12 then '已审核生成收入失败' else '-' end as status
				,
			a.DEPT_NAME as deptName,
			a.DEPT_NO as deptNo,
			a.SETTLEMENT_MONTH as settlementMonth,
			a.SALARY_MONTH as salaryMonth,
			a.EMP_NAME as empName,
			a.EMP_IDCARD as empIdcard,
			a.EMP_PHONE as empPhone,
			a.BANK_NO as bankNo,
			a.BANK_NAME as bankName,
			ap.AREA_NAME as bankProvince,
			ac.AREA_NAME as bankCity,
			a.BANK_SUB_NAME as bankSubName,
			a.RELAY_SALARY as relaySalary,
			a.SALARY_TAX as salaryTax,
			a.ACTUAL_SALARY as actualSalary,
			if(a.IS_REPEAT='0','否','是') as isRepeat,
			if(a.OWN_FLAG='0','否','是') as ownFlag,
			if(a.HAVE_SALARY_FLAG='0','否','是') as haveSalaryFlag,
			if(a.PAY_SETTLE_FLAG = '0','已结算',if(a.PAY_SETTLE_FLAG = '1','结算中',if(a.PAY_SETTLE_FLAG = '2','未结算','-'))) paySettleFlag
		from
			t_salary_account a
				left join t_salary_standard s on a.SALARY_FORM_ID = s.id
				left join t_salary_account_item annualBonus on annualBonus.SALARY_ACCOUNT_ID = a.id and annualBonus.JAVA_FIED_NAME = 'annualBonus'
				left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
				left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
				left join sys_area ap on ap.id=a.BANK_PROVINCE
				left join sys_area ac on ac.id=a.BANK_CITY
		where s.APPLY_NO = #{applyNo} and a.DELETE_FLAG = 0
		GROUP BY a.id ORDER BY a.ROW_INDEX ASC
	</select>
1494 1495 1496

	<!-- C端预入职查询薪资当前年度是否有发薪记录,无则返回空,有则返回Id -->
	<select id="getAccountIdByIdCard" resultType="java.lang.Integer">
hongguangwu's avatar
hongguangwu committed
1497
		select count(1) from t_salary_account a where a.DELETE_FLAG = 0 and a.EMP_IDCARD = #{empIdCard} and a.SETTLEMENT_MONTH like concat(DATE_FORMAT(NOW(), '%Y'), '%')
1498
	</select>
fangxinjiang's avatar
fangxinjiang committed
1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525
	<select id="noPageDiyLast" resultMap="tSalaryAccountMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountExportVo">
		SELECT
		a.DEPT_NAME,
		a.DEPT_NO,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.EMP_PHONE,
		a.BANK_NO,
		a.BANK_NAME,
		ap.AREA_NAME BANK_PROVINCE,
		ac.AREA_NAME BANK_CITY,
		a.BANK_SUB_NAME,
		case a.FORM_TYPE when '0' then '薪资' when '1' then '绩效' when '3' then '劳务费' when '4' then '稿酬' else '其他' end as FORM_TYPE,
		a.SALARY_MONTH,
		if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0,a.RELAY_SALARY_UNIT,ifnull(a.RELAY_SALARY,0)) RELAY_SALARY,
		a.ACTUAL_SALARY
		FROM
		<if test="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201'">
			t_salary_account a
		</if>
		<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() &lt; '202201' ">
			t_salary_account_hro_2021 a
		</if>
		left join sys_area ap on ap.id=a.BANK_PROVINCE
		left join sys_area ac on ac.id=a.BANK_CITY
		<where>
			a.DELETE_FLAG = 0
1526

fangxinjiang's avatar
fangxinjiang committed
1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545
			<include refid="where_export"/>
			<if test="deptNos != null and deptNos.size>0">
				AND a.DEPT_NO not in
				<foreach item="no" index="index" collection="deptNos" open="(" separator="," close=")">
					#{no}
				</foreach>
			</if>
			<if test="searchVo.authSql != null and searchVo.authSql.trim() != ''">
				${searchVo.authSql}
			</if>
			ORDER BY a.CREATE_TIME desc
			<if test="searchVo != null">
				<if test="searchVo.limitStart != null">
					limit #{searchVo.limitStart},#{searchVo.limitEnd}
				</if>
			</if>
		</where>

	</select>
1546

fangxinjiang's avatar
fangxinjiang committed
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558
	<select id="noPageCountDiyLast"  resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM
		<if test="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201' ">
			t_salary_account a
		</if>
		<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() &lt; '202201' ">
			t_salary_account_hro_2021 a
		</if>
		<where>
			a.DELETE_FLAG = 0
1559

fangxinjiang's avatar
fangxinjiang committed
1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575
			<include refid="where_export"/>
			<if test="deptNos != null and deptNos.size>0">
				AND a.DEPT_NO not in
				<foreach item="no" index="index" collection="deptNos" open="(" separator="," close=")">
					#{no}
				</foreach>
			</if>
			<if test="searchVo.authSql != null and searchVo.authSql.trim() != ''">
				${searchVo.authSql}
			</if>
		</where>
	</select>

	<select id="auditExportDiy" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportVo"
			parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
		select
1576
		a.SALARY_FORM_ID as salaryFormId,
fangxinjiang's avatar
fangxinjiang committed
1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606
		a.id,
		case a.FORM_TYPE when '0' then '薪资' when '1' then '绩效' when '3' then '劳务费' when '4' then '稿酬' else '其他' end as formType,
		a.EMP_PHONE as empPhone,
		a.TAX_MONTH as taxMonth,
		a.SETTLEMENT_MONTH as settlementMonth,
		a.SALARY_MONTH as salaryMonth,
		a.INVOICE_TITLE as invoiceTitle,
		a.UNIT_NAME as unitName,
		a.UNIT_NO as unitNo,
		a.DEPT_NAME as deptName,
		a.DEPT_NO as deptNo,
		a.EMP_NAME as empName,
		a.EMP_IDCARD as empIdcard,
		if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0, a.RELAY_SALARY_UNIT, ifnull(a.RELAY_SALARY,0)) as relaySalary,
		a.ACTUAL_SALARY as actualSalary,
		ifnull(a.SALARY_TAX,0) + ifnull(a.SALARY_TAX_UNIT,0) as salaryTax,
		a.ANNUAL_BONUS_TAX as annualBonusTax,
		a.PERSON_SOCIAL as personSocial,
		a.PERSON_FUND as personFund,
		a.UNIT_SOCIAL as unitSocial,
		a.UNIT_FUND as unitFund,
		a.SUM_BABY_MONEY as sumBabyMoney,
		a.SUM_CHILD_EDU_MONEY as sumChildEduMoney,
		a.SUM_CONTINUING_EDUCATION_MONEY as sumContinuingEducationMoney,
		a.SUM_HOUSING_LOAN_MONEY as sumHousingLoanMoney,
		a.SUM_HOUSING_RENT_MONEY as sumHousingRentMoney,
		a.SUM_PRIVATE_PENSION as sumPrivatePension,
		a.SUM_SUPPORT_ELDERLY_MONEY as sumSupportElderlyMoney,
		a.COST_REDUCTION as costReduction,
		a.CREATE_NAME as createName,
1607 1608
		if(a.PAY_SETTLE_FLAG = '0','已结算',if(a.PAY_SETTLE_FLAG = '1','结算中',if(a.PAY_SETTLE_FLAG = '2','未结算','-'))) paySettleFlag
		/*
fangxinjiang's avatar
fangxinjiang committed
1609
		,phoneSubsidy.SALARY_MONEY as phoneSubsidy
1610 1611 1612 1613
		annualBonus.SALARY_MONEY as annualBonus,
		exemptionPersionTax.SALARY_MONEY as exemptionPersionTax,
		enterpriseAnnuity.SALARY_MONEY as enterpriseAnnuity,
		  */
fangxinjiang's avatar
fangxinjiang committed
1614 1615
		from
		t_salary_account a
1616
		/*left join t_salary_standard s on a.SALARY_FORM_ID = s.id
fangxinjiang's avatar
fangxinjiang committed
1617 1618 1619
		left join t_salary_account_item annualBonus on annualBonus.SALARY_ACCOUNT_ID = a.id and annualBonus.JAVA_FIED_NAME = 'annualBonus'
		left join t_salary_account_item exemptionPersionTax on exemptionPersionTax.SALARY_ACCOUNT_ID = a.id and exemptionPersionTax.JAVA_FIED_NAME='exemptionPersionTax'
		left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
1620 1621
		left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
		left join t_salary_account_item phoneSubsidy on phoneSubsidy.SALARY_ACCOUNT_ID = a.id and phoneSubsidy.JAVA_FIED_NAME='phoneSubsidy'*/
fangxinjiang's avatar
fangxinjiang committed
1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634
		<where>
			a.DELETE_FLAG = 0
			<include refid="where_export"/>
			/*GROUP BY a.id */
			ORDER BY a.SALARY_MONTH asc
			<if test="searchVo != null">
				<if test="searchVo.limitStart != null">
					limit #{searchVo.limitStart},#{searchVo.limitEnd}
				</if>
			</if>
		</where>

	</select>
1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649
	<select id="auditExportPhoneSubsidy" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TAuditExportItemVo">
		select
		phoneSubsidy.SALARY_ACCOUNT_ID as salaryAccountId,
		phoneSubsidy.SALARY_MONEY as phoneSubsidy
		FROM
		t_salary_account_item phoneSubsidy
		where
		phoneSubsidy.JAVA_FIED_NAME='phoneSubsidy'
		<if test="idList != null and idList.size>0">
			AND phoneSubsidy.SALARY_ACCOUNT_ID  in
			<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
				#{idStr}
			</foreach>
		</if>
	</select>
fangxinjiang's avatar
fangxinjiang committed
1650

1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712
	<select id="auditExportEnterpriseAnnuity" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TAuditExportItemVo">
		select
		enterpriseAnnuity.SALARY_ACCOUNT_ID as salaryAccountId,
		enterpriseAnnuity.SALARY_MONEY as enterpriseAnnuity
		FROM
		t_salary_account_item enterpriseAnnuity
		where
		enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
		<if test="idList != null and idList.size>0">
			AND enterpriseAnnuity.SALARY_ACCOUNT_ID  in
			<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
				#{idStr}
			</foreach>
		</if>
	</select>
	<select id="auditExportExemptionPersionTax" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TAuditExportItemVo">
		select
		exemptionPersionTax.SALARY_ACCOUNT_ID as salaryAccountId,
		exemptionPersionTax.SALARY_MONEY as exemptionPersionTax
		FROM
		t_salary_account_item exemptionPersionTax
		where
		exemptionPersionTax.JAVA_FIED_NAME='exemptionPersionTax'
		<if test="idList != null and idList.size>0">
			AND exemptionPersionTax.SALARY_ACCOUNT_ID  in
			<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
				#{idStr}
			</foreach>
		</if>
	</select>
	<select id="auditExportAnnualBonus" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TAuditExportItemVo">
		select
		annualBonus.SALARY_ACCOUNT_ID as salaryAccountId,
		annualBonus.SALARY_MONEY as annualBonus
		FROM
		t_salary_account_item annualBonus
		where
		annualBonus.JAVA_FIED_NAME = 'annualBonus'
		<if test="idList != null and idList.size>0">
			AND annualBonus.SALARY_ACCOUNT_ID  in
			<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
				#{idStr}
			</foreach>
		</if>
	</select>
	<select id="auditExportStandard" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TAuditExportStandardVo">
		select
		s.id as salaryFormId
		,case s.STATUS when 0 then '待提交' when 1 then '待审核' when 2 then '待推送明细' when 3 then '已推送待发放' when 4 then '已发放' when 5 then '审核不通过' when 6 then '确认不通过' when 7 then '财务退回' when 10 then '推送失败' when 11 then '已审核生成收入中' when 12 then '已审核生成收入失败' else '-' end as status
		,s.BUSINESS_PRIMARY_TYPE as businessPrimaryType
		,s.BUSINESS_SECOND_TYPE as businessSecondType
		,s.BUSINESS_THIRD_TYPE as businessThirdType
		FROM
		t_salary_standard s
		where
		<if test="idList != null and idList.size>0">
			s.id  in
			<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
				#{idStr}
			</foreach>
		</if>
	</select>
fangxinjiang's avatar
fangxinjiang committed
1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739
	<select id="auditExportSelectItems" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountItemExportVo">
		select
			GROUP_CONCAT(pdeduction.CN_NAME,':',pdeduction.SALARY_MONEY SEPARATOR ';') pdeductionDetail,
			sum(ifnull(pdeduction.SALARY_MONEY,0)) pdeductionMoney,
			pdeduction.SALARY_ACCOUNT_ID as salaryAccountId
		FROM
			t_salary_account_item pdeduction
		where
			pdeduction.JAVA_FIED_NAME='pdeduction'
			<if test="idList != null and idList.size>0">
				AND pdeduction.SALARY_ACCOUNT_ID  in
				<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
					#{idStr}
				</foreach>
			</if>
		GROUP BY pdeduction.SALARY_ACCOUNT_ID
	</select>
	<select id="auditExportCountDiy"  resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM
		t_salary_account a
		<where>
			a.DELETE_FLAG = 0
			<include refid="where_export"/>
		</where>
	</select>
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749

	<!-- 获取报账明细的身份证 -->
	<select id="getIdCardListBySalaryId" resultMap="tSalaryAccountMap">
		SELECT
			a.EMP_NAME,
			a.EMP_IDCARD
		FROM t_salary_account a
		where a.DELETE_FLAG = 0 and a.SALARY_FORM_ID = #{salaryId}
	</select>

hongguangwu's avatar
hongguangwu committed
1750
</mapper>