chengf
2026-03-25 1e0e62187e2b7ff3e1fef23b182a710dc8cd76f8
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
39
40
41
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
71
72
73
74
75
76
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
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
<?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="purchasePaymentServiceDaoImpl">
 
    <!-- 保存采购支付信息 add by system 2026-03-25 -->
    <insert id="savePurchasePaymentInfo" parameterType="Map">
        insert into purchase_payment(id, apply_order_id, payable_amount, paid_amount, unpaid_amount,
        payment_amount, payment_company, pay_type, payment_no, invoice_status, tax_rate, planned_pay_date, pay_date)
        values (#{id}, #{applyOrderId}, #{payableAmount}, #{paidAmount}, #{unpaidAmount},
        #{paymentAmount}, #{paymentCompany}, #{payType}, #{paymentNo}, #{invoiceStatus}, #{taxRate}, #{plannedPayDate}, #{payDate})
    </insert>
 
    <!-- 查询采购支付信息 add by system 2026-03-25 -->
    <select id="getPurchasePaymentInfo" parameterType="Map" resultType="Map">
        select t.id,
        t.apply_order_id,
        t.apply_order_id applyOrderId,
        t.payable_amount,
        t.payable_amount payableAmount,
        t.paid_amount,
        t.paid_amount paidAmount,
        t.unpaid_amount,
        t.unpaid_amount unpaidAmount,
        t.payment_amount,
        t.payment_amount paymentAmount,
        t.payment_company,
        t.payment_company paymentCompany,
        t.pay_type,
        t.pay_type payType,
        t.payment_no,
        t.payment_no paymentNo,
        t.invoice_status,
        t.invoice_status invoiceStatus,
        t.tax_rate,
        t.tax_rate taxRate,
        t.planned_pay_date,
        t.planned_pay_date plannedPayDate,
        t.pay_date,
        t.pay_date payDate
        from purchase_payment t
        where 1 =1
        <if test="id !=null and id != ''">
            and t.id= #{id}
        </if>
        <if test="applyOrderId !=null and applyOrderId != ''">
            and t.apply_order_id= #{applyOrderId}
        </if>
        <if test="payableAmount !=null and payableAmount != ''">
            and t.payable_amount= #{payableAmount}
        </if>
        <if test="paidAmount !=null and paidAmount != ''">
            and t.paid_amount= #{paidAmount}
        </if>
        <if test="unpaidAmount !=null and unpaidAmount != ''">
            and t.unpaid_amount= #{unpaidAmount}
        </if>
        <if test="paymentAmount !=null and paymentAmount != ''">
            and t.payment_amount= #{paymentAmount}
        </if>
        <if test="paymentCompany !=null and paymentCompany != ''">
            and t.payment_company= #{paymentCompany}
        </if>
        <if test="payType !=null and payType != ''">
            and t.pay_type= #{payType}
        </if>
        <if test="paymentNo !=null and paymentNo != ''">
            and t.payment_no= #{paymentNo}
        </if>
        <if test="invoiceStatus !=null and invoiceStatus != ''">
            and t.invoice_status= #{invoiceStatus}
        </if>
        <if test="taxRate !=null and taxRate != ''">
            and t.tax_rate= #{taxRate}
        </if>
        <if test="plannedPayDate !=null and plannedPayDate != ''">
            and t.planned_pay_date= #{plannedPayDate}
        </if>
        <if test="payDate !=null and payDate != ''">
            and t.pay_date= #{payDate}
        </if>
        order by t.id desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
 
    <!-- 修改采购支付信息 add by system 2026-03-25 -->
    <update id="updatePurchasePaymentInfo" parameterType="Map">
        update purchase_payment t set
        <if test="applyOrderId !=null and applyOrderId != ''">
            t.apply_order_id= #{applyOrderId},
        </if>
        <if test="payableAmount !=null and payableAmount != ''">
            t.payable_amount= #{payableAmount},
        </if>
        <if test="paidAmount !=null and paidAmount != ''">
            t.paid_amount= #{paidAmount},
        </if>
        <if test="unpaidAmount !=null and unpaidAmount != ''">
            t.unpaid_amount= #{unpaidAmount},
        </if>
        <if test="paymentAmount !=null and paymentAmount != ''">
            t.payment_amount= #{paymentAmount},
        </if>
        <if test="paymentCompany !=null and paymentCompany != ''">
            t.payment_company= #{paymentCompany},
        </if>
        <if test="payType !=null and payType != ''">
            t.pay_type= #{payType},
        </if>
        <if test="paymentNo !=null and paymentNo != ''">
            t.payment_no= #{paymentNo},
        </if>
        <if test="invoiceStatus !=null and invoiceStatus != ''">
            t.invoice_status= #{invoiceStatus},
        </if>
        <if test="taxRate !=null and taxRate != ''">
            t.tax_rate= #{taxRate},
        </if>
        <if test="plannedPayDate !=null and plannedPayDate != ''">
            t.planned_pay_date= #{plannedPayDate},
        </if>
        <if test="payDate !=null and payDate != ''">
            t.pay_date= #{payDate}
        </if>
        where 1=1
        <if test="id !=null and id != ''">
            and t.id= #{id}
        </if>
        <if test="applyOrderId !=null and applyOrderId != ''">
            and t.apply_order_id= #{applyOrderId}
        </if>
    </update>
 
    <!-- 查询采购支付数量 add by system 2026-03-25 -->
    <select id="queryPurchasePaymentsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from purchase_payment t
        where 1 =1
        <if test="id !=null and id != ''">
            and t.id= #{id}
        </if>
        <if test="applyOrderId !=null and applyOrderId != ''">
            and t.apply_order_id= #{applyOrderId}
        </if>
        <if test="payableAmount !=null and payableAmount != ''">
            and t.payable_amount= #{payableAmount}
        </if>
        <if test="paidAmount !=null and paidAmount != ''">
            and t.paid_amount= #{paidAmount}
        </if>
        <if test="unpaidAmount !=null and unpaidAmount != ''">
            and t.unpaid_amount= #{unpaidAmount}
        </if>
        <if test="paymentAmount !=null and paymentAmount != ''">
            and t.payment_amount= #{paymentAmount}
        </if>
        <if test="paymentCompany !=null and paymentCompany != ''">
            and t.payment_company= #{paymentCompany}
        </if>
        <if test="payType !=null and payType != ''">
            and t.pay_type= #{payType}
        </if>
        <if test="paymentNo !=null and paymentNo != ''">
            and t.payment_no= #{paymentNo}
        </if>
        <if test="invoiceStatus !=null and invoiceStatus != ''">
            and t.invoice_status= #{invoiceStatus}
        </if>
        <if test="taxRate !=null and taxRate != ''">
            and t.tax_rate= #{taxRate}
        </if>
        <if test="plannedPayDate !=null and plannedPayDate != ''">
            and t.planned_pay_date= #{plannedPayDate}
        </if>
        <if test="payDate !=null and payDate != ''">
            and t.pay_date= #{payDate}
        </if>
    </select>
 
</mapper>