IMDoingOrderMapper.xml
30.2 KB
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
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
<?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.sibu.orderHelper.integral.web.dao.IMWebDoingOrderDao">
<!-- 恢复退单之前的订单状态 -->
<update id="restorePreOrderStatus" parameterType="map">
update ${doingOrderTable} set order_status=#{newStatus} where order_id=#{orderId} AND member_id = #{memberId} and order_status = #{oldStatus}
</update>
<update id="updateOrderItemRefundStatus" parameterType="map">
update ${doingOrder1Table} set refund_status = ${refundStatus} where order_id = #{orderId} and order1_id = #{order1Id}
</update>
<!-- 计算总条数 -->
<select id="countIMOrder" resultType="int" parameterType="map">
SELECT SUM(num) AS num FROM
<foreach collection="tableNames" open="(" close=")" separator=" UNION ALL " item="tableName">
SELECT COUNT(1) AS num FROM ${tableName}
where delete_flag =1
<if test=" orderCode !=null and orderCode!='' ">
and order_code =#{orderCode}
</if>
<if test="startCreateDt != null and startCreateDt !=''">
and create_dt >= #{startCreateDt}
</if>
<if test="endCreateDt != null and endCreateDt != ''">
<![CDATA[
and create_dt <= #{endCreateDt}
]]>
</if>
<if test="orderFrom !=null and orderFrom!='' ">
and order_from =#{orderFrom}
</if>
<if test="phone !=null and phone!=''">
and phone =#{phone}
</if>
<if test="orderStatus != null and orderStatus !=''">
and order_status =#{orderStatus}
</if>
<if test="buyerUsername !=null and buyerUsername !=''">
and buyer_username like concat(#{buyerUsername},'%')
</if>
<if test="buyerPhone !=null and buyerPhone !=''">
and buyer_phone =#{buyerPhone}
</if>
<if test="erpImport !=null and erpImport !=''">
and erp_import=#{erpImport}
</if>
<if test="contact !=null and contact !=''">
and contact like concat(#{contact},'%')
</if>
<if test="supplierId !=null and supplierId !=''">
and supplier_id = #{supplierId}
</if>
</foreach>
as temp
</select>
<!-- 查询分页订单 -->
<select id="pagerOrders" parameterType="map" resultMap="oneIMOrderNotProduct">
select * from
<foreach collection="tableNames" open="(" close=")" separator=" UNION ALL " item="tableName">
select order_id,member_id,order_code,order_status,order_from,
order_platform,contact,phone,province,city,area,address,zipcode,
buyer_remark,total_integral,total_money,freight,express_name,supplier_id,supplier_name,
express_code,express_code2,create_dt,pay_type,buyer_username,buyer_phone,erp_import
from ${tableName}
where delete_flag=1
<if test=" supplierId !=null and supplierId!=''">
and supplier_id =#{supplierId}
</if>
<if test=" orderCode !=null and orderCode!=''">
and order_code =#{orderCode}
</if>
<if test="startCreateDt != null and startCreateDt !=''">
and create_dt >= #{startCreateDt}
</if>
<if test="endCreateDt != null and endCreateDt != ''">
<![CDATA[
and create_dt <= #{endCreateDt}
]]>
</if>
<if test="orderFrom !=null and orderFrom!=''">
and order_from =#{orderFrom}
</if>
<if test="phone !=null and phone!=''">
and phone =#{phone}
</if>
<if test="orderStatus !=null and orderStatus !=''">
and order_status =#{orderStatus}
</if>
<if test="buyerUsername !=null and buyerUsername !=''">
and buyer_username like concat(#{buyerUsername},'%')
</if>
<if test="buyerPhone !=null and buyerPhone !=''">
and buyer_phone =#{buyerPhone}
</if>
<if test="erpImport !=null and erpImport !=''">
and erp_import=#{erpImport}
</if>
<if test="contact !=null and contact !=''">
and contact like concat(#{contact},'%')
</if>
</foreach>
as temp
ORDER BY temp.create_dt desc
limit ${pageNow}, ${pageSize}
</select>
<select id="countErrorIMOrder" resultType="int" parameterType="map">
SELECT SUM(num) AS num FROM
<foreach collection="tableNames" open="(" close=")" separator=" UNION ALL " item="tableName">
SELECT COUNT(1) AS num FROM ${tableName}
where delete_flag = 0 and order_status != 1
<if test=" orderCode !=null and orderCode!='' ">
and order_code =#{orderCode}
</if>
<if test="startCreateDt != null and startCreateDt !=''">
and create_dt >= #{startCreateDt}
</if>
<if test="endCreateDt != null and endCreateDt != ''">
<![CDATA[
and create_dt <= #{endCreateDt}
]]>
</if>
<if test="phone !=null and phone!=''">
and phone =#{phone}
</if>
<if test="buyerUsername !=null and buyerUsername !=''">
and buyer_username like concat(#{buyerUsername},'%')
</if>
<if test="buyerPhone !=null and buyerPhone !=''">
and buyer_phone =#{buyerPhone}
</if>
<if test="contact !=null and contact !=''">
and contact like concat(#{contact},'%')
</if>
<if test="supplierId !=null and supplierId !=''">
and supplier_id = #{supplierId}
</if>
</foreach>
as temp
</select>
<!-- 查询异常分页订单 -->
<select id="pagerErrorOrders" parameterType="map" resultMap="oneIMOrderNotProduct">
select * from
<foreach collection="tableNames" open="(" close=")" separator=" UNION ALL " item="tableName">
select order_id,member_id,order_code,order_status,order_from,
order_platform,contact,phone,province,city,area,address,zipcode,
buyer_remark,seller_remark,total_integral,total_money,freight,express_name,supplier_id,supplier_name,
express_code,express_code2,create_dt,pay_type,buyer_username,buyer_phone,erp_import
from ${tableName}
where delete_flag = 0 and order_status != 1
<if test=" orderCode !=null and orderCode!=''">
and order_code =#{orderCode}
</if>
<if test="startCreateDt != null and startCreateDt !=''">
and create_dt >= #{startCreateDt}
</if>
<if test="endCreateDt != null and endCreateDt != ''">
<![CDATA[
and create_dt <= #{endCreateDt}
]]>
</if>
<if test="phone !=null and phone!=''">
and phone =#{phone}
</if>
<if test="buyerUsername !=null and buyerUsername !=''">
and buyer_username like concat(#{buyerUsername},'%')
</if>
<if test="buyerPhone !=null and buyerPhone !=''">
and buyer_phone =#{buyerPhone}
</if>
<if test="contact !=null and contact !=''">
and contact like concat(#{contact},'%')
</if>
<if test="supplierId !=null and supplierId !=''">
and supplier_id = #{supplierId}
</if>
</foreach>
as temp limit ${pageNow}, ${pageSize}
</select>
<!-- 获取订单明细 -->
<select id="getIMOrderDetailOrderCode" parameterType="map" resultMap="oneIMOrderDetailColumn">
select
do.order_id,do.member_id,do.order_code,do.main_order_code,do.order_status,do.order_from,do.buyer_username,do.buyer_phone,
do.order_platform,do.contact,do.phone,do.province,do.city,do.area,do.address,do.zipcode,do.erp_import_dt,do.erp_import,
do.buyer_remark,do.seller_remark,do.total_integral,do.total_money,do.freight,do.express_name,do.transaction_id,do.pay_type,do.open_id,
do.express_code,do.express_code2,do.create_dt,do.receive_dt,do.pay_dt,do.user_coupon_money,do.deduction_vb,do.deduction_money,do1.order1_id,do1.product_id,do.ship_dt,
do.prerefund_original_order_status,do.share_member_id,do.share_order_money,do.platform_type,do.supplier_id,do.supplier_name,do.sign_pay_status,
do1.purchase_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price,do1.name as
order1_name,do1.erp_code,do1.sku_id,
do1.thumb_img,do1.spec_detail,do1.discount_price,do1.discount_line_price,do1.deduction_product_vb,do1.deduction_line_vb,
do1.product_share_percentage
from ${doingOrderTable} do left join ${doingOrder1Table} do1 on do.order_id=do1.order_id
where 1=1
<if test="orderCode !=null and orderCode !=''">
and do.order_code=#{orderCode}
</if>
<if test="orderId !=null and orderId !=''">
and do.order_id=#{orderId}
</if>
<if test="supplierId != null and supplierId != ''">
and do.supplier_id =#{supplierId}
</if>
</select>
<!-- 获取订单详情(不包含产品) -->
<select id="getOrderByCode" parameterType="map" resultMap="oneIMOrderDetailColumn">
select order_id,member_id,order_code,main_order_code,order_status,order_from,express_name,express_code,express_code2,
order_platform,contact,phone,total_integral,freight,create_dt,pay_dt,total_money,buyer_username,buyer_phone,open_id,
erp_import,prerefund_original_order_status,share_member_id,sign_pay_status,supplier_id,supplier_name
from ${doingOrderTable}
where order_code=#{orderCode} AND delete_flag=1
</select>
<!-- 导入已实际付款订单 -->
<update id="importActualPaymentOrder" parameterType="map">
update ${doingOrderTable} set sign_pay_status=1,
operator_id=#{operatorId},operator_name=#{operatorName},operator_date=now()
where order_code= #{orderCode}
</update>
<!-- 更新订单状态 -->
<update id="updateVerifyStatus" parameterType="map">
update ${doingOrderTable} set order_status=#{orderStatus} where order_code in
<foreach collection="ids" open="(" close=")" separator=" , " item="orderCode">
#{orderCode}
</foreach>
</update>
<update id="updateOrderStatusByCode" parameterType="map">
update ${doingOrderTable} set order_status = ${orderStatus} where order_code = #{orderCode}
</update>
<update id="updateOrderStatusByOrderCode" parameterType="map">
update ${doingOrderTable} set order_status = ${newStatus} where order_code = #{orderCode} and order_status = #{oldStatus}
</update>
<!-- 处理订单退款 -->
<update id="refundOrderHandle" parameterType="map">
update ${doingOrderTable} set order_status = ${orderStatus} where order_code = #{orderCode}
</update>
<!-- 更新订单快递单号 -->
<update id="updateOrderExpress" parameterType="java.util.Map">
update ${tableName}
<set>
<if test="expressCode != null and expressCode != ''">
express_code = #{expressCode},
</if>
<if test="expressCode2 != null and expressCode2 != ''">
express_code2 = concat(IFNULL(express_code2,''),#{expressCode2}),
</if>
<if test="orderStatus != null and orderStatus != ''">
order_status=#{orderStatus},
ship_dt=now(),
erp_import=1,
erp_import_dt=now(),
</if>
<if test="expressName!=null and expressName !=''">
express_name = IF(express_name is NULL OR express_name = '', #{expressName}, express_name),
</if>
</set>
where order_code=#{orderCode} and order_status >=3 limit 1
</update>
<!-- 更新订单快递单号 -->
<update id="updateOrderExpressNew" parameterType="java.util.Map">
update ${tableName}
<set>
<if test="expressCode != null">
express_code=#{expressCode} ,
</if>
<if test="expressCode2 != null">
express_code2=#{expressCode2},
</if>
<if test="orderStatus != null">
order_status=#{orderStatus},
ship_dt=now(),
erp_import=1,
erp_import_dt=now(),
</if>
<if test="expressName!=null and expressName !=''">
express_name =#{expressName}
</if>
</set>
where order_code=#{orderCode}
</update>
<resultMap type="IMDoingOrderBean" id="oneIMOrderDetailColumn">
<id column="order_id" property="orderId"/>
<result column="member_id" property="memberId"/>
<result column="order_code" property="orderCode"/>
<result column="main_order_code" property="mainOrderCode"/>
<result column="order_status" property="orderStatus"/>
<result column="order_from" property="orderFrom"/>
<result column="order_platform" property="orderPlatform"/>
<result column="contact" property="contact"/>
<result column="phone" property="phone"/>
<result column="province" property="province"/>
<result column="city" property="city"/>
<result column="area" property="area"/>
<result column="address" property="address"/>
<result column="zipcode" property="zipcode"/>
<result column="buyer_remark" property="buyerRemark"/>
<result column="seller_remark" property="sellerRemark"/>
<result column="total_integral" property="totalIntegral"/>
<result column="total_money" property="totalMoney"/>
<result column="freight" property="freight"/>
<result column="express_name" property="expressName"/>
<result column="express_code" property="expressCode"/>
<result column="express_code2" property="expressCode2"/>
<result column="create_dt" property="createDt"/>
<result column="pay_dt" property="payDt"/>
<result column="transaction_id" property="transactionId"/>
<result column="pay_type" property="payType"/>
<result column="open_id" property="openId"/>
<result column="buyer_username" property="buyerUsername"></result>
<result column="buyer_phone" property="buyerPhone"></result>
<result column="erp_import" property="erpImport"></result>
<result column="erp_import_dt" property="erpImportDt"></result>
<result column="ship_dt" property="shipDt"></result>
<result column="receive_dt" property="receiveDt"/>
<result column="user_coupon_money" property="userCouponMoney"/>
<result column="deduction_vb" property="deductionVb"/>
<result column="deduction_money" property="deductionMoney"/>
<result column="prerefund_original_order_status" property="prerefundOriginalOrderStatus"/>
<result column="share_member_id" property="shareMemberId"/>
<result column="share_order_money" property="shareOrderMoney"/>
<result column="platform_type" property="platformType"/>
<result column="supplier_id" property="supplierId"/>
<result column="supplier_name" property="supplierName"/>
<result column="sign_pay_status" property="signPayStatus"/>
<collection property="order1s" column="order_id" ofType="IMDoingOrder1Bean">
<result column="order1_id" property="order1Id"/>
<result column="product_id" property="productId"/>
<result column="purchase_quantity" property="purchaseQuantity"/>
<result column="shipped_quantity" property="shippedQuantity"/>
<result column="integral" property="integral"/>
<result column="line_integral" property="lineIntegral"/>
<result column="price" property="price"/>
<result column="line_price" property="linePrice"/>
<result column="order1_name" property="name"></result>
<result column="thumb_img" property="thumbImg"/>
<result column="spec_detail" property="specDetail"/>
<result column="discount_price" property="discountPrice"/>
<result column="discount_line_price" property="discountLinePrice"/>
<result column="deduction_product_vb" property="deductionProductVb"/>
<result column="deduction_line_vb" property="deductionLineVb"/>
<result column="erp_code" property="erpCode"/>
<result column="sku_id" property="skuId"/>
<result column="product_share_percentage" property="productSharePercentage"/>
</collection>
</resultMap>
<!-- 查询导出excel表订单 -->
<select id="exportOrderList" parameterType="map" resultMap="exportOrderList">
select * from
<foreach collection="tableNames" open="(" close=")" separator=" UNION ALL " item="orderTable">
select do.order_id,do.order_code,do.order_status,do.order_from,
do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money,
do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import,do.supplier_id,do.supplier_name,
do.erp_import_dt,do.buyer_username,do.buyer_phone,do.open_id,do.user_coupon_money,do.deduction_vb,do.deduction_money,
do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price,
do1.name,do1.erp_code,do1.spec_detail,do1.order1_id,do1.discount_price,do1.discount_line_price,do1.deduction_product_vb,do1.deduction_line_vb
from ${orderTable[1]} do1 left join ${orderTable[0]} do on do.order_id=do1.order_id
where do.delete_flag = 1
<if test="orderCode !=null and orderCode!=''">
and do.order_code =#{orderCode}
</if>
<if test="startCreateDt != null and startCreateDt !=''">
and create_dt >= #{startCreateDt}
</if>
<if test="endCreateDt != null and endCreateDt != ''">
<![CDATA[
and create_dt <= #{endCreateDt}
]]>
</if>
<if test="orderFrom !=null and orderFrom!=''">
and do.order_from =#{orderFrom}
</if>
<if test="phone !=null and phone!=''">
and do.phone =#{phone}
</if>
<if test="orderStatus !=null and orderStatus !=''">
and do.order_status =#{orderStatus}
</if>
<if test="buyerUsername !=null and buyerUsername !=''">
and do.buyer_username like concat('%', #{buyerUsername},'%')
</if>
<if test="buyerPhone !=null and buyerPhone !=''">
and do.buyer_phone =#{buyerPhone}
</if>
<if test="erpImport !=null and erpImport !=''">
and do.erp_import=#{erpImport}
</if>
<if test="contact !=null and contact !=''">
and do.contact like concat('%', #{contact}, '%')
</if>
<if test="supplierId !=null and supplierId !=''">
and supplier_id = #{supplierId}
</if>
</foreach>
as temp ORDER BY temp.create_dt
</select>
<select id="exportFinanceOrderList" parameterType="map" resultMap="exportFinanceOrderList">
select * from
<foreach collection="tableNames" open="(" close=")" separator=" UNION ALL " item="orderTable">
select do.order_code,do.order_status,do.total_integral,do.total_money,
do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.order_from,
do.open_id,do.user_coupon_money,do.deduction_vb,do.deduction_money from ${orderTable[0]} do
where do.delete_flag = 1 and do.buyer_phone not like '13800138%' and do.order_status >= 3
<if test="startCreateDt != null and startCreateDt !=''">
and do.pay_dt >= #{startCreateDt}
</if>
<if test="endCreateDt != null and endCreateDt != ''">
<![CDATA[
and do.pay_dt <= #{endCreateDt}
]]>
</if>
<if test="orderFrom !=null and orderFrom!=''">
and do.order_from =#{orderFrom}
</if>
</foreach>
as temp ORDER BY temp.create_dt
</select>
<resultMap type="com.sibu.orderHelper.integral.vo.IMDoingOrderFinanceBean" id="exportFinanceOrderList">
<id column="order_id" property="orderId"/>
<result column="order_code" property="orderCode"/>
<result column="order_status" property="orderStatus"/>
<result column="total_integral" property="totalIntegral"/>
<result column="total_money" property="totalMoney"/>
<result column="freight" property="freight"/>
<result column="create_dt" property="createDt"/>
<result column="pay_dt" property="payDt"/>
<result column="transaction_id" property="transactionId"/>
<result column="pay_type" property="payType"/>
<result column="open_id" property="openId"/>
<result column="order_from" property="orderFrom"/>
<result column="user_coupon_money" property="userCouponMoney"/>
<result column="deduction_vb" property="deductionVb"/>
<result column="deduction_money" property="deductionMoney"/>
</resultMap>
<resultMap type="IMDoingOrder1ExportBean" id="exportOrderList">
<id column="order1_id" property="order1Id"/>
<result column="purchase_quantity" property="purchaseQuantity"/>
<result column="shipped_quantity" property="shippedQuantity"/>
<result column="integral" property="integral"/>
<result column="line_integral" property="lineIntegral"/>
<result column="price" property="price"/>
<result column="line_price" property="linePrice"/>
<result column="name" property="productName"/>
<result column="erp_code" property="erpCode"/>
<result column="spec_detail" property="specDetail"/>
<result column="discount_price" property="discountPrice"/>
<result column="discount_line_price" property="discountLinePrice"/>
<result column="deduction_product_vb" property="deductionProductVb"/>
<result column="deduction_line_vb" property="deductionLineVb"/>
<association property="doingOrder" javaType="IMDoingOrderBean">
<id column="order_id" property="orderId"/>
<result column="member_id" property="memberId"/>
<result column="order_code" property="orderCode"/>
<result column="order_status" property="orderStatus"/>
<result column="order_from" property="orderFrom"/>
<result column="order_platform" property="orderPlatform"/>
<result column="contact" property="contact"/>
<result column="phone" property="phone"/>
<result column="address" property="address"/>
<result column="zipcode" property="zipcode"/>
<result column="total_integral" property="totalIntegral"/>
<result column="total_money" property="totalMoney"/>
<result column="freight" property="freight"/>
<result column="create_dt" property="createDt"/>
<result column="pay_dt" property="payDt"/>
<result column="transaction_id" property="transactionId"/>
<result column="pay_type" property="payType"/>
<result column="open_id" property="openId"/>
<result column="buyer_username" property="buyerUsername"></result>
<result column="buyer_phone" property="buyerPhone"></result>
<result column="erp_import" property="erpImport"></result>
<result column="erp_import_dt" property="erpImportDt"></result>
<result column="user_coupon_money" property="userCouponMoney"/>
<result column="deduction_vb" property="deductionVb"/>
<result column="deduction_money" property="deductionMoney"/>
<result column="supplier_id" property="supplierId"/>
<result column="supplier_name" property="supplierName"/>
</association>
</resultMap>
<resultMap type="IMDoingOrderBean" id="oneIMOrderNotProduct">
<id column="order_id" property="orderId"/>
<result column="member_id" property="memberId"/>
<result column="order_code" property="orderCode"/>
<result column="order_status" property="orderStatus"/>
<result column="order_from" property="orderFrom"/>
<result column="order_platform" property="orderPlatform"/>
<result column="contact" property="contact"/>
<result column="phone" property="phone"/>
<result column="total_integral" property="totalIntegral"/>
<result column="total_money" property="totalMoney"></result>
<result column="freight" property="freight"/>
<result column="create_dt" property="createDt"/>
<result column="address" property="address"></result>
<result column="express_code" property="expressCode"></result>
<result column="express_code2" property="expressCode2"></result>
<result column="express_name" property="expressName"></result>
<result column="seller_remark" property="sellerRemark"></result>
<result column="buyer_remark" property="buyerRemark"></result>
<result column="province" property="province"></result>
<result column="city" property="city"></result>
<result column="area" property="area"></result>
<result column="address" property="address"></result>
<result column="zipcode" property="zipcode"></result>
<result column="buyer_remark" property="buyerRemark"></result>
<result column="buyer_username" property="buyerUsername"></result>
<result column="buyer_phone" property="buyerPhone"></result>
<result column="erp_import" property="erpImport"></result>
<result column="supplier_id" property="supplierId"></result>
<result column="supplier_name" property="supplierName"></result>
</resultMap>
<select id="getIMDoingOrderBean" resultMap="oneIMOrderNotProduct" parameterType="map">
SELECT * FROM ${doingOrderTable} where delete_flag =1
<if test=" orderCode !=null and orderCode!='' ">
and order_code =#{orderCode}
</if>
<if test="orderFrom !=null and orderFrom!='' ">
and order_from =#{orderFrom}
</if>
<if test="orderStatus != null and orderStatus !=''">
and order_status =#{orderStatus}
</if>
</select>
<!-- 计算某个主订单下的子订单数量 -->
<select id="countIMOrderByOrderId" resultType="int" parameterType="map">
SELECT SUM(num) AS num FROM
<foreach collection="tableNames" open="(" close=")" separator=" UNION ALL " item="doingOrder1Table">
SELECT COUNT(1) AS num FROM ${doingOrder1Table}
where delete_flag =1
<if test=" orderId !=null and orderId!='' ">
and order_id =#{orderId}
</if>
<if test="productId !=null and productId!='' ">
and product_id =#{productId}
</if>
<if test="erpCode != null and erpCode !=''">
and erp_code =#{erpCode}
</if>
<if test="supplierId !=null and supplierId !=''">
and supplier_id = #{supplierId}
</if>
</foreach>
as temp
</select>
<resultMap id="order1Bean" type="com.sibu.orderHelper.integral.model.IMDoingOrder1Bean">
<result column="order1_id" property="order1Id"/>
<result column="order_id" property="orderId"/>
<result column="member_id" property="memberId"/>
<result column="sort_index" property="sortIndex"/>
<result column="product_id" property="productId"/>
<result column="purchase_quantity" property="purchaseQuantity"/>
<result column="shipped_quantity" property="shippedQuantity"/>
<result column="integral" property="integral"/>
<result column="line_integral" property="lineIntegral"/>
<result column="price" property="price"/>
<result column="line_price" property="linePrice"/>
<result column="is_evaluate" property="isEvaluate"/>
<result column="sku_id" property="skuId"/>
<result column="erp_code" property="erpCode"/>
<result column="thumb_img" property="thumbImg"/>
<result column="spec_detail" property="specDetail"/>
<result column="name" property="name"/>
<result column="market_price" property="marketPrice"/>
<result column="discount_price" property="discountPrice"/>
<result column="discount_line_price" property="discountLinePrice"/>
<result column="deduction_product_vb" property="deductionProductVb"/>
<result column="deduction_line_vb" property="deductionLineVb"/>
<result column="refund_status" property="refundStatus"/>
</resultMap>
<update id="updateDoingOrder1Goods" parameterType="map">
update ${doingOrder1Table}
<trim prefix="set" suffixOverrides=",">
<if test="name != null and name != ''">
set name = #{name},
</if>
<if test="erpCode != null and erpCode != ''">
erp_code=#{erpCode},
</if>
<if test="purchaseQuantity != null and purchaseQuantity != ''">
purchase_quantity=#{purchaseQuantity}
</if>
</trim>
where order1_id = #{order1Id}
</update>
<!-- 获取订单详情(不包含产品) -->
<select id="getOrderDetailByCode" parameterType="map" resultMap="oneIMOrderDetailColumn">
select order_id,member_id,order_code,order_status,order_from,
contact,phone,total_integral,freight,create_dt,pay_dt,total_money,buyer_username,buyer_phone,open_id,
province,city,area,address,zipcode,buyer_remark,pay_type,transaction_id,user_coupon_id,user_coupon_money,
express_name,express_code,express_code2,order_platform,
erp_import,prerefund_original_order_status
from ${doingOrderTable}
where order_code=#{orderCode} AND delete_flag=1
</select>
</mapper>