wujianwei
5 天以前 849648e82e5dec96f9f30fcc9c9bd799268b1f4c
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
183
184
<?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.cwgl.mapper.PayableInvoiceBusinessMapper">
 
    <resultMap type="com.ruoyi.cwgl.domain.PayableInvoiceBusiness" id="PayableInvoiceBusinessResult">
        <result property="id"    column="id"    />
        <result property="headId"    column="head_id"    />
        <result property="invoiceSerialNum"    column="invoice_serial_num"    />
        <result property="status"    column="status"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="orderSn"    column="order_sn"    />
        <result property="invoiceType"    column="invoice_type"    />
        <result property="invoiceTax"    column="invoice_tax"    />
        <result property="invoiceNum"    column="invoice_num"    />
        <result property="invoiceTime"    column="invoice_time"    />
        <result property="invoicingUrl"    column="invoicing_url"    />
        <result property="invoicingAmount"    column="invoicing_amount"    />
        <result property="remark"    column="remark"    />
        <result property="invoicingUrlOfd"    column="invoicing_url_ofd"    />
        <result property="salerName"    column="saler_name"    />
        <result property="invoiceCompanyName"    column="invoice_company_name"    />
    </resultMap>
 
    <sql id="selectPayableInvoiceBusinessVo">
        select thisTab.id, thisTab.head_id, thisTab.invoice_serial_num, thisTab.status, thisTab.create_time, thisTab.update_time, thisTab.order_sn, thisTab.invoice_type, thisTab.invoice_tax, thisTab.invoice_num, thisTab.invoice_time, thisTab.invoicing_url, thisTab.invoicing_amount, thisTab.remark, thisTab.invoicing_url_ofd, thisTab.saler_name, thisTab.invoice_company_name from payable_invoice_business AS thisTab
    </sql>
    <sql id="selectPayableInvoiceBusinessVoCount">
        select count(0) from payable_invoice_business as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="headId != null "> and thisTab.head_id = #{headId}</if>
        <if test="invoiceSerialNum != null  and invoiceSerialNum != ''"> and thisTab.invoice_serial_num = #{invoiceSerialNum}</if>
        <if test="status != null "> and thisTab.status = #{status}</if>
        <if test="orderSn != null  and orderSn != ''"> and thisTab.order_sn = #{orderSn}</if>
        <if test="invoiceType != null  and invoiceType != ''"> and thisTab.invoice_type = #{invoiceType}</if>
        <if test="invoiceTax != null  and invoiceTax != ''"> and thisTab.invoice_tax = #{invoiceTax}</if>
        <if test="invoiceNum != null  and invoiceNum != ''"> and thisTab.invoice_num = #{invoiceNum}</if>
        <if test="invoiceTime != null "> and thisTab.invoice_time = #{invoiceTime}</if>
        <if test="invoicingUrl != null  and invoicingUrl != ''"> and thisTab.invoicing_url = #{invoicingUrl}</if>
        <if test="invoicingAmount != null "> and thisTab.invoicing_amount = #{invoicingAmount}</if>
        <if test="invoicingUrlOfd != null  and invoicingUrlOfd != ''"> and thisTab.invoicing_url_ofd = #{invoicingUrlOfd}</if>
        <if test="salerName != null  and salerName != ''"> and  thisTab.saler_name like concat('%', #{salerName}, '%')</if>
        <if test="invoiceCompanyName != null  and invoiceCompanyName != ''"> and  thisTab.invoice_company_name like concat('%', #{invoiceCompanyName}, '%')</if>
    </sql>
 
    <!--查询-->
    <select id="selectPayableInvoiceBusinessById" parameterType="Integer" resultMap="PayableInvoiceBusinessResult">
        <include refid="selectPayableInvoiceBusinessVo"/>
        where id = #{id}
    </select>
 
    <select id="selectPayableInvoiceBusinessCount" parameterType="com.ruoyi.cwgl.domain.PayableInvoiceBusiness" resultType="int">
        <include refid="selectPayableInvoiceBusinessVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectPayableInvoiceBusinessList" parameterType="com.ruoyi.cwgl.domain.PayableInvoiceBusiness" resultMap="PayableInvoiceBusinessResult">
        <include refid="selectPayableInvoiceBusinessVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertPayableInvoiceBusiness" parameterType="com.ruoyi.cwgl.domain.PayableInvoiceBusiness"  useGeneratedKeys="true" keyProperty="id">
        insert into payable_invoice_business
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="headId != null">head_id,</if>
            <if test="invoiceSerialNum != null">invoice_serial_num,</if>
            <if test="status != null">status,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="orderSn != null">order_sn,</if>
            <if test="invoiceType != null">invoice_type,</if>
            <if test="invoiceTax != null">invoice_tax,</if>
            <if test="invoiceNum != null">invoice_num,</if>
            <if test="invoiceTime != null">invoice_time,</if>
            <if test="invoicingUrl != null">invoicing_url,</if>
            <if test="invoicingAmount != null">invoicing_amount,</if>
            <if test="remark != null">remark,</if>
            <if test="invoicingUrlOfd != null">invoicing_url_ofd,</if>
            <if test="salerName != null">saler_name,</if>
            <if test="invoiceCompanyName != null">invoice_company_name,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="headId != null">#{headId},</if>
            <if test="invoiceSerialNum != null">#{invoiceSerialNum},</if>
            <if test="status != null">#{status},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="orderSn != null">#{orderSn},</if>
            <if test="invoiceType != null">#{invoiceType},</if>
            <if test="invoiceTax != null">#{invoiceTax},</if>
            <if test="invoiceNum != null">#{invoiceNum},</if>
            <if test="invoiceTime != null">#{invoiceTime},</if>
            <if test="invoicingUrl != null">#{invoicingUrl},</if>
            <if test="invoicingAmount != null">#{invoicingAmount},</if>
            <if test="remark != null">#{remark},</if>
            <if test="invoicingUrlOfd != null">#{invoicingUrlOfd},</if>
            <if test="salerName != null">#{salerName},</if>
            <if test="invoiceCompanyName != null">#{invoiceCompanyName},</if>
         </trim>
    </insert>
 
    <insert id="insertPayableInvoiceBusinessBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into payable_invoice_business
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,head_id,invoice_serial_num,status,create_time,update_time,order_sn,invoice_type,invoice_tax,invoice_num,invoice_time,invoicing_url,invoicing_amount,remark,invoicing_url_ofd,saler_name,invoice_company_name,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.headId},#{item.invoiceSerialNum},#{item.status},#{item.createTime},#{item.updateTime},#{item.orderSn},#{item.invoiceType},#{item.invoiceTax},#{item.invoiceNum},#{item.invoiceTime},#{item.invoicingUrl},#{item.invoicingAmount},#{item.remark},#{item.invoicingUrlOfd},#{item.salerName},#{item.invoiceCompanyName},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updatePayableInvoiceBusiness" parameterType="com.ruoyi.cwgl.domain.PayableInvoiceBusiness">
        update payable_invoice_business
        <trim prefix="SET" suffixOverrides=",">
            <if test="headId != null">head_id = #{headId},</if>
            <if test="invoiceSerialNum != null">invoice_serial_num = #{invoiceSerialNum},</if>
            <if test="status != null">status = #{status},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="orderSn != null">order_sn = #{orderSn},</if>
            <if test="invoiceType != null">invoice_type = #{invoiceType},</if>
            <if test="invoiceTax != null">invoice_tax = #{invoiceTax},</if>
            <if test="invoiceNum != null">invoice_num = #{invoiceNum},</if>
            <if test="invoiceTime != null">invoice_time = #{invoiceTime},</if>
            <if test="invoicingUrl != null">invoicing_url = #{invoicingUrl},</if>
            <if test="invoicingAmount != null">invoicing_amount = #{invoicingAmount},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="invoicingUrlOfd != null">invoicing_url_ofd = #{invoicingUrlOfd},</if>
            <if test="salerName != null">saler_name = #{salerName},</if>
            <if test="invoiceCompanyName != null">invoice_company_name = #{invoiceCompanyName},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updatePayableInvoiceBusinessBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update payable_invoice_business
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.headId != null">head_id = #{item.headId},</if>
                <if test="item.invoiceSerialNum != null">invoice_serial_num = #{item.invoiceSerialNum},</if>
                <if test="item.status != null">status = #{item.status},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
                <if test="item.orderSn != null">order_sn = #{item.orderSn},</if>
                <if test="item.invoiceType != null">invoice_type = #{item.invoiceType},</if>
                <if test="item.invoiceTax != null">invoice_tax = #{item.invoiceTax},</if>
                <if test="item.invoiceNum != null">invoice_num = #{item.invoiceNum},</if>
                <if test="item.invoiceTime != null">invoice_time = #{item.invoiceTime},</if>
                <if test="item.invoicingUrl != null">invoicing_url = #{item.invoicingUrl},</if>
                <if test="item.invoicingAmount != null">invoicing_amount = #{item.invoicingAmount},</if>
                <if test="item.remark != null">remark = #{item.remark},</if>
                <if test="item.invoicingUrlOfd != null">invoicing_url_ofd = #{item.invoicingUrlOfd},</if>
                <if test="item.salerName != null">saler_name = #{item.salerName},</if>
                <if test="item.invoiceCompanyName != null">invoice_company_name = #{item.invoiceCompanyName},</if>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deletePayableInvoiceBusinessById" parameterType="Integer">
        delete from payable_invoice_business where id = #{id}
    </delete>
    <delete id="deletePayableInvoiceBusinessByIds" parameterType="Integer">
        delete from payable_invoice_business where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>