wlzboy
2026-04-01 c459808efab29dc1b8439fbb90556bdb16f4c88b
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
<?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.system.mapper.LegacyInvoiceMapper">
    
    <insert id="insertLegacyInvoice" parameterType="Map" useGeneratedKeys="true" keyProperty="InvoiceID">
        INSERT INTO InvoiceData (
            ServiceOrderIDPK, InvoiceType, InvoiceName, InvoiceMakeout, 
            InvoiceCompanyPhone, InvoiceCompanyID, InvoiceCompanyAdd, 
            InvoiceCompanyBank, InvoiceCompanyBankNo, InvoiceZipCode, 
            Invoice_strAdd, Invoice_strName, Invoice_strPhone, Invoice_strEmail, 
            ApplicationTime, AuditStatus, InvoiceMoney, ApplyOAID
        ) VALUES (
            #{ServiceOrderIDPK}, #{InvoiceType}, #{InvoiceName}, #{InvoiceMakeout}, 
            #{InvoiceCompanyPhone}, #{InvoiceCompanyID}, #{InvoiceCompanyAdd}, 
            #{InvoiceCompanyBank}, #{InvoiceCompanyBankNo}, #{InvoiceZipCode}, 
            #{Invoice_strAdd}, #{Invoice_strName}, #{Invoice_strPhone}, #{Invoice_strEmail}, 
            GETDATE(), 0, #{InvoiceMoney}, #{ApplyOAID}
        )
    </insert>
 
    <select id="selectUpdatedInvoices" parameterType="String" resultType="Map">
        SELECT 
            InvoiceID, ServiceOrderIDPK, AuditStatus, AuditTime, AuditMakeout,
            InvoiceNo, InvoiceURL, InvoiceOddNo, EleCloud_PDF, EleCloud_Time
        FROM InvoiceData
        WHERE AuditTime &gt; #{lastSyncTime} OR EleCloud_Time &gt; #{lastSyncTime}
    </select>
 
    <select id="selectLegacyInvoiceByServiceOrderId" parameterType="Long" resultType="Map">
        SELECT * FROM InvoiceData WHERE ServiceOrderIDPK = #{serviceOrderId}
    </select>
 
    <!-- 编辑时更新旧系统发票记录 -->
    <update id="updateLegacyInvoice" parameterType="Map">
        UPDATE InvoiceData SET
            ServiceOrderIDPK   = #{ServiceOrderIDPK},
            InvoiceType        = #{InvoiceType},
            InvoiceName        = #{InvoiceName},
            InvoiceMakeout     = #{InvoiceMakeout},
            InvoiceCompanyPhone= #{InvoiceCompanyPhone},
            InvoiceCompanyAdd  = #{InvoiceCompanyAdd},
            InvoiceCompanyBank = #{InvoiceCompanyBank},
            InvoiceCompanyBankNo = #{InvoiceCompanyBankNo},
            InvoiceZipCode     = #{InvoiceZipCode},
            Invoice_strAdd     = #{Invoice_strAdd},
            Invoice_strName    = #{Invoice_strName},
            Invoice_strPhone   = #{Invoice_strPhone},
            Invoice_strEmail   = #{Invoice_strEmail},
            InvoiceMoney       = #{InvoiceMoney},
            AuditStatus        = 0
        WHERE InvoiceID = #{InvoiceID}
    </update>
</mapper>