TSalaryAccountItemMapper.xml 20.2 KB
Newer Older
hongguangwu's avatar
hongguangwu committed
1 2 3 4 5 6
<?xml version="1.0" encoding="UTF-8"?>

<!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.TSalaryAccountItemMapper">

fangxinjiang's avatar
fangxinjiang committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
    <resultMap id="tSalaryAccountItemMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem">
        <id property="id" column="ID"/>
        <result property="salaryAccountId" column="SALARY_ACCOUNT_ID"/>
        <result property="cnName" column="CN_NAME"/>
        <result property="javaFiedName" column="JAVA_FIED_NAME"/>
        <result property="salaryMoney" column="SALARY_MONEY"/>
        <result property="textValue" column="TEXT_VALUE"/>
        <result property="isTax" column="IS_TAX"/>
    </resultMap>

    <!-- 工资导入优化使用的vo -->
    <resultMap id="itemVoMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem">
        <id property="id" column="ID"/>
        <result property="salaryAccountId" column="SALARY_ACCOUNT_ID"/>
        <result property="cnName" column="CN_NAME"/>
        <result property="javaFiedName" column="JAVA_FIED_NAME"/>
        <result property="salaryMoney" column="SALARY_MONEY"/>
        <result property="textValue" column="TEXT_VALUE"/>
        <result property="isTax" column="IS_TAX"/>
        <result property="empIdcard" column="EMP_IDCARD"/>
        <result property="settlementMonth" column="SETTLEMENT_MONTH"/>
28
        <result property="formType" column="FORM_TYPE"/>
fangxinjiang's avatar
fangxinjiang committed
29 30
    </resultMap>

hongguangwu's avatar
hongguangwu committed
31 32 33
    <!--tSalaryAccountItem简单分页查询-->
    <select id="getTSalaryAccountItemPage" resultMap="tSalaryAccountItemMap">
        SELECT
fangxinjiang's avatar
fangxinjiang committed
34 35 36 37 38 39 40
        ID,
        SALARY_ACCOUNT_ID,
        CN_NAME,
        JAVA_FIED_NAME,
        SALARY_MONEY,
        TEXT_VALUE,
        IS_TAX
41 42 43 44 45 46 47
        FROM
			<if test="tSalaryAccountItem.salaryMonth == null or tSalaryAccountItem.salaryMonth.trim() >= '202201'">
				t_salary_account_item a
			</if>
			<if test="tSalaryAccountItem.salaryMonth != null and tSalaryAccountItem.salaryMonth.trim() &lt; '202201' ">
				t_salary_account_item_hro_2021 a
			</if>
fangxinjiang's avatar
fangxinjiang committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
        <where>
            <if test="tSalaryAccountItem.id != null and tSalaryAccountItem.id.trim() != ''">
                AND ID = #{tSalaryAccountItem.id}
            </if>
            <if test="tSalaryAccountItem.salaryAccountId != null and tSalaryAccountItem.salaryAccountId.trim() != ''">
                AND SALARY_ACCOUNT_ID = #{tSalaryAccountItem.salaryAccountId}
            </if>
            <if test="tSalaryAccountItem.cnName != null and tSalaryAccountItem.cnName.trim() != ''">
                AND CN_NAME = #{tSalaryAccountItem.cnName}
            </if>
            <if test="tSalaryAccountItem.javaFiedName != null and tSalaryAccountItem.javaFiedName.trim() != ''">
                AND JAVA_FIED_NAME = #{tSalaryAccountItem.javaFiedName}
            </if>
            <if test="tSalaryAccountItem.salaryMoney != null and tSalaryAccountItem.salaryMoney.trim() != ''">
                AND SALARY_MONEY = #{tSalaryAccountItem.salaryMoney}
            </if>
        </where>
    </select>

    <select id="getAllTSalaryAccountItem" resultMap="tSalaryAccountItemMap">
        SELECT
        i.ID,
        i.SALARY_ACCOUNT_ID,
        i.CN_NAME,
        i.JAVA_FIED_NAME,
        i.SALARY_MONEY,
        i.TEXT_VALUE,
        i.IS_TAX
        FROM
        t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
        <where>
            a.DELETE_FLAG = 0
80 81
            <if test="deptId != null and deptId.trim() != ''">
                AND a.DEPT_ID = #{deptId}
fangxinjiang's avatar
fangxinjiang committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
            </if>
            <if test="settleMonth != null and settleMonth.trim() != ''">
                AND a.SETTLEMENT_MONTH = #{settleMonth}
            </if>
            <if test="javaFiedName != null and javaFiedName.trim() != ''">
                AND i.JAVA_FIED_NAME = #{javaFiedName}
            </if>
            <if test="finallyYear != null and finallyYear.trim() != ''">
                AND a.SETTLEMENT_MONTH like concat(#{finallyYear}, '%')
            </if>
            <if test="empIdcard != null and empIdcard.trim() != ''">
                AND a.EMP_IDCARD = #{empIdcard}
            </if>
            <if test="accountId != null and accountId.trim() != ''">
                AND a.id != #{accountId}
            </if>
        </where>
    </select>

    <select id="getEmpAllSalaryAccountItem" resultMap="tSalaryAccountItemMap">
        SELECT
        i.ID,
        i.SALARY_ACCOUNT_ID,
        i.CN_NAME,
        i.JAVA_FIED_NAME,
        i.SALARY_MONEY,
        i.TEXT_VALUE,
        i.IS_TAX
        FROM
        t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
        <where>
113
            a.DELETE_FLAG = 0 and a.FORM_TYPE != 7
fangxinjiang's avatar
fangxinjiang committed
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
            <if test="idCard != null and idCard.trim() != ''">
                AND a.EMP_IDCARD = #{idCard}
            </if>
            <if test="maxYearMonth != null and maxYearMonth.trim() != ''">
                AND a.SETTLEMENT_MONTH >= #{maxYearMonth}
            </if>
            <if test="invoiceTitle != null and invoiceTitle.trim() != ''">
                AND a.INVOICE_TITLE = #{invoiceTitle}
            </if>
        </where>
    </select>

    <select id="getAllMoney" resultType="java.math.BigDecimal">
        SELECT
        sum(i.SALARY_MONEY)
        FROM
        t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
        <where>
            a.DELETE_FLAG = 0
133 134
            <if test="deptId != null and deptId.trim() != ''">
                AND a.DEPT_ID = #{deptId}
fangxinjiang's avatar
fangxinjiang committed
135 136 137 138
            </if>
            <if test="javaFiedName != null and javaFiedName.trim() != ''">
                AND i.JAVA_FIED_NAME = #{javaFiedName}
            </if>
139 140
            <if test="salaryMonth != null and salaryMonth.trim() != ''">
                AND a.SALARY_MONTH > #{salaryMonth}
fangxinjiang's avatar
fangxinjiang committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
            </if>
            <if test="empIdcard != null and empIdcard.trim() != ''">
                AND a.EMP_IDCARD = #{empIdcard}
            </if>
        </where>
    </select>
    <select id="getAllMoneyByAccountIdAndFiedName" resultType="java.math.BigDecimal">
        SELECT
        sum(i.SALARY_MONEY)
        FROM
        t_salary_account_item i
         where
            i.SALARY_ACCOUNT_ID in (${accountId})
            AND i.JAVA_FIED_NAME = '${javaFiedName}'
    </select>

    <select id="getAverageSalaryItemMonthCount" resultType="Integer">
        SELECT
159
        count(DISTINCT a.SALARY_MONTH)
fangxinjiang's avatar
fangxinjiang committed
160 161 162 163
        FROM
        t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
        <where>
            a.DELETE_FLAG = 0
164 165
            <if test="deptId != null and deptId.trim() != ''">
                AND a.DEPT_ID = #{deptId}
fangxinjiang's avatar
fangxinjiang committed
166 167 168 169
            </if>
            <if test="javaFiedName != null and javaFiedName.trim() != ''">
                AND i.JAVA_FIED_NAME = #{javaFiedName}
            </if>
170 171
            <if test="salaryMonth != null and salaryMonth.trim() != ''">
                AND a.SALARY_MONTH > #{salaryMonth}
fangxinjiang's avatar
fangxinjiang committed
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
            </if>
            <if test="empIdcard != null and empIdcard.trim() != ''">
                AND a.EMP_IDCARD = #{empIdcard}
            </if>
        </where>

    </select>

    <select id="getEngineerAllMoney" resultType="java.math.BigDecimal">
        SELECT
        sum(i.SALARY_MONEY)
        FROM
        t_engineer_account_item i left join t_engineer_account a on i.SALARY_ACCOUNT_ID = a.ID
        <where>
            a.DELETE_FLAG = 0
187 188
            <if test="deptId != null and deptId.trim() != ''">
                AND a.DEPT_ID = #{deptId}
fangxinjiang's avatar
fangxinjiang committed
189 190 191 192
            </if>
            <if test="javaFiedName != null and javaFiedName.trim() != ''">
                AND i.JAVA_FIED_NAME = #{javaFiedName}
            </if>
193 194
            <if test="salaryMonth != null and salaryMonth.trim() != ''">
                AND a.SALARY_MONTH > #{salaryMonth}
fangxinjiang's avatar
fangxinjiang committed
195 196 197 198 199 200 201 202 203
            </if>
            <if test="empIdcard != null and empIdcard.trim() != ''">
                AND a.EMP_IDCARD = #{empIdcard}
            </if>
        </where>
    </select>

    <select id="getEngineerAverageSalaryItemMonthCount" resultType="Integer">
        SELECT
204
        count(DISTINCT a.SALARY_MONTH)
fangxinjiang's avatar
fangxinjiang committed
205 206
        FROM
        t_engineer_account_item i left join t_engineer_account a on i.SALARY_ACCOUNT_ID = a.ID
hongguangwu's avatar
hongguangwu committed
207
        <where>
fangxinjiang's avatar
fangxinjiang committed
208
            a.DELETE_FLAG = 0
209 210
            <if test="deptId != null and deptId.trim() != ''">
                AND a.DEPT_ID = #{deptId}
fangxinjiang's avatar
fangxinjiang committed
211 212 213 214
            </if>
            <if test="javaFiedName != null and javaFiedName.trim() != ''">
                AND i.JAVA_FIED_NAME = #{javaFiedName}
            </if>
215 216
            <if test="salaryMonth != null and salaryMonth.trim() != ''">
                AND a.SALARY_MONTH > #{salaryMonth}
fangxinjiang's avatar
fangxinjiang committed
217 218 219 220
            </if>
            <if test="empIdcard != null and empIdcard.trim() != ''">
                AND a.EMP_IDCARD = #{empIdcard}
            </if>
hongguangwu's avatar
hongguangwu committed
221 222
        </where>
    </select>
fangxinjiang's avatar
fangxinjiang committed
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280

    <!--获取报账表金额-->
    <select id="getMoneyByAccountIdAndJavaFiedName" resultType="java.math.BigDecimal">
        SELECT
        i.SALARY_MONEY
        FROM
        t_salary_account_item i
         where
         i.SALARY_ACCOUNT_ID = #{accountId}
        AND i.JAVA_FIED_NAME = '${javaFiedName}'
    </select>

    <!--报账明细-->
    <select id="getAccountItemList" resultMap="tSalaryAccountItemMap">
        SELECT
        i.ID,
        i.SALARY_ACCOUNT_ID,
        i.CN_NAME,
        i.JAVA_FIED_NAME,
        i.SALARY_MONEY,
        i.TEXT_VALUE,
        i.IS_TAX
        FROM t_salary_account_item i
        left join t_salary_account a on a.id=i.SALARY_ACCOUNT_ID
        left join t_salary_standard s on s.id = a.SALARY_FORM_ID
        <if test="unitName != null">
            left join view_dept_unit d on d.id = s.DEPART_ID
        </if>
        <if test="userDeptId != null">
            left join view_sys_user u on u.user_id = s.CREATE_USER
        </if>
        <where>
            a.DELETE_FLAG = 0
            <if test="idStr != null and idStr.trim() != ''">
                AND a.id in (${idStr})
            </if>
            <if test="idStr == null or idStr.trim() == ''">
                <if test="tSalaryAccount.invoiceTitle != null and tSalaryAccount.invoiceTitle.trim() != ''">
                    AND a.INVOICE_TITLE = #{tSalaryAccount.invoiceTitle}
                </if>
                <if test="tSalaryAccount.province != null">
                    AND a.PROVINCE = #{tEngineerAccount.province}
                </if>
                <if test="tSalaryAccount.city != null">
                    AND a.CITY = #{tEngineerAccount.city}
                </if>
                <if test="tSalaryAccount.town != null">
                    AND a.TOWN = #{tEngineerAccount.town}
                </if>
                <if test="tSalaryAccount.taxMonth != null and tSalaryAccount.taxMonth.trim() != ''">
                    AND a.TAX_MONTH = #{tSalaryAccount.taxMonth}
                </if>
                <if test="tSalaryAccount.id != null and tSalaryAccount.id.trim() != ''">
                    AND a.ID = #{tSalaryAccount.id}
                </if>
                <if test="tSalaryAccount.salaryFormId != null and tSalaryAccount.salaryFormId.trim() != ''">
                    AND a.SALARY_FORM_ID = #{tSalaryAccount.salaryFormId}
                </if>
281 282
                <if test="tSalaryAccount.salaryMonth != null and tSalaryAccount.salaryMonth.trim() != ''">
                    AND a.SALARY_MONTH = #{tSalaryAccount.salaryMonth}
fangxinjiang's avatar
fangxinjiang committed
283 284 285 286 287 288 289 290 291 292
                </if>
                <if test="tSalaryAccount.empId != null and tSalaryAccount.empId.trim() != ''">
                    AND a.EMP_ID = #{tSalaryAccount.empId}
                </if>
                <if test="tSalaryAccount.empName != null and tSalaryAccount.empName.trim() != ''">
                    AND a.EMP_NAME like '%${tSalaryAccount.empName}%'
                </if>
                <if test="tSalaryAccount.empNo != null and tSalaryAccount.empNo.trim() != ''">
                    AND a.EMP_NO = #{tSalaryAccount.empNo}
                </if>
293 294
                <if test="tSalaryAccount.deptId != null and tSalaryAccount.deptId.trim() != ''">
                    AND a.BELONG_DEPART = #{tSalaryAccount.deptId}
fangxinjiang's avatar
fangxinjiang committed
295
                </if>
296 297
                <if test="tSalaryAccount.deptNo != null and tSalaryAccount.deptNo.trim() != ''">
                    AND a.DEPT_NO like '%${tSalaryAccount.deptNo}%'
fangxinjiang's avatar
fangxinjiang committed
298
                </if>
299 300
                <if test="tSalaryAccount.deptName != null and tSalaryAccount.deptName.trim() != ''">
                    AND a.DEPT_NAME like '%${tSalaryAccount.deptName}%'
fangxinjiang's avatar
fangxinjiang committed
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
                </if>
                <if test="tSalaryAccount.empIdcard != null and tSalaryAccount.empIdcard.trim() != ''">
                    AND a.EMP_IDCARD like '%${tSalaryAccount.empIdcard}%'
                </if>
                <if test="tSalaryAccount.bankNo != null and tSalaryAccount.bankNo.trim() != ''">
                    AND a.BANK_NO like '%${tSalaryAccount.bankNo}%'
                </if>
                <if test="tSalaryAccount.bankName != null and tSalaryAccount.bankName.trim() != ''">
                    AND a.BANK_NAME = #{tSalaryAccount.bankName}
                </if>
                <if test="tSalaryAccount.salaryCount != null and tSalaryAccount.salaryCount.trim() != ''">
                    AND a.SALARY_COUNT = #{tSalaryAccount.salaryCount}
                </if>
                <if test="tSalaryAccount.salaryStyle != null and tSalaryAccount.salaryStyle.trim() != ''">
                    AND a.SALARY_STYLE = #{tSalaryAccount.salaryStyle}
                </if>
                <if test="tSalaryAccount.salaryGiveTime != null and tSalaryAccount.salaryGiveTime.trim() != ''">
                    AND a.SALARY_GIVE_TIME = #{tSalaryAccount.salaryGiveTime}
                </if>
                <if test="tSalaryAccount.distributionFlag != null and tSalaryAccount.distributionFlag.trim() != ''">
                    AND a.DISTRIBUTION_FLAG = #{tSalaryAccount.distributionFlag}
                </if>
                <if test="tSalaryAccount.deduSocialMonth != null and tSalaryAccount.deduSocialMonth.trim() != ''">
                    AND a.DEDU_SOCIAL_MONTH = #{tSalaryAccount.deduSocialMonth}
                </if>
                <if test="tSalaryAccount.deduProvidentMonth != null and tSalaryAccount.deduProvidentMonth.trim() != ''">
                    AND a.DEDU_PROVIDENT_MONTH = #{tSalaryAccount.deduProvidentMonth}
                </if>
329 330
                <if test="tSalaryAccount.formType != null and tSalaryAccount.formType.trim() != ''">
                    AND a.FORM_TYPE = #{tSalaryAccount.formType}
fangxinjiang's avatar
fangxinjiang committed
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
                </if>
                <if test="tSalaryAccount.salaryTaxFlag != null and tSalaryAccount.salaryTaxFlag.trim() != ''">
                    AND a.SALARY_TAX_FLAG = #{tSalaryAccount.salaryTaxFlag}
                </if>
                <if test="tSalaryAccount.settlementMonth != null and tSalaryAccount.settlementMonth.trim() != ''">
                    AND a.SETTLEMENT_MONTH = #{tSalaryAccount.settlementMonth}
                </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="createUserId != null">
                    AND s.CREATE_USER = #{createUserId}
                </if>
                <if test="userDeptId != null">
                    AND u.dept_id = #{userDeptId}
                </if>
                <if test="unitName != null">
                    AND d.CUSTOMER_NAME = '${unitName}'
                </if>
                <if test="settleMonthStart != null">
                    AND a.SETTLEMENT_MONTH >= '${settleMonthStart}'
                </if>
                <if test="settleMonthEnd != null">
                    AND a.SETTLEMENT_MONTH <![CDATA[<=]]> '${settleMonthEnd}'
                </if>
            </if>
        </where>
        order by a.SETTLEMENT_MONTH,a.id desc
    </select>
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400

    <sql id="Base_Column_List">
                a.ID,
                a.SALARY_ACCOUNT_ID,
                a.CN_NAME,
                a.JAVA_FIED_NAME,
                a.SALARY_MONEY,
                a.IS_TAX,
                a.TEXT_VALUE
    </sql>
    <sql id="tSalaryAccountItem_where">
        <if test="tSalaryAccountItem != null">
                    <if test="tSalaryAccountItem.id != null and tSalaryAccountItem.id.trim() != ''">
                        AND a.ID = #{tSalaryAccountItem.id}
                    </if>
                    <if test="tSalaryAccountItem.salaryAccountId != null and tSalaryAccountItem.salaryAccountId.trim() != ''">
                        AND a.SALARY_ACCOUNT_ID = #{tSalaryAccountItem.salaryAccountId}
                    </if>
                    <if test="tSalaryAccountItem.cnName != null and tSalaryAccountItem.cnName.trim() != ''">
                        AND a.CN_NAME = #{tSalaryAccountItem.cnName}
                    </if>
                    <if test="tSalaryAccountItem.javaFiedName != null and tSalaryAccountItem.javaFiedName.trim() != ''">
                        AND a.JAVA_FIED_NAME = #{tSalaryAccountItem.javaFiedName}
                    </if>
                    <if test="tSalaryAccountItem.salaryMoney != null">
                        AND a.SALARY_MONEY = #{tSalaryAccountItem.salaryMoney}
                    </if>
                    <if test="tSalaryAccountItem.isTax != null">
                        AND a.IS_TAX = #{tSalaryAccountItem.isTax}
                    </if>
                    <if test="tSalaryAccountItem.textValue != null and tSalaryAccountItem.textValue.trim() != ''">
                        AND a.TEXT_VALUE = #{tSalaryAccountItem.textValue}
                    </if>
        </if>
    </sql>
fangxinjiang's avatar
fangxinjiang committed
401 402 403 404 405 406 407 408 409 410 411 412 413

    <!-- 获取工资明细 -->
    <select id="getItemSet" resultType="java.lang.String">
        select
            i.cn_name a
        from t_salary_account_item i
        LEFT JOIN t_salary_account a on a.id=i.SALARY_ACCOUNT_ID
        where
            a.SALARY_FORM_ID = #{salaryId}
        GROUP BY i.CN_NAME
        order by i.JAVA_FIED_NAME desc,i.id
    </select>

414 415 416 417 418 419 420 421 422 423 424 425
	<!-- 获取所有数据,组装map,工资导入使用 -->
	<select id="getAllItemVoList" resultMap="itemVoMap">
		SELECT
		i.ID,
		i.SALARY_ACCOUNT_ID,
		i.CN_NAME,
		i.JAVA_FIED_NAME,
		i.SALARY_MONEY,
		i.TEXT_VALUE,
		i.IS_TAX,
		a.EMP_IDCARD,
		a.SETTLEMENT_MONTH,
426
		a.FORM_TYPE
427 428 429 430 431 432 433 434 435 436 437 438 439
		FROM
		t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
		<where>
			a.SETTLEMENT_MONTH like DATE_FORMAT(now(),"%Y%")
			<if test="idCardList != null">
				AND a.EMP_IDCARD in
				<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			<if test="invoiceTitle != null and invoiceTitle.trim() != ''">
				AND a.INVOICE_TITLE = #{invoiceTitle}
			</if>
440
			AND a.DELETE_FLAG = 0 and a.FORM_TYPE != 7
441 442
		</where>
	</select>
huyuchen's avatar
huyuchen committed
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469

	<!-- 获取所有数据,组装map,工资导入使用 -->
	<select id="getSalaryItemVoList" resultMap="itemVoMap">
		SELECT
		i.ID,
		i.SALARY_ACCOUNT_ID,
		i.CN_NAME,
		i.JAVA_FIED_NAME,
		i.SALARY_MONEY,
		i.TEXT_VALUE,
		i.IS_TAX,
		a.EMP_IDCARD,
		a.SETTLEMENT_MONTH,
		a.FORM_TYPE
		FROM
		t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
		<where>
			a.SETTLEMENT_MONTH like DATE_FORMAT(now(),"%Y%")
			<if test="idCardList != null">
				AND a.EMP_IDCARD in
				<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
			<if test="invoiceTitle != null and invoiceTitle.trim() != ''">
				AND a.INVOICE_TITLE = #{invoiceTitle}
			</if>
huyuchen's avatar
huyuchen committed
470
			AND a.DELETE_FLAG = 0 and a.FORM_TYPE in ('0','1','2')
huyuchen's avatar
huyuchen committed
471 472
		</where>
	</select>
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
	<select id="getSumByAccountId" resultType="java.util.Map">
		SELECT
		a.SALARY_ACCOUNT_ID as 'key',
		a.SALARY_MONEY  as 'value'
		FROM
		t_salary_account_item a
		WHERE
		a.SALARY_ACCOUNT_ID IN
		<foreach item="item" index="index" collection="account" open="(" separator="," close=")">
			#{item.id}
		</foreach>
		and
		a.JAVA_FIED_NAME='actualSalarySum'
	</select>

hongguangwu's avatar
hongguangwu committed
488
</mapper>