wujianwei
2025-09-02 dda4c08d41693d2495a13e7db230c3e9747540de
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?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.EstimatedReceivableMapper">
 
    <resultMap type="com.ruoyi.cwgl.domain.EstimatedReceivable" id="EstimatedReceivableResult">
        <result property="id"    column="id"    />
        <result property="feeSystemNo"    column="fee_system_no"    />
        <result property="dispatchNo"    column="dispatch_no"    />
        <result property="customerName"    column="customer_name"    />
        <result property="projectName"    column="project_name"    />
        <result property="orderDate"    column="order_date"    />
        <result property="feeName"    column="fee_name"    />
        <result property="estimatedAmount"    column="estimated_amount"    />
        <result property="currency"    column="currency"    />
        <result property="relatedBillName"    column="related_bill_name"    />
        <result property="relatedBillStatus"    column="related_bill_status"    />
        <result property="isConfirmed"    column="is_confirmed"    />
        <result property="confirmBy"    column="confirm_by"    />
        <result property="confirmTime"    column="confirm_time"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="deleted"    column="deleted"    />
        <result property="feeType"    column="fee_type"    />
    </resultMap>
 
    <sql id="selectEstimatedReceivableVo">
        select thisTab.id, thisTab.fee_system_no, thisTab.dispatch_no, thisTab.customer_name, thisTab.project_name, thisTab.order_date, thisTab.fee_name, thisTab.estimated_amount, thisTab.currency, thisTab.related_bill_name, thisTab.related_bill_status, thisTab.is_confirmed, thisTab.confirm_by, thisTab.confirm_time, thisTab.remark, thisTab.create_by, thisTab.update_by, thisTab.create_time, thisTab.update_time, thisTab.deleted , thisTab.fee_type from estimated_receivable AS thisTab
    </sql>
    <sql id="selectEstimatedReceivableVoCount">
        select count(0) from estimated_receivable as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="feeSystemNo != null  and feeSystemNo != ''"> and thisTab.fee_system_no = #{feeSystemNo}</if>
        <if test="dispatchNo != null  and dispatchNo != ''"> and thisTab.dispatch_no = #{dispatchNo}</if>
        <if test="customerName != null  and customerName != ''"> and  thisTab.customer_name like concat('%', #{customerName}, '%')</if>
        <if test="projectName != null  and projectName != ''"> and  thisTab.project_name like concat('%', #{projectName}, '%')</if>
        <if test="orderDate != null "> and thisTab.order_date = #{orderDate}</if>
        <if test="feeName != null  and feeName != ''"> and  thisTab.fee_name like concat('%', #{feeName}, '%')</if>
        <if test="estimatedAmount != null "> and thisTab.estimated_amount = #{estimatedAmount}</if>
        <if test="currency != null  and currency != ''"> and thisTab.currency = #{currency}</if>
        <if test="relatedBillName != null  and relatedBillName != ''"> and  thisTab.related_bill_name like concat('%', #{relatedBillName}, '%')</if>
        <if test="relatedBillStatus != null "> and thisTab.related_bill_status = #{relatedBillStatus}</if>
        <if test="isConfirmed != null "> and thisTab.is_confirmed = #{isConfirmed}</if>
        <if test="confirmBy != null  and confirmBy != ''"> and thisTab.confirm_by = #{confirmBy}</if>
        <if test="confirmTime != null "> and thisTab.confirm_time = #{confirmTime}</if>
        <if test="deleted != null "> and thisTab.deleted = #{deleted}</if>
        <if test="feeType != null "> and thisTab.fee_type = #{feeType}</if>
    </sql>
 
    <!--查询-->
    <select id="selectEstimatedReceivableById" parameterType="Integer" resultMap="EstimatedReceivableResult">
        <include refid="selectEstimatedReceivableVo"/>
        where id = #{id}
    </select>
 
    <select id="selectEstimatedReceivableCount" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivable" resultType="int">
        <include refid="selectEstimatedReceivableVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectEstimatedReceivableList" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivable" resultMap="EstimatedReceivableResult">
        <include refid="selectEstimatedReceivableVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertEstimatedReceivable" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivable"  useGeneratedKeys="true" keyProperty="id">
        insert into estimated_receivable
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="feeSystemNo != null and feeSystemNo != ''">fee_system_no,</if>
            <if test="dispatchNo != null and dispatchNo != ''">dispatch_no,</if>
            <if test="customerName != null and customerName != ''">customer_name,</if>
            <if test="projectName != null">project_name,</if>
            <if test="orderDate != null">order_date,</if>
            <if test="feeName != null and feeName != ''">fee_name,</if>
            <if test="estimatedAmount != null">estimated_amount,</if>
            <if test="currency != null">currency,</if>
            <if test="relatedBillName != null">related_bill_name,</if>
            <if test="relatedBillStatus != null">related_bill_status,</if>
            <if test="isConfirmed != null">is_confirmed,</if>
            <if test="confirmBy != null">confirm_by,</if>
            <if test="confirmTime != null">confirm_time,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="deleted != null">deleted,</if>
            <if test="feeType != null">fee_type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="feeSystemNo != null and feeSystemNo != ''">#{feeSystemNo},</if>
            <if test="dispatchNo != null and dispatchNo != ''">#{dispatchNo},</if>
            <if test="customerName != null and customerName != ''">#{customerName},</if>
            <if test="projectName != null">#{projectName},</if>
            <if test="orderDate != null">#{orderDate},</if>
            <if test="feeName != null and feeName != ''">#{feeName},</if>
            <if test="estimatedAmount != null">#{estimatedAmount},</if>
            <if test="currency != null">#{currency},</if>
            <if test="relatedBillName != null">#{relatedBillName},</if>
            <if test="relatedBillStatus != null">#{relatedBillStatus},</if>
            <if test="isConfirmed != null">#{isConfirmed},</if>
            <if test="confirmBy != null">#{confirmBy},</if>
            <if test="confirmTime != null">#{confirmTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="deleted != null">#{deleted},</if>
            <if test="feeType != null">#{feeType},</if>
         </trim>
    </insert>
 
    <insert id="insertEstimatedReceivableBatch" parameterType="java.util.List"  >
        insert into estimated_receivable
        <trim prefix="(" suffix=") values" suffixOverrides=",">
           fee_system_no,dispatch_no,customer_name,project_name,order_date,fee_name,estimated_amount,currency,related_bill_name,related_bill_status,is_confirmed,confirm_by,confirm_time,remark,create_by,update_by,create_time,update_time,deleted,fee_type,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.feeSystemNo},#{item.dispatchNo},#{item.customerName},#{item.projectName},#{item.orderDate},#{item.feeName},#{item.estimatedAmount},#{item.currency},#{item.relatedBillName},#{item.relatedBillStatus},#{item.isConfirmed},#{item.confirmBy},#{item.confirmTime},#{item.remark},#{item.createBy},#{item.updateBy},#{item.createTime},#{item.updateTime},#{item.deleted},#{item.feeType},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateEstimatedReceivable" parameterType="com.ruoyi.cwgl.domain.EstimatedReceivable">
        update estimated_receivable
        <trim prefix="SET" suffixOverrides=",">
            <if test="feeSystemNo != null and feeSystemNo != ''">fee_system_no = #{feeSystemNo},</if>
            <if test="dispatchNo != null and dispatchNo != ''">dispatch_no = #{dispatchNo},</if>
            <if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
            <if test="projectName != null">project_name = #{projectName},</if>
            <if test="orderDate != null">order_date = #{orderDate},</if>
            <if test="feeName != null and feeName != ''">fee_name = #{feeName},</if>
            <if test="estimatedAmount != null">estimated_amount = #{estimatedAmount},</if>
            <if test="currency != null">currency = #{currency},</if>
            <if test="relatedBillName != null">related_bill_name = #{relatedBillName},</if>
            <if test="relatedBillStatus != null">related_bill_status = #{relatedBillStatus},</if>
            <if test="isConfirmed != null">is_confirmed = #{isConfirmed},</if>
            <if test="confirmBy != null">confirm_by = #{confirmBy},</if>
            <if test="confirmTime != null">confirm_time = #{confirmTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
            <if test="feeType != null">fee_type = #{feeType},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateEstimatedReceivableBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update estimated_receivable
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.feeSystemNo != null and item.feeSystemNo != ''">fee_system_no = #{item.feeSystemNo},</if>
                <if test="item.dispatchNo != null and item.dispatchNo != ''">dispatch_no = #{item.dispatchNo},</if>
                <if test="item.customerName != null and item.customerName != ''">customer_name = #{item.customerName},</if>
                <if test="item.projectName != null">project_name = #{item.projectName},</if>
                <if test="item.orderDate != null">order_date = #{item.orderDate},</if>
                <if test="item.feeName != null and item.feeName != ''">fee_name = #{item.feeName},</if>
                <if test="item.estimatedAmount != null">estimated_amount = #{item.estimatedAmount},</if>
                <if test="item.currency != null">currency = #{item.currency},</if>
                <if test="item.relatedBillName != null">related_bill_name = #{item.relatedBillName},</if>
                <if test="item.relatedBillStatus != null">related_bill_status = #{item.relatedBillStatus},</if>
                <if test="item.isConfirmed != null">is_confirmed = #{item.isConfirmed},</if>
                <if test="item.confirmBy != null">confirm_by = #{item.confirmBy},</if>
                <if test="item.confirmTime != null">confirm_time = #{item.confirmTime},</if>
                <if test="item.remark != null">remark = #{item.remark},</if>
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.updateBy != null">update_by = #{item.updateBy},</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>
                <if test="item.feeType != null">fee_type = #{item.feeType},</if>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
    <update id="updateEstimatedReceivableBillStatus">
        UPDATE estimated_receivable
        SET related_bill_status = #{status}
        <if test="billName !=null and billName != ''">
            , related_bill_name = #{billName}
        </if>
 
        WHERE dispatch_no IN
        <foreach item="item" collection="list" open="(" separator="," close=")">
            #{item}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteEstimatedReceivableById" parameterType="Integer">
        delete from estimated_receivable where id = #{id}
    </delete>
    <delete id="deleteEstimatedReceivableByIds" parameterType="Integer">
        delete from estimated_receivable where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>