PineappleMapper.xml
21.9 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
<?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.dao.PineappleDao">
<!--检测退款订单-->
<select id="countCheckRefundStatusResponse" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(*) FROM im_order_refund WHERE order_code = #{orderCode} AND refund_status NOT IN ('100','101','-128')
</select>
<select id="getIMDoingOrderBean" parameterType="java.util.Map" resultMap="iMDoingOrderBean">
select order_code,order_status from ${doingOrderTable} WHERE order_code = #{orderCode} and supplier_id =#{supplierId}
</select>
<resultMap id="iMDoingOrderBean" type="com.sibu.orderHelper.integral.model.IMDoingOrderBean">
<result column="order_code" property="orderCode"/>
<result column="order_status" property="orderStatus"/>
</resultMap>
<select id="childrenrefundStatusBySuccess" parameterType="java.lang.String" resultMap="checkRefundStatusBean">
SELECT r.refund_code,r1.name,r.refund_status FROM im_refund_order_item r1
LEFT JOIN im_order_refund r ON r1.refund_id = r.refund_id
WHERE r.refund_status = 7 AND r.order_code = #{orderCode}
</select>
<resultMap id="checkRefundStatusBean" type="com.sibu.orderHelper.integral.model.CheckRefundStatusBean">
<result column="refund_code" property="refundno"/>
<result column="name" property="ProductName"/>
<result column="refund_status" property="refundStatus"/>
</resultMap>
<select id="childrenrefundStatusByCourse" parameterType="java.lang.String" resultMap="checkRefundStatusBean">
SELECT r.refund_code,r1.name,r.refund_status FROM im_refund_order_item r1
LEFT JOIN im_order_refund r ON r1.refund_id = r.refund_id
WHERE r.refund_status NOT IN ('7','100','101','-128') AND r.order_code = #{orderCode}
</select>
<!-- 退货退款单下载 -->
<resultMap id="getRefundBeanResultMap" type="com.sibu.orderHelper.integral.model.GetRefundBean">
<result column="refund_code" property="refundno"/>
<result column="order_code" property="platorderno"/>
<result column="order1_id" property="subplatorderno"/>
<result column="refund_money" property="refundamount"/>
<result column="apply_date" property="createtime"/>
<result column="refund_status_last_update_dt" property="updatetime"/>
<result column="refund_reason" property="reason"/>
<result column="name" property="productname"/>
<result column="refund_goods_deliver_name" property="logisticname"/>
<result column="refund_goods_waybill" property="logisticno"/>
<result column="status" property="goodsstatus"/>
<result column="refund_remark" property="refundstatusdesc"/>
<result column="refund_status" property="refundstatus"/>
<result column="spec_detail" property="sku"/>
<result column="im_product_id" property="outerid"/>
</resultMap>
<select id="pageGetRefundBean" parameterType="java.util.Map" resultMap="getRefundBeanResultMap">
SELECT r.refund_code,r.order_code,r1.order1_id,r.refund_money,r.apply_date,r.refund_status_last_update_dt,r.refund_status,p.im_product_id,
r.refund_remark,'JH_98' status,p.details,r.refund_reason,r.refund_reason,r1.name,r.refund_goods_deliver_name,r.refund_goods_waybill,r1.spec_detail
FROM im_order_refund r
LEFT JOIN im_refund_order_item r1 ON r.refund_id = r1.refund_id
LEFT JOIN im_product p ON p.im_product_id = r1.product_id
WHERE 1 = 1 and r.order_from = 1 and r.refund_status NOT IN ('100','101','-128')
<if test="supplierId!=null and supplierId !=''">
AND r.supplier_id = #{supplierId}
</if>
<if test="beginTime != null and beginTime !=''">
and r.apply_date >= #{beginTime}
</if>
<if test="endTime != null and endTime != ''">
<![CDATA[
and r.apply_date <= #{endTime}
]]>
</if>
ORDER by r.apply_date DESC
limit ${pageNow}, ${PageSize}
</select>
<!-- 获取订单详情(不包含产品) -->
<select id="getOneIMOrderById" parameterType="map" resultMap="pineappleOderDetailBean">
select ifnull(do.total_money,0) money,do.supplier_name,do.buyer_username,do.prerefund_original_order_status,do1.purchase_quantity
from ${doingOrderTable1} do1 LEFT JOIN ${doingOrderTable} do on do1.order_id = do.order_id
where do1.order1_id=#{orderId1}
</select>
<resultMap type="com.sibu.orderHelper.integral.model.PineappleOderDetailBean" id="pineappleOderDetailBean">
<result column="money" property="totalMoney" />
<result column="supplier_name" property="supplierName" />
<result column="buyer_username" property="buyerUsername" />
<result column="prerefund_original_order_status" property="orderStatus" />
<result column="purchase_quantity" property="num" />
</resultMap>
<resultMap type="com.sibu.orderHelper.integral.model.IMProductBean" id="listAPIIMProduct">
<result column="im_product_id" property="imProductId" />
<result column="name" property="name" />
<result column="short_name" property="shortName" />
<result column="stock_num" property="stockNum" />
<result column="details" property="details" />
<result column="exchange_integral" property="exchangeIntegral" />
<result column="xws_exchange_integral" property="xwsExchangeIntegral" />
<result column="sibukg_exchange_integral" property="sibukgExchangeIntegral" />
<result column="onther1_exchange_integral" property="onther1ExchangeIntegral" />
<result column="onther2_exchange_integral" property="onther2ExchangeIntegral" />
<result column="onther3_exchange_integral" property="onther3ExchangeIntegral" />
<result column="thumb_img" property="thumbImg" />
<result column="bannel_img1" property="bannelImg1" />
<result column="bannel_img2" property="bannelImg2" />
<result column="bannel_img3" property="bannelImg3" />
<result column="bannel_img4" property="bannelImg4" />
<result column="bannel_img5" property="bannelImg5" />
<result column="limit_exchange_number" property="limitExchangeNumber"/>
<result column="is_new" property="isNew" />
<result column="is_hot" property="isHot" />
<result column="is_reco" property="isReco" />
<result column="cost" property="cost" />
<result column="attention" property="attention" />
<result column="total_comment_score" property="totalCommentScore" />
<result column="total_comment_number" property="totalCommentNumber" />
<result column="member_price" property="memberPrice" />
<result column="retail_price" property="retailPrice" />
<result column="market_price" property="marketPrice" />
<result column="product_type" property="productType" />
<result column="is_show" property="isShow"/>
<result column="bar_code" property="barCode"/>
<result column="is_open_spec" property="isOpenSpec"/>
<result column="spec" property="spec"/>
<result column="mini_purchase_number" property="miniPurchaseNumber"/>
<result column="format_str" property="formatStr"/>
<result column="erp_code" property="erpCode"/>
<result column="is_group" property="isGroup"/>
<result column="share_status" property="shareStatus"/>
<result column="share_percentage" property="sharePercentage"/>
<result column="im_category_id" property="imCategoryId"/>
<result column="delete_flag" property="deleteFlag"/>
</resultMap>
<!-- 产品下载 -->
<resultMap id="downloadProductBean" type="com.sibu.orderHelper.integral.model.DownloadProductBean">
<result column="im_product_id" property="PlatProductID"/>
<result column="name" property="name"/>
<result column="OuterID" property="OuterID"/>
<result column="price" property="price"/>
<result column="stock_num" property="num"/>
<result column="bannel_img1" property="pictureurl"/>
</resultMap>
<select id="getProductListByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
SELECT p.im_product_id,p.name,p.im_product_id AS OuterID,IFNULL(p.retail_price,0) price,p.stock_num,p.bannel_img1
FROM im_product p,im_product_supplier i
WHERE p.im_product_id = i.product_id and i.supplier_id= #{supplierId}
<if test="isShow == 0">
and p.is_show = 0
</if>
<if test="isShow == 1">
and p.is_show = 1
</if>
<if test="productId !=null and productId !=''">
AND (p.im_product_id =#{productId} OR p.bar_code =#{productId})
</if>
<if test="productName !=null and productName !=''">
AND p.name =#{productName}
</if>
ORDER BY p.im_product_id DESC
limit ${PageIndex}, ${PageSize}
</select>
<resultMap id="downloadProductSkuBeanList" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
<result column="sku_id" property="SkuID"/>
<result column="sku_id" property="skuOuterID"/>
<result column="retail_price" property="skuprice"/>
<result column="stock_num" property="skuQuantity"/>
</resultMap>
<select id="getDownloadProductSkuBeanList" parameterType="java.lang.String" resultMap="downloadProductSkuBeanList">
SELECT sku_id,stock_num,retail_price FROM sku WHERE im_product_id = #{productId}
</select>
<resultMap id="sku" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
<result column="name" property="skuname"/>
</resultMap>
<select id="getDownloadSkuBean" parameterType="java.lang.String" resultMap="sku">
SELECT concat(concat(n.attr_name,':'),v.attr_value) name FROM attr_ref a
LEFT JOIN attr_value v ON a.attr_value_id = v.value_id
LEFT JOIN attr_name n on v.attr_id = n.attr_id WHERE a.sku_id = #{skuId} AND n.attr_name IS NOT NULL
</select>
<!-- 同步库存 -->
<resultMap id="rs_SkuBean" type="com.sibu.orderHelper.integral.model.SkuBean">
<result property="skuId" column="sku_id" />
<result property="imProductId" column="im_product_id"/>
<result property="erpCode" column="erp_code" />
<result property="stockNum" column="stock_num" />
<result property="exchangeIntegral" column="exchange_integral"/>
<result property="retailPrice" column="retail_price" />
<result property="marketPrice" column="market_price" />
<result property="createDate" column="create_date" />
<result property="updateDate" column="update_date" />
<result property="isShow" column="is_show" />
</resultMap>
<resultMap id="skuApiResponse" type="com.sibu.orderHelper.integral.reponse.SkuApiResponse">
<result property="skuId" column="sku_id" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="erpCode" column="erp_code" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="stockNum" column="stock_num" javaType="java.lang.Integer" jdbcType="INTEGER"/>
<result property="exchangeIntegral" column="exchange_integral" javaType="java.lang.Integer" jdbcType="INTEGER"/>
<result property="memberPrice" column="member_price"/>
<result property="retailPrice" column="retail_price"/>
<result property="marketPrice" column="market_price"/>
<collection property="values" ofType="com.sibu.orderHelper.integral.reponse.SkuValueResponse" column="sku_Id">
<result property="attrValueId" column="attr_value_id" javaType="java.lang.Long" jdbcType="BIGINT"/>
<result property="attrId" column="attr_id" javaType="java.lang.Long" jdbcType="BIGINT"/>
<result property="attrName" column="attr_name" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="valueName" column="attr_value" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="sortIndex" column="sort_index" javaType="java.lang.Integer" jdbcType="TINYINT"/>
</collection>
</resultMap>
<!--根据产品ID与SKUID 查询SKU -->
<select id="getSkuBeanByMap" parameterType="java.util.Map" resultMap="rs_SkuBean">
SELECT * FROM sku where
sku_id = #{skuId} AND im_product_id = #{productId} and is_show =1
</select>
<!-- 查询product sku返回 -->
<select id="getSkuBeanListByMap" parameterType="java.lang.String" resultMap="skuApiResponse">
SELECT s.sku_id,s.erp_code,s.stock_num,s.exchange_integral,s.retail_price,s.market_price,s.member_price,
s.is_show,ref.attr_value_id,n.attr_id,n.attr_name,v.attr_value ,n.sort_index FROM sku s
LEFT JOIN attr_ref ref ON s.sku_id =ref.sku_id
LEFT JOIN attr_value v ON v.value_id =ref.attr_value_id
LEFT JOIN attr_name n ON n.attr_id =v.attr_id
WHERE s.im_product_id =#{productId}
</select>
<!-- 更新SKU-->
<update id="updateSku" parameterType="com.sibu.orderHelper.integral.model.SkuBean">
update sku SET stock_num = #{stockNum} WHERE sku_id = #{skuId}
</update>
<!-- 根据条件查询产品 -->
<sql id="Base_Product_Column">
imp.im_product_id,
imp.name,
imp.short_name,
imp.stock_num,
imp.exchange_integral,
imp.xws_exchange_integral,
imp.sibukg_exchange_integral,
imp.onther1_exchange_integral,
imp.onther2_exchange_integral,
imp.onther3_exchange_integral,
imp.limit_exchange_number,
imp.thumb_img,
imp.is_new,
imp.is_hot,
imp.is_reco,
imp.cost,
imp.attention,
imp.is_show,
imp.product_type,
imp.member_price,
imp.retail_price,
imp.market_price,
imp.is_open_spec,
imp.spec,
imp.mini_purchase_number,
imp.format_str,
imp.share_status,
imp.share_percentage
</sql>
<select id="getIMProductBeanByMap" parameterType="java.util.Map" resultMap="listAPIIMProduct">
SELECT
<include refid="Base_Product_Column" />
FROM
im_product imp,im_product_supplier s
WHERE imp.im_product_id = s.product_id
AND imp.im_product_id = #{productId}
AND s.supplier_id = #{supplierId}
</select>
<select id="getIMProductBeanById" parameterType="java.lang.String" resultMap="listAPIIMProduct">
SELECT
<include refid="Base_Product_Column" />,imp.bar_code
FROM
im_product imp
WHERE imp.im_product_id = #{productId}
</select>
<update id="updateProductInventory" parameterType="com.sibu.orderHelper.integral.model.IMProductInventory">
update im_product_inventory set stock_num=#{stockNum} where im_product_id=#{imProductId}
</update>
<update id="updateProduct" parameterType="java.util.Map">
update im_product set stock_num = #{stockNum} WHERE im_product_id = #{productId}
</update>
<select id="getApiProductDetailById" resultMap="listAPIIMProduct" parameterType="String" useCache="true" statementType="PREPARED">
select imp.im_product_id,
imp.name,
imp.short_name,
imp.stock_num,
imp.details,
imp.exchange_integral,
imp.xws_exchange_integral,
imp.sibukg_exchange_integral,
imp.onther1_exchange_integral,
imp.onther2_exchange_integral,
imp.onther3_exchange_integral,
imp.limit_exchange_number,
imp.thumb_img,
imp.bannel_img1,
imp.bannel_img2,
imp.bannel_img3,
imp.bannel_img4,
imp.bannel_img5,
imp.is_new,
imp.is_hot,
imp.is_reco,
imp.is_show,
imp.product_type,
imp.member_price,
imp.retail_price,
imp.market_price,
imp.is_open_spec,
imp.spec,
imp.mini_purchase_number,
imp.format_str,
imp.erp_code,
imp.is_group,
imp.share_status,
imp.share_percentage,
ipi.attention,
ipi.total_comment_score,
ipi.total_comment_number,
ipi.cost,
imp.delete_flag
FROM im_product imp left join im_product_inventory ipi on imp.im_product_id = ipi.im_product_id
WHERE
imp.im_product_id = #{productId}
</select>
<!-- 订单发货-->
<select id="getOrderByMap" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(*) FROM ${doingOrderTable} WHERE express_code like concat(#{expressCode},'%') AND order_code = #{orderCode}
AND supplier_id = #{supplierId}
</select>
<resultMap type="com.sibu.orderHelper.integral.model.IMDoingOrderBean" id="iMDoingOrderBean2">
<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"/>
</resultMap>
<select id="getOrderListByMap" parameterType="java.util.Map" resultMap="iMDoingOrderBean2">
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 supplier_id = #{supplierId}
</select>
<update id="updateBusinessSend" parameterType="java.util.Map">
UPDATE ${doingOrderTable}
<set>
<if test="buyerUsername !=null and buyerUsername !='' ">
buyer_username =#{buyerUsername},
</if>
<if test="expressCode !=null and expressCode !='' ">
express_code = concat(IFNULL(concat(express_code,','),''),#{expressCode}),
</if>
<if test="buyerPhone !=null and buyerPhone !=''">
buyer_phone = #{buyerPhone},
</if>
<if test="address!=null and address!='' ">
address =#{address},
</if>
<if test="expressName !=null and expressName !='' ">
express_name =#{expressName},
</if>
<if test="province !=null and province !='' ">
province =#{province},
</if>
<if test="city !=null and city !='' ">
city =#{city},
</if>
<if test="area !=null and area !='' ">
area =#{area},
</if>
<if test="buyerUsername !=null and buyerUsername !='' ">
buyer_username =#{buyerUsername},
</if>
<if test="erpImportDt !=null and erpImportDt !='' ">
erp_import_dt =#{erpImportDt},
</if>
<if test="shipDt !=null and shipDt !='' ">
ship_dt =#{shipDt},
</if>
<if test="orderStatus !=null and orderStatus !='' ">
order_status =#{orderStatus},
</if>
erp_import = 1
</set>
WHERE order_code = #{orderCode}
AND supplier_id = #{supplierId}
</update>
<!-- 修改订单备注 -->
<update id="updateSelle" parameterType="java.util.Map">
UPDATE ${doingOrderTable} SET seller_remark = #{sellerRemark} WHERE order_code = #{orderCode}
AND supplier_id = #{supplierId}
</update>
</mapper>