wujianwei
2025-08-14 443631aaeb3d4ccaaf1e3379c6850f6ad3df9241
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
<?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.EstimatedReceivableBillMapper">
 
    <resultMap type="com.ruoyi.cwgl.domain.EstimatedReceivableBill" id="EstimatedReceivableBillResult">
        <result property="id"    column="id"    />
        <result property="billSystemNo"    column="bill_system_no"    />
        <result property="billName"    column="bill_name"    />
        <result property="customerName"    column="customer_name"    />
        <result property="dispatchCount"    column="dispatch_count"    />
        <result property="totalAmount"    column="total_amount"    />
        <result property="settledAmount"    column="settled_amount"    />
        <result property="invoiceStatus"    column="invoice_status"    />
        <result property="attachment"    column="attachment"    />
        <result property="status"    column="status"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="confirmTime"    column="confirm_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="deleted"    column="deleted"    />
    </resultMap>
 
    <sql id="selectEstimatedReceivableBillVo">
        select thisTab.id, thisTab.bill_system_no, thisTab.bill_name, thisTab.customer_name, thisTab.dispatch_count, thisTab.total_amount, thisTab.settled_amount, thisTab.invoice_status, thisTab.attachment, thisTab.status, thisTab.remark, thisTab.create_by, thisTab.confirm_time, thisTab.create_time, thisTab.update_time, thisTab.deleted from estimated_receivable_bill AS thisTab
    </sql>
    <sql id="selectEstimatedReceivableBillVoCount">
        select count(0) from estimated_receivable_bill as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="billSystemNo != null  and billSystemNo != ''"> and thisTab.bill_system_no = #{billSystemNo}</if>
        <if test="billName != null  and billName != ''"> and  thisTab.bill_name like concat('%', #{billName}, '%')</if>
        <if test="customerName != null  and customerName != ''"> and  thisTab.customer_name like concat('%', #{customerName}, '%')</if>
        <if test="dispatchCount != null "> and thisTab.dispatch_count = #{dispatchCount}</if>
        <if test="totalAmount != null "> and thisTab.total_amount = #{totalAmount}</if>
        <if test="settledAmount != null "> and thisTab.settled_amount = #{settledAmount}</if>
        <if test="invoiceStatus != null "> and thisTab.invoice_status = #{invoiceStatus}</if>
        <if test="attachment != null  and attachment != ''"> and thisTab.attachment = #{attachment}</if>
        <if test="status != null "> and thisTab.status = #{status}</if>
        <if test="confirmTime != null "> and thisTab.confirm_time = #{confirmTime}</if>
        <if test="deleted != null "> and thisTab.deleted = #{deleted}</if>
    </sql>
 
    <!--查询-->
    <select id="selectEstimatedReceivableBillById" parameterType="Integer" resultMap="EstimatedReceivableBillResult">
        <include refid="selectEstimatedReceivableBillVo"/>
        where id = #{id}
    </select>
 
    <select id="selectEstimatedReceivableBillCount" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivableBill" resultType="int">
        <include refid="selectEstimatedReceivableBillVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectEstimatedReceivableBillList" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivableBill" resultMap="EstimatedReceivableBillResult">
        <include refid="selectEstimatedReceivableBillVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertEstimatedReceivableBill" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivableBill"  useGeneratedKeys="true" keyProperty="id">
        insert into estimated_receivable_bill
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="billSystemNo != null and billSystemNo != ''">bill_system_no,</if>
            <if test="billName != null and billName != ''">bill_name,</if>
            <if test="customerName != null and customerName != ''">customer_name,</if>
            <if test="dispatchCount != null">dispatch_count,</if>
            <if test="totalAmount != null">total_amount,</if>
            <if test="settledAmount != null">settled_amount,</if>
            <if test="invoiceStatus != null">invoice_status,</if>
            <if test="attachment != null">attachment,</if>
            <if test="status != null">status,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">create_by,</if>
            <if test="confirmTime != null">confirm_time,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="deleted != null">deleted,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="billSystemNo != null and billSystemNo != ''">#{billSystemNo},</if>
            <if test="billName != null and billName != ''">#{billName},</if>
            <if test="customerName != null and customerName != ''">#{customerName},</if>
            <if test="dispatchCount != null">#{dispatchCount},</if>
            <if test="totalAmount != null">#{totalAmount},</if>
            <if test="settledAmount != null">#{settledAmount},</if>
            <if test="invoiceStatus != null">#{invoiceStatus},</if>
            <if test="attachment != null">#{attachment},</if>
            <if test="status != null">#{status},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="confirmTime != null">#{confirmTime},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="deleted != null">#{deleted},</if>
         </trim>
    </insert>
 
    <insert id="insertEstimatedReceivableBillBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into estimated_receivable_bill
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,bill_system_no,bill_name,customer_name,dispatch_count,total_amount,settled_amount,invoice_status,attachment,status,remark,create_by,confirm_time,create_time,update_time,deleted,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.billSystemNo},#{item.billName},#{item.customerName},#{item.dispatchCount},#{item.totalAmount},#{item.settledAmount},#{item.invoiceStatus},#{item.attachment},#{item.status},#{item.remark},#{item.createBy},#{item.confirmTime},#{item.createTime},#{item.updateTime},#{item.deleted},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateEstimatedReceivableBill" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivableBill">
        update estimated_receivable_bill
        <trim prefix="SET" suffixOverrides=",">
            <if test="billSystemNo != null and billSystemNo != ''">bill_system_no = #{billSystemNo},</if>
            <if test="billName != null and billName != ''">bill_name = #{billName},</if>
            <if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
            <if test="dispatchCount != null">dispatch_count = #{dispatchCount},</if>
            <if test="totalAmount != null">total_amount = #{totalAmount},</if>
            <if test="settledAmount != null">settled_amount = #{settledAmount},</if>
            <if test="invoiceStatus != null">invoice_status = #{invoiceStatus},</if>
            <if test="attachment != null">attachment = #{attachment},</if>
            <if test="status != null">status = #{status},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="confirmTime != null">confirm_time = #{confirmTime},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateEstimatedReceivableBillBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update estimated_receivable_bill
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.billSystemNo != null and item.billSystemNo != ''">bill_system_no = #{item.billSystemNo},</if>
                <if test="item.billName != null and item.billName != ''">bill_name = #{item.billName},</if>
                <if test="item.customerName != null and item.customerName != ''">customer_name = #{item.customerName},</if>
                <if test="item.dispatchCount != null">dispatch_count = #{item.dispatchCount},</if>
                <if test="item.totalAmount != null">total_amount = #{item.totalAmount},</if>
                <if test="item.settledAmount != null">settled_amount = #{item.settledAmount},</if>
                <if test="item.invoiceStatus != null">invoice_status = #{item.invoiceStatus},</if>
                <if test="item.attachment != null">attachment = #{item.attachment},</if>
                <if test="item.status != null">status = #{item.status},</if>
                <if test="item.remark != null">remark = #{item.remark},</if>
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.confirmTime != null">confirm_time = #{item.confirmTime},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
                <if test="item.deleted != null">deleted = #{item.deleted},</if>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteEstimatedReceivableBillById" parameterType="Integer">
        delete from estimated_receivable_bill where id = #{id}
    </delete>
    <delete id="deleteEstimatedReceivableBillByIds" parameterType="Integer">
        delete from estimated_receivable_bill where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>