chenrui
3 天以前 8dce4b82eeece943b56182eeebc1c9332625924c
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
<?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.ruoyi.purchase.mapper.PaymentRegistrationMapper">
 
    <resultMap type="PaymentRegistration" id="PaymentRegistrationResult">
        <result property="id" column="id"/>
        <result property="saleLedgerId" column="sale_ledger_id"/>
        <result property="purchaseLedgerId" column="purchase_ledger_id"/>
        <result property="supplierId" column="supplier_id"/>
        <result property="ticketRegistrationId" column="ticket_registration_id"/>
        <result property="currentPaymentAmount" column="current_payment_amount"/>
        <result property="paymentMethod" column="payment_method"/>
        <result property="registrantId" column="registrant_id"/>
        <result property="paymentDate" column="payment_date"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="tenantId" column="tenant_id"/>
        <result property="registrationtDate" column="registrationt_date"/>
    </resultMap>
 
    <resultMap type="com.ruoyi.purchase.dto.PaymentRegistrationDto" id="PaymentRegistrationDtoResult">
        <result property="id" column="id"/>
        <result property="saleLedgerId" column="sale_ledger_id"/>
        <result property="purchaseLedgerId" column="purchase_ledger_id"/>
        <result property="supplierId" column="supplier_id"/>
        <result property="ticketRegistrationId" column="ticket_registration_id"/>
        <result property="currentPaymentAmount" column="current_payment_amount"/>
        <result property="paymentMethod" column="payment_method"/>
        <result property="registrantId" column="registrant_id"/>
        <result property="paymentDate" column="payment_date"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="salesContractNo" column="sales_contract_no"/>
        <result property="purchaseContractNumber" column="purchase_contract_number"/>
        <result property="supplierName" column="supplier_name"/>
        <result property="invoiceNumber" column="invoice_number"/>
        <result property="taxRate" column="tax_rate"/>
        <result property="invoiceAmount" column="invoice_amount"/>
        <result property="tenantId" column="tenant_id"/>
        <result property="registrationtDate" column="registrationt_date"/>
    </resultMap>
 
    <sql id="selectPaymentRegistrationVo">
        select pr.id,
               pr.sale_ledger_id,
               pr.purchase_ledger_id,
               pr.supplier_id,
               pr.ticket_registration_id,
               pr.current_payment_amount,
               pr.payment_method,
               pr.registrant_id,
               pr.payment_date,
               pr.create_time,
               pr.update_time,
               pr.tenant_id,
               sl.sales_contract_no as sales_contract_no,
               pl.purchase_contract_number as purchase_contract_number,
               sm.supplier_name as supplier_name,
               ip.invoice_number as invoice_number,
               ip.invoice_amount as invoice_amount,
               pr.tax_rate,
               pr.registrationt_date,
               su.nick_name as registrant
        from payment_registration pr
                 left join sales_ledger sl on pr.sale_ledger_id = sl.id
                 left join purchase_ledger pl on pr.purchase_ledger_id = pl.id
                 left join supplier_manage sm on pr.supplier_id = sm.id
                 left join ticket_registration ip on pr.ticket_registration_id = ip.id
                 left join sys_user su on pr.registrant_id = su.user_id
    </sql>
 
    <select id="selectPaymentRegistrationList" parameterType="com.ruoyi.purchase.dto.PaymentRegistrationDto"
            resultMap="PaymentRegistrationDtoResult">
        <include refid="selectPaymentRegistrationVo"/>
        <where>
            <if test="supplierNameOrContractNo != null  and supplierNameOrContractNo != ''">
                and sm.supplier_name LIKE CONCAT('%', #{supplierNameOrContractNo}, '%') or sl.sales_contract_no LIKE
                CONCAT('%', #{supplierNameOrContractNo}, '%')
                or pl.purchase_contract_number LIKE CONCAT('%', #{supplierNameOrContractNo}, '%')
            </if>
        </where>
    </select>
 
    <select id="selectPaymentRegistrationById" parameterType="Long" resultMap="PaymentRegistrationDtoResult">
        <include refid="selectPaymentRegistrationVo"/>
        where pr.id = #{id}
    </select>
 
    <select id="paymentHistoryList" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
        SELECT
            T1.payment_date,
            T2.supplier_name,
            T1.current_payment_amount,
            T1.payment_method,
            T3.nick_name AS registrant,
            T1.registrationt_date
        FROM
            payment_registration T1
                LEFT JOIN
            supplier_manage T2 ON T1.supplier_id = T2.id
                LEFT JOIN
            sys_user T3 ON T3.user_id = T1.registrant_id
        <where>
            <if test="params.searchText != null and params.searchText != '' ">
                AND T2.supplier_name LIKE CONCAT('%',#{params.searchText},'%')
            </if>
        </where>
        ORDER BY T1.payment_date,T1.create_time DESC
    </select>
 
</mapper>