CitSalaryAdvanceExtendsMapper.xml 11.5 KB
Newer Older
1 2 3
<?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="pwc.taxtech.atms.dao.CitSalaryAdvanceMapper">
4 5
  <sql id="QueryCondition">
    1 = 1
6 7 8 9 10
        <if test="@com.github.pagehelper.util.StringUtil@isNotEmpty(citPreviewSalaryAdvance.period)">
          AND period= #{citPreviewSalaryAdvance.period,jdbcType=VARCHAR}
        </if>
    <if test="citPreviewSalaryAdvance.poSubjectName!=null and citPreviewSalaryAdvance.poSubjectName != '' ">
      AND po_subject_name &gt;= #{citPreviewSalaryAdvance.poSubjectName,jdbcType=INTEGER}
11 12
    </if>
    <if test="citPreviewSalaryAdvance.periodStart!=null and citPreviewSalaryAdvance.periodStart!= '' and citPreviewSalaryAdvance.periodEnd!= null and citPreviewSalaryAdvance.periodEnd!= ''">
13
      AND period  between  ${citPreviewSalaryAdvance.periodStart} and ${citPreviewSalaryAdvance.periodEnd}
14
    </if>
15 16
    <if test="citPreviewSalaryAdvance.periodStart == null and citPreviewSalaryAdvance.periodStart != '' and citPreviewSalaryAdvance.periodEnd != null and citPreviewSalaryAdvance.periodEnd != ''">
      AND period  &lt; ${citPreviewSalaryAdvance.periodEnd} or period = ${citPreviewSalaryAdvance.periodEnd}
17
    </if>
18 19
    <if test="citPreviewSalaryAdvance.periodStart != null and citPreviewSalaryAdvance.periodStart != '' and citPreviewSalaryAdvance.periodEnd == null and citPreviewSalaryAdvance.periodEnd  != '' ">
      AND period  &gt; ${citPreviewSalaryAdvance.periodStart} or period = ${citPreviewSalaryAdvance.periodStart}
20 21
    </if>
  </sql>
22 23

  <insert id="insertBatch" parameterType="java.util.List">
zhkwei's avatar
zhkwei committed
24
    insert into cit_salary_advance
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
    (<include refid="Base_Column_List"/>)
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
        <choose>
          <when test="item.id != null">#{item.id,jdbcType=BIGINT},</when>
          <otherwise>0,</otherwise>
        </choose>
        <choose>
          <when test="item.organizationId != null">#{item.organizationId,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.projectId != null">#{item.projectId,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
zhkwei's avatar
zhkwei committed
42 43
          <when test="item.period != null">#{item.period,jdbcType=INTEGER},</when>
          <otherwise>0,</otherwise>
44 45 46 47 48 49
        </choose>
        <choose>
          <when test="item.source != null">#{item.source,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
50 51
          <when test="item.poNo != null">#{item.poNo,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
52
        </choose>
53 54 55 56 57
        <choose>
          <when test="item.poRow != null">#{item.poRow,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
58 59
          <when test="item.poCreateTime != null">#{item.poCreateTime,jdbcType=TIMESTAMP},</when>
          <otherwise>CURRENT_TIMESTAMP,</otherwise>
60 61 62 63 64 65 66 67 68
        </choose>
        <choose>
          <when test="item.ladingBillPerson != null">#{item.ladingBillPerson,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.purchasePerson != null">#{item.purchasePerson,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
69 70 71 72
        <choose>
          <when test="item.poSubjectCode != null">#{item.poSubjectCode,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
zhkwei's avatar
zhkwei committed
73 74 75 76
        <choose>
          <when test="item.poSubjectName != null">#{item.poSubjectName,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
77 78 79 80 81 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
        <choose>
          <when test="item.costCenterCode != null">#{item.costCenterCode,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.costCenter != null">#{item.costCenter,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.supplier != null">#{item.supplier,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.item != null">#{item.item,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.standardMoney != null">#{item.standardMoney,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.currency != null">#{item.currency,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.orderAmount != null">#{item.orderAmount,jdbcType=DECIMAL},</when>
          <otherwise>0,</otherwise>
        </choose>
        <choose>
          <when test="item.executedServiceSchedule != null">#{item.executedServiceSchedule,jdbcType=DECIMAL},</when>
          <otherwise>0,</otherwise>
        </choose>
        <choose>
          <when test="item.coupaTotalAccept != null">#{item.coupaTotalAccept,jdbcType=DECIMAL},</when>
          <otherwise>0,</otherwise>
        </choose>
113 114 115 116
        <choose>
          <when test="item.advance != null">#{item.advance,jdbcType=DECIMAL},</when>
          <otherwise>0,</otherwise>
        </choose>
117 118 119 120
        <choose>
          <when test="item.unexecutedServiceSchedule != null">#{item.unexecutedServiceSchedule,jdbcType=DECIMAL},</when>
          <otherwise>0,</otherwise>
        </choose>
121 122 123
        <choose>
          <when test="item.approvedStandardInvoiceAmount != null">#{item.approvedStandardInvoiceAmount,jdbcType=DECIMAL},</when>
          <otherwise>0,</otherwise>
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
        </choose>
         <choose>
          <when test="item.paidInvoiceAmount != null">#{item.paidInvoiceAmount,jdbcType=DECIMAL},</when>
          <otherwise>0,</otherwise>
        </choose>
        <choose>
          <when test="item.usableInvoiceAmount != null">#{item.usableInvoiceAmount,jdbcType=DECIMAL},</when>
          <otherwise>0,</otherwise>
        </choose>
        <choose>
          <when test="item.usableBalance != null">#{item.usableBalance,jdbcType=DECIMAL},</when>
          <otherwise>0,</otherwise>
        </choose>
         <choose>
          <when test="item.advanceWriteOff != null">#{item.advanceWriteOff,jdbcType=DECIMAL},</when>
          <otherwise>0,</otherwise>
        </choose>
        <choose>
zhkwei's avatar
zhkwei committed
142
          <when test="item.subjectCode != null">#{item.subjectCode,jdbcType=VARCHAR},</when>
143 144 145
          <otherwise>'',</otherwise>
        </choose>
        <choose>
zhkwei's avatar
zhkwei committed
146 147 148 149 150 151 152 153 154 155 156 157 158 159
          <when test="item.subjectDescription != null">#{item.subjectDescription,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.auxiliarySubject != null">#{item.auxiliarySubject,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.auxiliarySubjectDescription != null">#{item.auxiliarySubjectDescription,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.profitCenter != null">#{item.profitCenter,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
160 161
        </choose>
        <choose>
zhkwei's avatar
zhkwei committed
162
          <when test="item.profitCenterDescription != null">#{item.profitCenterDescription,jdbcType=VARCHAR},</when>
163 164 165
          <otherwise>'',</otherwise>
        </choose>
        <choose>
zhkwei's avatar
zhkwei committed
166
          <when test="item.product != null">#{item.product,jdbcType=VARCHAR},</when>
167 168 169
          <otherwise>'',</otherwise>
        </choose>
        <choose>
zhkwei's avatar
zhkwei committed
170
          <when test="item.productDescription != null">#{item.productDescription,jdbcType=VARCHAR},</when>
171 172 173
          <otherwise>'',</otherwise>
        </choose>
        <choose>
zhkwei's avatar
zhkwei committed
174
          <when test="item.project != null">#{item.project,jdbcType=VARCHAR},</when>
175 176 177
          <otherwise>'',</otherwise>
        </choose>
        <choose>
zhkwei's avatar
zhkwei committed
178 179 180 181 182 183 184 185 186
          <when test="item.projectDescription != null">#{item.projectDescription,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.company != null">#{item.company,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.companyDescription != null">#{item.companyDescription,jdbcType=VARCHAR},</when>
187 188 189 190 191 192
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.segment1 != null">#{item.segment1,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
zhkwei's avatar
zhkwei committed
193 194 195 196
        <choose>
          <when test="item.segment1Description != null">#{item.segment1Description,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
197 198 199
        <choose>
          <when test="item.segment2 != null">#{item.segment2,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
200
        </choose>
zhkwei's avatar
zhkwei committed
201 202 203 204
        <choose>
          <when test="item.segment2Description != null">#{item.segment2Description,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
        <choose>
          <when test="item.createdBy != null">#{item.createdBy,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.updatedBy != null">#{item.updatedBy,jdbcType=VARCHAR},</when>
          <otherwise>'',</otherwise>
        </choose>
        <choose>
          <when test="item.createTime != null">#{item.createTime,jdbcType=TIMESTAMP},</when>
          <otherwise>CURRENT_TIMESTAMP,</otherwise>
        </choose>
        <choose>
          <when test="item.updateTime != null">#{item.updateTime,jdbcType=TIMESTAMP},</when>
          <otherwise>CURRENT_TIMESTAMP,</otherwise>
        </choose>
221 222 223 224
        <choose>
          <when test="item.month != null">#{item.month,jdbcType=INTEGER},</when>
          <otherwise>0,</otherwise>
        </choose>
225 226 227 228 229
      </trim>
    </foreach>;
    SELECT 1 FROM DUAL;
  </insert>

230 231 232 233


  <select id ="selectByCondition" parameterType="pwc.taxtech.atms.entity.CitSalaryAdvance" resultType="pwc.taxtech.atms.entity.CitSalaryAdvance">
    select
234 235 236 237 238 239 240 241 242 243
    organization_id  organizationId,
    project_id projectId,
    period ,
    source,
    po_no  poNo,
    po_subject_code poSubjectCode,
    po_subject_name poSubjectName,
    advance advance,
    approved_standard_invoice_amount approvedStandardInvoiceAmount,
    created_by createdBy,
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
    create_time createTime,
    remark,
    credit_prepaid_accounts as creditPrepaidAccounts,
    debit_advance_gene as debitAdvanceGene,

    ledger_id ledgerId,
    exchange_rate exchangeRate,
    reclassify_amount reclassifyAmount ,
    check_one checkOne,
    advance_write_off advanceWriteOff,
    usable_balance usableBalance,
    usable_invoice_amount usableInvoiceAmount,
    paid_invoice_amount paidInvoiceAmount,
    approved_standard_invoice_amount approvedStandardInvoiceAmount,
    unexecuted_service_schedule unexecutedServiceSchedule,
    advance advance ,
    coupa_total_accept coupaTotalAccept,
    executed_service_schedule executedServiceSchedule,
    order_amount orderAmount,
    currency currency,
    standard_money standardMoney,
    item item
    supplier supplier,
    cost_center costCenter,
    cost_center_code costCenterCode,
    po_subject_code poSubjectCode,
    purchase_person  purchasePerson,
    lading_bill_person ladingBillPerson,
    po_row poRow,
    po_no poNo,
    po_create_time poCreateTime,
275
    from cit_salary_advance
276 277 278
    WHERE
    <include refid="QueryCondition"/>
  </select>
279
</mapper>