廖井涛
2025-09-09 3f294a08674f431ced84407df1a3b30eecaeac1e
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
<?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.example.erp.mapper.mm.FinishedGlassShelfMapper">
 
    <resultMap id="selectFinishedGlassShelfEmitDetails" type="com.example.erp.entity.mm.FinishedGlassShelfEmitDetails">
        <id column="id" property="id"/>
        <result column="emit_id" property="emitId"/>
        <result column="emit_number" property="emitNumber"/>
        <result column="information_id" property="informationId"/>
        <result column="glass_shelf_number" property="glassShelfNumber"/>
        <result column="glass_shelf_name" property="glassShelfName"/>
        <result column="withdraw_quantity" property="withdrawQuantity"/>
        <result column="quantity" property="quantity"/>
        <result column="unit" property="unit"/>
        <result column="price" property="price"/>
        <result column="money" property="money"/>
        <result column="remarks" property="remarks"/>
 
        <result column="available_quantity" property="finishedGlassShelfInformation.availableQuantity"/>
        <result column="total_quantity" property="finishedGlassShelfInformation.totalQuantity"/>
 
    </resultMap>
 
    <select id="getSelectFinishedGlassShelfInformation">
        select
        *
        from
        mm.finished_glass_shelf_information
        where glass_shelf_number = #{finishedGlassShelfInformation.glassShelfNumber}
          and glass_shelf_name = #{finishedGlassShelfInformation.glassShelfName}
            and price = #{finishedGlassShelfInformation.price}
            and unit = #{finishedGlassShelfInformation.unit}
            and max_weight = #{finishedGlassShelfInformation.maxWeight}
            and max_width = #{finishedGlassShelfInformation.maxWidth}
            and max_height = #{finishedGlassShelfInformation.maxHeight}
 
    </select>
 
 
    <insert id="insetFinishedGlassShelfInformation"  useGeneratedKeys="true" >
        insert into mm.finished_glass_shelf_information(glass_shelf_number,glass_shelf_name,available_quantity,
                                                        total_quantity,price,money,unit,max_weight,max_width,max_height,remarks,create_time)
        values (
                   #{finishedGlassShelfInformation.glassShelfNumber},#{finishedGlassShelfInformation.glassShelfName}
                   ,#{finishedGlassShelfInformation.totalQuantity},#{finishedGlassShelfInformation.totalQuantity}
                   ,#{finishedGlassShelfInformation.price},#{finishedGlassShelfInformation.money}
                   ,#{finishedGlassShelfInformation.unit},#{finishedGlassShelfInformation.maxWeight}
                   ,#{finishedGlassShelfInformation.maxWidth},#{finishedGlassShelfInformation.maxHeight},#{finishedGlassShelfInformation.remarks},now()
               )
    </insert>
 
    <insert id="insetFinishedGlassShelfLog"  useGeneratedKeys="true" >
        insert into mm.finished_glass_shelf_log(type,glass_shelf_number,glass_shelf_name,quantity,price,money,unit,
                                                max_weight,max_width,max_height,remarks,create_time)
        values (
                  3,#{finishedGlassShelfInformation.glassShelfNumber},#{finishedGlassShelfInformation.glassShelfName}
               ,#{finishedGlassShelfInformation.totalQuantity}
               ,#{finishedGlassShelfInformation.price},#{finishedGlassShelfInformation.money}
               ,#{finishedGlassShelfInformation.unit},#{finishedGlassShelfInformation.maxWeight}
               ,#{finishedGlassShelfInformation.maxWidth},#{finishedGlassShelfInformation.maxHeight},#{finishedGlassShelfInformation.remarks},now()
               )
    </insert>
 
    <update id="updateFinishedGlassShelfInformationQuantity">
        update mm.finished_glass_shelf_information set available_quantity=available_quantity+ #{quantity},
                                                       total_quantity=total_quantity+#{quantity} where id=#{id}
    </update>
 
    <update id="updateFinishedGlassShelfInformation">
        update mm.finished_glass_shelf_information set glass_shelf_number=#{finishedGlassShelfInformation.glassShelfNumber},
                                                       glass_shelf_name=#{finishedGlassShelfInformation.glassShelfName},
                                                       available_quantity=#{finishedGlassShelfInformation.availableQuantity},
                                                       total_quantity=#{finishedGlassShelfInformation.totalQuantity},
                                                       price=#{finishedGlassShelfInformation.price},
                                                       money=#{finishedGlassShelfInformation.money},
                                                       unit=#{finishedGlassShelfInformation.unit},
                                                       max_weight=#{finishedGlassShelfInformation.maxWeight},
                                                       max_width=#{finishedGlassShelfInformation.maxWidth},
                                                       max_height=#{finishedGlassShelfInformation.maxHeight},
                                                       remarks=#{finishedGlassShelfInformation.remarks},
                                                       create_time=now()
                                                   where id=#{id}
    </update>
 
 
    <select id="getSelectFinishedGlassShelfInformationDate">
        select * from mm.finished_glass_shelf_information where available_quantity>0 limit #{offset},#{pageSize};
    </select>
 
    <select id="getSelectFinishedGlassShelfInformationDatePageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from
        mm.finished_glass_shelf_information where available_quantity>0
    </select>
 
    <select id="getSelectFinishedGlassShelfInformationById">
        select
        *
        from
        mm.finished_glass_shelf_information  where id = #{id}
 
    </select>
 
 
    <select id="getSelectFinishedGlassShelfInformationInId">
        select
            id as informationId,
        glass_shelf_number as glassShelfNumber,
        glass_shelf_name as glassShelfName,
        available_quantity as availableQuantity,
        total_quantity as totalQuantity,
        price,
        money,
        unit,
        max_weight as maxWeight,
        max_width as maxWidth,
        max_height as maxHeight,
        remarks
        from
            mm.finished_glass_shelf_information  where id in
        <foreach item="id" collection="ids" open="(" separator="," close=")">
            #{id}
        </foreach>
 
    </select>
 
 
    <delete id="deleteFinishedGlassShelfInformationById">
        delete  from mm.finished_glass_shelf_information  where id=#{id}
 
    </delete>
 
    <select id="getSelectFinishedGlassShelfEmitByemitId">
        select * from
        mm.finished_glass_shelf_emit
        where emit_id=#{emitId}
    </select>
 
    <select id="getSelectFinishedGlassShelfEmitDetailsByemitId" >
        select
            fed.information_id as informationId,
            fed.glass_shelf_number as glassShelfNumber,
            fed.glass_shelf_name as glassShelfName,
            fed.quantity as quantity,
            fi.available_quantity+fed.quantity as availableQuantity,
            fi.total_quantity as totalQuantity,
            fed.price,
            fed.money,
            fed.unit,
            fed.remarks,
            fed.withdraw_quantity as withdrawQuantity,
            fed.quantity-fed.withdraw_quantity as quantity2,
            fed.emit_id as emitId,
            fed.emit_number as emitNumber
            from
            mm.finished_glass_shelf_emit_details fed left join mm.finished_glass_shelf_information fi on fed.information_id=fi.id
        where emit_id=#{emitId}
    </select>
 
 
    <select id="getSelectFinishedGlassShelfEmitDetailsByemitId1" >
        select * from mm.finished_glass_shelf_emit_details where emit_id=#{emitId}
    </select>
 
 
    <select id="getmaximumEmit" >
        select ifnull(SUBSTR(max(right(emit_id,8)) from 7),0) from  mm.finished_glass_shelf_emit where  date(create_time)=CURDATE()
    </select>
 
    <select id="getmaximumWithdraw" >
        select ifnull(SUBSTR(max(right(withdraw_id,8)) from 7),0) from  mm.finished_glass_shelf_withdraw where  date(create_time)=CURDATE()
    </select>
 
 
    <insert id="insertFinishedGlassShelfEmit"  useGeneratedKeys="true" >
        insert into mm.finished_glass_shelf_emit(emit_id,create_time,withdraw_time,customer_name,project,operator,state,remarks)
        values (
                   #{emitId},now(),#{finishedGlassShelfEmit.withdrawTime},#{finishedGlassShelfEmit.customerName}
               ,#{finishedGlassShelfEmit.project},#{finishedGlassShelfEmit.operator},0,#{finishedGlassShelfEmit.remarks}
               )
    </insert>
 
    <insert id="insertFinishedGlassShelfEmitDetails"  useGeneratedKeys="true" >
        insert into mm.finished_glass_shelf_emit_details(emit_id,emit_number,information_id,glass_shelf_number,glass_shelf_name,
                                                         withdraw_quantity,quantity,price,unit,money,remarks)
        values (
                   #{emitId},#{emitNumber},#{finishedGlassShelfEmitDetails.informationId},
                #{finishedGlassShelfEmitDetails.glassShelfNumber},#{finishedGlassShelfEmitDetails.glassShelfName}
               ,0,#{finishedGlassShelfEmitDetails.quantity},#{finishedGlassShelfEmitDetails.price},#{finishedGlassShelfEmitDetails.unit},
                #{finishedGlassShelfEmitDetails.money},#{finishedGlassShelfEmitDetails.remarks}
               )
    </insert>
 
    <insert id="insertFinishedGlassShelfEmitDetailsLog"  useGeneratedKeys="true" >
        insert into mm.finished_glass_shelf_log(document_id,document_number,type,glass_shelf_number,glass_shelf_name,quantity,price,money,unit,
                                                remarks,create_time)
        values (
                   #{emitId},#{emitNumber},#{type}, #{glassShelfNumber},#{glassShelfName},#{quantity},#{price},#{money},#{unit},#{remarks},now()
               )
    </insert>
 
    <update id="updateInformationAvailableQuantityOut">
        update mm.finished_glass_shelf_information set available_quantity=available_quantity-#{finishedGlassShelfEmitDetails.quantity}
                                                   where id=#{finishedGlassShelfEmitDetails.informationId}
    </update>
 
    <update id="updateInformationAvailableQuantityInt">
        update mm.finished_glass_shelf_information set available_quantity=available_quantity+#{finishedGlassShelfEmitDetails.quantity}
        where id=#{finishedGlassShelfEmitDetails.informationId}
    </update>
 
    <update id="updateFinishedGlassShelfEmit"  >
        update mm.finished_glass_shelf_emit set create_time=now(),
                                                withdraw_time=#{finishedGlassShelfEmit.withdrawTime},
                                                customer_name=#{finishedGlassShelfEmit.customerName},
                                                project=#{finishedGlassShelfEmit.project},
                                                operator=#{finishedGlassShelfEmit.operator},
                                                remarks=#{finishedGlassShelfEmit.remarks}
                                            where emit_id=#{emitId}
    </update>
 
    <delete id="deleteFinishedGlassShelfEmitDetails"  >
        delete from mm.finished_glass_shelf_emit_details  where emit_id=#{emitId}
    </delete>
 
    <delete id="deleteFinishedGlassShelfEmit"  >
        delete from mm.finished_glass_shelf_emit  where emit_id=#{emitId}
    </delete>
 
    <delete id="deleteFinishedGlassShelfEmitDetailsLog"  >
        delete from mm.finished_glass_shelf_log  where document_id=#{emitId}
    </delete>
 
    <update id="updateFinishedGlassShelfEmitDetailsLog"  >
        update mm.finished_glass_shelf_log set state=1  where document_id=#{emitId}
    </update>
 
 
    <select id="getSelectFinishedGlassShelfEmit">
        select * from mm.finished_glass_shelf_emit
        <where>
            date(create_time)>=#{startDate} and date(create_time) &lt;= #{endDate}
            <if test="emit.emitId != null and emit.emitId != ''">
                and emit_id regexp #{emit.emitId}
            </if>
            <if test="emit.customerName != null and emit.customerName != ''">
                and customer_name regexp #{emit.customerName}
            </if>
            <if test="emit.project != null and emit.project != ''">
                and project regexp #{emit.project}
            </if>
            <if test="emit.operator != null and emit.operator != ''">
                and operator regexp #{emit.operator}
            </if>
            <if test="emit.state != null">
                and `state` = #{emit.state}
            </if>
            <if test="emit.remarks != null and emit.remarks != ''">
                and remarks regexp #{emit.remarks}
            </if>
 
        </where>
        group by emit_id
        limit #{offset},#{pageSize};
    </select>
 
    <select id="getSelectFinishedGlassShelfEmitPageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from mm.finished_glass_shelf_emit
        <where>
            date(create_time)>=#{startDate} and date(create_time) &lt;= #{endDate}
            <if test="emit.emitId != null and emit.emitId != ''">
                and emit_id regexp #{emit.emitId}
            </if>
            <if test="emit.customerName != null and emit.customerName != ''">
                and customer_name regexp #{emit.customerName}
            </if>
            <if test="emit.project != null and emit.project != ''">
                and project regexp #{emit.project}
            </if>
            <if test="emit.operator != null and emit.operator != ''">
                and operator regexp #{emit.operator}
            </if>
            <if test="emit.state != null">
                and state = #{emit.state}
            </if>
            <if test="emit.remarks != null and emit.remarks != ''">
                and remarks regexp #{emit.remarks}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
 
 
    <select id="getSelectFinishedGlassShelfWithdrawByemitId">
        select * from
            mm.finished_glass_shelf_withdraw
        where withdraw_id=#{withdrawId}
    </select>
 
    <select id="getSelectFinishedGlassShelfWithdrawDetailsBywithdrawId1" >
        select * from mm.finished_glass_shelf_withdraw_details where withdraw_id=#{withdrawId}
    </select>
 
    <select id="getSelectFinishedGlassShelfWithdrawDetailsBywithdrawId" >
        select
            fgw.emit_id as emitId,
            fgw.emit_number as emitNumber,
            fgw.glass_shelf_number as glassShelfNumber,
            fgw.glass_shelf_name as glassShelfName,
            fgw.quantity,
            fge.quantity-fge.withdraw_quantity+fgw.quantity as quantity2,
            fgw.unit,
            fgw.price,
            fgw.money,
            fgw.remarks
        from mm.finished_glass_shelf_withdraw_details fgw
            left join mm.finished_glass_shelf_emit_details fge
                 on fgw.emit_id=fge.emit_id and fgw.emit_number=fge.emit_number
                 where withdraw_id=#{withdrawId}
    </select>
 
    <select id="getSelectFinishedGlassShelfWithdraw">
        select * from mm.finished_glass_shelf_withdraw
        <where>
            date(create_time)>=#{startDate} and date(create_time) &lt;= #{endDate}
            <if test="withdraw.withdrawId != null and withdraw.withdrawId != ''">
                and withdraw_id regexp #{withdraw.withdrawId}
            </if>
            <if test="withdraw.customerName != null and withdraw.customerName != ''">
                and customer_name regexp #{withdraw.customerName}
            </if>
            <if test="withdraw.project != null and withdraw.project != ''">
                and project regexp #{withdraw.project}
            </if>
            <if test="withdraw.operator != null and withdraw.operator != ''">
                and operator regexp #{withdraw.operator}
            </if>
            <if test="withdraw.remarks != null and withdraw.remarks != ''">
                and remarks regexp #{withdraw.remarks}
            </if>
 
        </where>
        group by withdraw_id
        limit #{offset},#{pageSize};
    </select>
 
    <select id="getSelectFinishedGlassShelfWithdrawPageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from mm.finished_glass_shelf_withdraw
        <where>
            date(create_time)>=#{startDate} and date(create_time) &lt;= #{endDate}
            <if test="withdraw.withdrawId != null and withdraw.withdrawId != ''">
                and withdraw_id regexp #{withdraw.withdrawId}
            </if>
            <if test="withdraw.customerName != null and withdraw.customerName != ''">
                and customer_name regexp #{withdraw.customerName}
            </if>
            <if test="withdraw.project != null and withdraw.project != ''">
                and project regexp #{withdraw.project}
            </if>
            <if test="withdraw.operator != null and withdraw.operator != ''">
                and operator regexp #{withdraw.operator}
            </if>
            <if test="withdraw.remarks != null and withdraw.remarks != ''">
                and remarks regexp #{withdraw.remarks}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
 
 
    <update id="updateEmitDetailsWithdrawQuantityInt">
        update mm.finished_glass_shelf_emit_details set withdraw_quantity=withdraw_quantity+#{finishedGlassShelfWithdrawDetails.quantity}
        where emit_id=#{finishedGlassShelfWithdrawDetails.emitId} and emit_number=#{finishedGlassShelfWithdrawDetails.emitNumber}
    </update>
 
    <update id="updateEmitDetailsWithdrawQuantityOut">
        update mm.finished_glass_shelf_emit_details set withdraw_quantity=withdraw_quantity-#{finishedGlassShelfWithdrawDetails.quantity}
        where emit_id=#{finishedGlassShelfWithdrawDetails.emitId} and emit_number=#{finishedGlassShelfWithdrawDetails.emitNumber}
    </update>
 
    <delete id="deleteFinishedGlassShelfWithdrawDetails"  >
        delete from mm.finished_glass_shelf_withdraw_details  where withdraw_id=#{withdrawId}
    </delete>
 
    <delete id="deleteFinishedGlassShelfWithdraw"  >
        delete from mm.finished_glass_shelf_withdraw  where withdraw_id=#{withdrawId}
    </delete>
 
 
    <update id="updateFinishedGlassShelfWithdraw"  >
        update mm.finished_glass_shelf_withdraw set create_time=now() where withdraw_id=#{withdrawId}
    </update>
 
    <insert id="insertFinishedGlassShelfWithdraw"  useGeneratedKeys="true" >
        insert into mm.finished_glass_shelf_withdraw(withdraw_id,create_time,customer_name,project,operator,remarks)
        values (
                   #{withdrawId},now(),#{finishedGlassShelfWithdraw.customerName}
               ,#{finishedGlassShelfWithdraw.project},#{finishedGlassShelfWithdraw.operator},#{finishedGlassShelfWithdraw.remarks}
               )
    </insert>
 
    <insert id="insertFinishedGlassShelfWithdrawDetails"  useGeneratedKeys="true" >
        insert into mm.finished_glass_shelf_withdraw_details(withdraw_id,withdraw_number,emit_id,emit_number,glass_shelf_number,glass_shelf_name,
                                                         quantity,price,unit,money,remarks)
        values (
                   #{withdrawId},#{withdrawNumber},#{finishedGlassShelfWithdrawDetails.emitId},#{finishedGlassShelfWithdrawDetails.emitNumber},
                    #{finishedGlassShelfWithdrawDetails.glassShelfNumber},#{finishedGlassShelfWithdrawDetails.glassShelfName}
                   ,#{finishedGlassShelfWithdrawDetails.quantity},#{finishedGlassShelfWithdrawDetails.price},#{finishedGlassShelfWithdrawDetails.unit},
                   #{finishedGlassShelfWithdrawDetails.money},#{finishedGlassShelfWithdrawDetails.remarks}
               )
    </insert>
 
    <update id="updateFinishedGlassShelfEmitState">
        update mm.finished_glass_shelf_emit set state=#{state}
        where emit_id=#{emitId}
    </update>
 
 
 
    <select id="getFinishedGlassShelfLogReport">
        select *
        from mm.finished_glass_shelf_log
        <where>
            date(create_time)>=#{startDate} and date(create_time) &lt;= #{endDate} and type=#{type} and state=0
            <if test="finishedGlassShelfLog.documentId != null and finishedGlassShelfLog.documentId != ''">
                and document_id regexp #{finishedGlassShelfLog.documentId}
            </if>
            <if test="finishedGlassShelfLog.documentNumber != null and finishedGlassShelfLog.documentNumber != ''">
                and document_number regexp #{finishedGlassShelfLog.documentNumber}
            </if>
            <if test="finishedGlassShelfLog.glassShelfNumber != null and finishedGlassShelfLog.glassShelfNumber != ''">
                and glass_shelf_number regexp #{finishedGlassShelfLog.glassShelfNumber}
            </if>
            <if test="finishedGlassShelfLog.glassShelfName != null and finishedGlassShelfLog.glassShelfName != ''">
                and glass_shelf_name regexp #{finishedGlassShelfLog.glassShelfName}
            </if>
            <if test="finishedGlassShelfLog.quantity != null and finishedGlassShelfLog.quantity != ''">
                and quantity regexp #{finishedGlassShelfLog.quantity}
            </if>
            <if test="finishedGlassShelfLog.unit != null and finishedGlassShelfLog.unit != ''">
                and unit regexp #{finishedGlassShelfLog.unit}
            </if>
            <if test="finishedGlassShelfLog.price != null and finishedGlassShelfLog.price != ''">
                and price regexp REGEXP_REPLACE(#{finishedGlassShelfLog.price},'\\.0+$','')
            </if>
            <if test="finishedGlassShelfLog.money != null and finishedGlassShelfLog.money != ''">
                and money regexp REGEXP_REPLACE(#{finishedGlassShelfLog.money},'\\.0+$','')
            </if>
            <if test="finishedGlassShelfLog.remarks != null and finishedGlassShelfLog.remarks != ''">
                and remarks regexp #{finishedGlassShelfLog.remarks}
            </if>
            <if test="finishedGlassShelfLog.maxWeight != null and finishedGlassShelfLog.maxWeight != ''">
                and max_weight regexp #{finishedGlassShelfLog.maxWeight}
            </if>
            <if test="finishedGlassShelfLog.maxWidth != null and finishedGlassShelfLog.maxWidth != ''">
                and max_width regexp #{finishedGlassShelfLog.maxWidth}
            </if>
            <if test="finishedGlassShelfLog.maxHeight != null and finishedGlassShelfLog.maxHeight != ''">
                and max_height regexp #{finishedGlassShelfLog.maxHeight}
            </if>
        </where>
        order by id desc
        limit #{offset},#{pageSize};
    </select>
 
 
    <select id="getFinishedGlassShelfLogReportTotal">
        select CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from finished_glass_shelf_log
        <where>
            date(create_time)>=#{startDate} and date(create_time) &lt;= #{endDate} and type=#{type} and state=0
            <if test="finishedGlassShelfLog.documentId != null and finishedGlassShelfLog.documentId != ''">
                and document_id regexp #{finishedGlassShelfLog.documentId}
            </if>
            <if test="finishedGlassShelfLog.documentNumber != null and finishedGlassShelfLog.documentNumber != ''">
                and document_number regexp #{finishedGlassShelfLog.documentNumber}
            </if>
            <if test="finishedGlassShelfLog.glassShelfNumber != null and finishedGlassShelfLog.glassShelfNumber != ''">
                and glass_shelf_number regexp #{finishedGlassShelfLog.glassShelfNumber}
            </if>
            <if test="finishedGlassShelfLog.glassShelfName != null and finishedGlassShelfLog.glassShelfName != ''">
                and glass_shelf_name regexp #{finishedGlassShelfLog.glassShelfName}
            </if>
            <if test="finishedGlassShelfLog.quantity != null and finishedGlassShelfLog.quantity != ''">
                and quantity regexp #{finishedGlassShelfLog.quantity}
            </if>
            <if test="finishedGlassShelfLog.unit != null and finishedGlassShelfLog.unit != ''">
                and unit regexp #{finishedGlassShelfLog.unit}
            </if>
            <if test="finishedGlassShelfLog.price != null and finishedGlassShelfLog.price != ''">
                and price regexp REGEXP_REPLACE(#{finishedGlassShelfLog.price},'\\.0+$','')
            </if>
            <if test="finishedGlassShelfLog.money != null and finishedGlassShelfLog.money != ''">
                and money regexp REGEXP_REPLACE(#{finishedGlassShelfLog.money},'\\.0+$','')
            </if>
            <if test="finishedGlassShelfLog.remarks != null and finishedGlassShelfLog.remarks != ''">
                and remarks regexp #{finishedGlassShelfLog.remarks}
            </if>
            <if test="finishedGlassShelfLog.maxWeight != null and finishedGlassShelfLog.maxWeight != ''">
                and max_weight regexp #{finishedGlassShelfLog.maxWeight}
            </if>
            <if test="finishedGlassShelfLog.maxWidth != null and finishedGlassShelfLog.maxWidth != ''">
                and max_width regexp #{finishedGlassShelfLog.maxWidth}
            </if>
            <if test="finishedGlassShelfLog.maxHeight != null and finishedGlassShelfLog.maxHeight != ''">
                and max_height regexp #{finishedGlassShelfLog.maxHeight}
            </if>
        </where>
    </select>
 
    <select id="exportFinishedGlassShelfLogReport">
        select * from mm.finished_glass_shelf_log
        where  date(create_time)>=#{dates[0]} and date(create_time) &lt;= #{dates[1]} and type=#{type} and state=0
 
    </select>
 
 
</mapper>