wujianwei
2026-01-13 95d3a42006beb2b9e0856f0899003e075d1988f8
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?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.ReceivableFeeManagementMapper">
 
    <resultMap type="com.ruoyi.cwgl.domain.ReceivableFeeManagement" id="ReceivableFeeManagementResult">
        <result property="id"    column="id"    />
        <result property="systemNo"    column="system_no"    />
        <result property="relatedBillNo"    column="related_bill_no"    />
        <result property="sourceSystem"    column="source_system"    />
        <result property="businessSector"    column="business_sector"    />
        <result property="documentType"    column="document_type"    />
        <result property="documentNo"    column="document_no"    />
        <result property="isInternalSettlement"    column="is_internal_settlement"    />
        <result property="internalSettlementUnit"    column="internal_settlement_unit"    />
        <result property="customerName"    column="customer_name"    />
        <result property="projectName"    column="project_name"    />
        <result property="businessTime"    column="business_time"    />
        <result property="receivableConfirmTime"    column="receivable_confirm_time"    />
        <result property="receivableAmount"    column="receivable_amount"    />
        <result property="receivableAmountStr"    column="receivable_amount_str"    />
        <result property="status"    column="status"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="deleted"    column="deleted"    />
        <result property="customerId"    column="customer_id"    />
    </resultMap>
 
    <sql id="selectReceivableFeeManagementVo">
        select thisTab.id, thisTab.system_no, thisTab.related_bill_no, thisTab.source_system, thisTab.business_sector, thisTab.document_type, thisTab.document_no, thisTab.is_internal_settlement, thisTab.internal_settlement_unit, thisTab.customer_name, thisTab.project_name, thisTab.business_time, thisTab.receivable_confirm_time, thisTab.receivable_amount, thisTab.receivable_amount_str, thisTab.status, thisTab.remark, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.deleted, thisTab.customer_id from receivable_fee_management AS thisTab
    </sql>
    <sql id="selectReceivableFeeManagementVoCount">
        select count(0) from receivable_fee_management as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="systemNo != null  and systemNo != ''"> and thisTab.system_no = #{systemNo}</if>
        <if test="relatedBillNo != null  and relatedBillNo != ''"> and thisTab.related_bill_no = #{relatedBillNo}</if>
        <if test="sourceSystem != null  and sourceSystem != ''"> and thisTab.source_system = #{sourceSystem}</if>
        <if test="businessSector != null  and businessSector != ''"> and thisTab.business_sector = #{businessSector}</if>
        <if test="documentType != null  and documentType != ''"> and thisTab.document_type = #{documentType}</if>
        <if test="documentNo != null  and documentNo != ''"> and thisTab.document_no = #{documentNo}</if>
        <if test="isInternalSettlement != null  and isInternalSettlement != ''"> and thisTab.is_internal_settlement = #{isInternalSettlement}</if>
        <if test="internalSettlementUnit != null  and internalSettlementUnit != ''"> and thisTab.internal_settlement_unit = #{internalSettlementUnit}</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="businessTime != null "> and thisTab.business_time = #{businessTime}</if>
        <if test="receivableConfirmTime != null "> and thisTab.receivable_confirm_time = #{receivableConfirmTime}</if>
        <if test="receivableAmount != null "> and thisTab.receivable_amount = #{receivableAmount}</if>
        <if test="status != null  and status != ''"> and thisTab.status = #{status}</if>
        <if test="deleted != null "> and thisTab.deleted = #{deleted}</if>
        <if test="customerId != null "> and thisTab.customer_id = #{customerId}</if>
    </sql>
 
    <!--查询-->
    <select id="selectReceivableFeeManagementById" parameterType="Integer" resultMap="ReceivableFeeManagementResult">
        <include refid="selectReceivableFeeManagementVo"/>
        where id = #{id}
    </select>
 
    <select id="selectReceivableFeeManagementCount" parameterType="com.ruoyi.cwgl.domain.ReceivableFeeManagement" resultType="int">
        <include refid="selectReceivableFeeManagementVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectReceivableFeeManagementList" parameterType="com.ruoyi.cwgl.domain.ReceivableFeeManagement" resultMap="ReceivableFeeManagementResult">
        <include refid="selectReceivableFeeManagementVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertReceivableFeeManagement" parameterType="com.ruoyi.cwgl.domain.ReceivableFeeManagement"  useGeneratedKeys="true" keyProperty="id">
        insert into receivable_fee_management
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="systemNo != null and systemNo != ''">system_no,</if>
            <if test="relatedBillNo != null and relatedBillNo != ''">related_bill_no,</if>
            <if test="sourceSystem != null and sourceSystem != ''">source_system,</if>
            <if test="businessSector != null and businessSector != ''">business_sector,</if>
            <if test="documentType != null and documentType != ''">document_type,</if>
            <if test="documentNo != null and documentNo != ''">document_no,</if>
            <if test="isInternalSettlement != null and isInternalSettlement != ''">is_internal_settlement,</if>
            <if test="internalSettlementUnit != null">internal_settlement_unit,</if>
            <if test="customerName != null and customerName != ''">customer_name,</if>
            <if test="projectName != null">project_name,</if>
            <if test="businessTime != null">business_time,</if>
            <if test="receivableConfirmTime != null">receivable_confirm_time,</if>
            <if test="receivableAmount != null">receivable_amount,</if>
            <if test="receivableAmountStr != null and receivableAmountStr != ''">receivable_amount_str,</if>
            <if test="status != null">status,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="deleted != null">deleted,</if>
            <if test="customerId != null">customer_id,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="systemNo != null and systemNo != ''">#{systemNo},</if>
            <if test="relatedBillNo != null and relatedBillNo != ''">#{relatedBillNo},</if>
            <if test="sourceSystem != null and sourceSystem != ''">#{sourceSystem},</if>
            <if test="businessSector != null and businessSector != ''">#{businessSector},</if>
            <if test="documentType != null and documentType != ''">#{documentType},</if>
            <if test="documentNo != null and documentNo != ''">#{documentNo},</if>
            <if test="isInternalSettlement != null and isInternalSettlement != ''">#{isInternalSettlement},</if>
            <if test="internalSettlementUnit != null">#{internalSettlementUnit},</if>
            <if test="customerName != null and customerName != ''">#{customerName},</if>
            <if test="projectName != null">#{projectName},</if>
            <if test="businessTime != null">#{businessTime},</if>
            <if test="receivableConfirmTime != null">#{receivableConfirmTime},</if>
            <if test="receivableAmount != null">#{receivableAmount},</if>
            <if test="receivableAmountStr != null and receivableAmountStr != ''">#{receivableAmountStr},</if>
            <if test="status != null">#{status},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="deleted != null">#{deleted},</if>
            <if test="customerId != null">#{customerId},</if>
        </trim>
    </insert>
 
    <insert id="insertReceivableFeeManagementBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into receivable_fee_management
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,system_no,related_bill_no,source_system,business_sector,document_type,document_no,is_internal_settlement,internal_settlement_unit,customer_name,project_name,business_time,receivable_confirm_time,receivable_amount,receivable_amount_str,status,remark,create_by,create_time,update_by,update_time,deleted,customer_id,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.systemNo},#{item.relatedBillNo},#{item.sourceSystem},#{item.businessSector},#{item.documentType},#{item.documentNo},#{item.isInternalSettlement},#{item.internalSettlementUnit},#{item.customerName},#{item.projectName},#{item.businessTime},#{item.receivableConfirmTime},#{item.receivableAmount},#{item.receivableAmountStr},#{item.status},#{item.remark},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.deleted},#{item.customerId},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateReceivableFeeManagement" parameterType="com.ruoyi.cwgl.domain.ReceivableFeeManagement">
        update receivable_fee_management
        <trim prefix="SET" suffixOverrides=",">
            <if test="systemNo != null and systemNo != ''">system_no = #{systemNo},</if>
            <if test="relatedBillNo != null and relatedBillNo != ''">related_bill_no = #{relatedBillNo},</if>
            <if test="sourceSystem != null and sourceSystem != ''">source_system = #{sourceSystem},</if>
            <if test="businessSector != null and businessSector != ''">business_sector = #{businessSector},</if>
            <if test="documentType != null and documentType != ''">document_type = #{documentType},</if>
            <if test="documentNo != null and documentNo != ''">document_no = #{documentNo},</if>
            <if test="isInternalSettlement != null and isInternalSettlement != ''">is_internal_settlement = #{isInternalSettlement},</if>
            <if test="internalSettlementUnit != null">internal_settlement_unit = #{internalSettlementUnit},</if>
            <if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
            <if test="projectName != null">project_name = #{projectName},</if>
            <if test="businessTime != null">business_time = #{businessTime},</if>
            <if test="receivableConfirmTime != null">receivable_confirm_time = #{receivableConfirmTime},</if>
            <if test="receivableAmount != null">receivable_amount = #{receivableAmount},</if>
            <if test="receivableAmountStr != null and receivableAmountStr != ''">receivable_amount_str = #{receivableAmountStr},</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="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
            <if test="customerId != null">customer_id = #{customerId},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateReceivableFeeManagementBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update receivable_fee_management
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.systemNo != null and item.systemNo != ''">system_no = #{item.systemNo},</if>
                <if test="item.relatedBillNo != null and item.relatedBillNo != ''">related_bill_no = #{item.relatedBillNo},</if>
                <if test="item.sourceSystem != null and item.sourceSystem != ''">source_system = #{item.sourceSystem},</if>
                <if test="item.businessSector != null and item.businessSector != ''">business_sector = #{item.businessSector},</if>
                <if test="item.documentType != null and item.documentType != ''">document_type = #{item.documentType},</if>
                <if test="item.documentNo != null and item.documentNo != ''">document_no = #{item.documentNo},</if>
                <if test="item.isInternalSettlement != null and item.isInternalSettlement != ''">is_internal_settlement = #{item.isInternalSettlement},</if>
                <if test="item.internalSettlementUnit != null">internal_settlement_unit = #{item.internalSettlementUnit},</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.businessTime != null">business_time = #{item.businessTime},</if>
                <if test="item.receivableConfirmTime != null">receivable_confirm_time = #{item.receivableConfirmTime},</if>
                <if test="item.receivableAmount != null">receivable_amount = #{item.receivableAmount},</if>
                <if test="item.receivableAmountStr != null and item.receivableAmountStr != ''">receivable_amount_str = #{item.receivableAmountStr},</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.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
                <if test="item.deleted != null">deleted = #{item.deleted},</if>
                <if test="item.customerId != null">customer_id = #{item.customerId},</if>
            </trim>
            where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteReceivableFeeManagementById" parameterType="Integer">
        delete from receivable_fee_management where id = #{id}
    </delete>
    <delete id="deleteReceivableFeeManagementByIds" parameterType="Integer">
        delete from receivable_fee_management where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <!--根据ID数组查询-->
    <select id="selectReceivableFeeManagementByIds" parameterType="Integer" resultMap="ReceivableFeeManagementResult">
        <include refid="selectReceivableFeeManagementVo"/>
        where thisTab.id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
    
    <!-- 根据关联账单编号批量更新应收费用管理记录 -->
    <update id="updateReceivableFeeManagementByRelatedBillNo" parameterType="String">
        update receivable_fee_management
        set related_bill_no = null,
            status = '0',
            update_time = now()
        where related_bill_no = #{relatedBillNo}
    </update>
</mapper>