MemberReadMapper.xml
20.3 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
<?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.mall.member.read.MemberReadDao">
<select id="count" resultType="java.lang.Integer">
select count(*) from member
</select>
<!-- 订单实体 -->
<resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="changeName" column="change_name" />
<result property="phone" column="phone" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="number" column="number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="regionName1" column="regionName1" />
<result property="regionName2" column="regionName2" />
<result property="regionName3" column="regionName3" />
<result property="orderState" column="order_state" />
<result property="moneyOrder" column="money_order" />
<result property="moneyPaidBalance" column="money_paid_balance" />
<result property="moneyCoupon" column="money_coupon" />
<result property="moneyLogistics" column="money_logistics" />
<result property="moneyProduct" column="money_product" />
<result property="moneyActFull" column="money_act_full" />
<result property="moneyDiscount" column="money_discount" />
<result property="moneyBack" column="money_back" />
<result property="moneyIntegral" column="money_integral" />
<result property="payTime" column="pay_time" />
</resultMap>
<!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
<select id="getOrdersByMap" parameterType="java.util.Map" resultMap="orders">
select * from orders where order_sn=#{orderSn,jdbcType=VARCHAR} AND seller_id=#{sellerId,jdbcType=INTEGER} AND is_parent = 0
</select>
<!-- 订单发货-->
<!-- 验证订单号是否已存在-->
<select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
</select>
<!-- 商品下载实体-->
<resultMap id="downloadProductBean" type="com.sibu.orderHelper.integral.model.DownloadProductBean">
<result column="id" property="PlatProductID"/>
<result column="productName" property="name"/>
<result column="outerID" property="OuterID"/>
<result column="price" property="price"/>
<result column="num" property="num"/>
<result column="pictureurl" property="pictureurl"/>
</resultMap>
<!-- 商品下载 -->
<select id="downloadProductListByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
p.mal_mobile_price AS price
FROM product p WHERE p.seller_id = #{sellerId}
<if test="productId !=null and productId !=''">
AND (p.id = #{productId} or p.product_code = #{productId})
</if>
<if test="state !=null and state !='' and state != -1">
AND p.state = #{state}
</if>
<if test="state !=null and state !='' and state == -1">
AND p.state IN ('6','7')
</if>
<if test="productName !=null and productName !=''">
AND p.name1 = #{productName}
</if>
ORDER BY p.update_time DESC
limit ${PageIndex}, ${PageSize}
</select>
<!-- 根据条件查询商品 -->
<select id="getDownloadProductBeanByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
p.mal_mobile_price AS price
FROM product p WHERE p.seller_id = #{sellerId}
<if test="productId !=null and productId !=''">
AND p.id = #{productId}
</if>
</select>
<!-- 商品下载总数量 -->
<select id="countDownloadProductListByMap" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*)
FROM product p WHERE p.seller_id = #{sellerId}
<if test="productId !=null and productId !=''">
AND (p.id = #{productId} or p.product_code = #{productId})
</if>
<if test="state !=null and state !='' and state != -1">
AND p.state = #{state}
</if>
<if test="state !=null and state !='' and state == -1">
AND p.state IN ('6','7')
</if>
<if test="productName !=null and productName !=''">
AND p.name1 = #{productName}
</if>
</select>
<!-- 商品sku实体 -->
<resultMap id="downloadSku" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
<result column="skuId" property="SkuID"/>
<result column="skuId" property="skuOuterID"/>
<result column="skuprice" property="skuprice"/>
<result column="skuQuantity" property="skuQuantity"/>
<result column="skuname" property="skuname"/>
<result column="skupictureurl" property="skupictureurl"/>
</resultMap>
<!-- 获取商品sku -->
<select id="downloadSkuByProductId" resultType="java.lang.String" resultMap="downloadSku">
select g.sku AS skuId,g.mall_mobile_price AS skuprice,g.product_stock AS skuQuantity,
g.norm_name AS skuname ,g.images AS skupictureurl FROM product_goods g
WHERE g.product_id = #{productId}
</select>
<!-- 主订单下载-->
<select id="getOrdersList" parameterType="java.util.Map" resultMap="orders">
select o.order_sn,o.order_state,o.remark,o.create_time,p.regionName AS regionName1,
c.regionName AS regionName2,a.regionName AS regionName3,
o.address_info,o.mobile,o.zip_code,o.zip_code,o.money_logistics,o.money_product-o.money_order-o.money_logistics AS couponMoney,
o.money_order,o.money_product,o.pay_time,o.member_name FROM orders o
LEFT JOIN regions p ON p.id = o.province_id
LEFT JOIN regions c ON c.id = o.city_id
LEFT JOIN regions a ON a.id = o.area_id
WHERE o.is_parent = 0
AND o.seller_id = #{sellerId}
<if test="orderState!=null and orderState!=''">
AND o.order_state in
<foreach collection="orderState" item="state" open="(" close=")" separator=",">
#{state}
</foreach>
</if>
<if test="orderSn!=null and orderSn!=''">
AND o.order_sn = #{orderSn}
</if>
<if test="startTime!=null and startTime!=''">
AND o.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
<![CDATA[
and o.create_time <= #{endTime}
]]>
</if>
ORDER BY o.create_time DESC
limit ${PageIndex}, ${PageSize}
</select>
<!-- 订单下载总数-->
<select id="countgetOrdersList" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) FROM orders o
WHERE o.is_parent = 0
AND o.seller_id = #{sellerId}
<if test="orderState!=null and orderState!=''">
AND o.order_state in
<foreach collection="orderState" item="state" open="(" close=")" separator=",">
#{state}
</foreach>
</if>
<if test="orderSn!=null and orderSn!=''">
AND o.order_sn = #{orderSn}
</if>
<if test="startTime!=null and startTime!=''">
AND o.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
<![CDATA[
and o.create_time <= #{endTime}
]]>
</if>
</select>
<!-- 子订单实体-->
<resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct">
<result property="id" column="id" />
<result property="ordersId" column="orders_id" />
<result property="ordersSn" column="orders_sn" />
<result property="ordersPsn" column="orders_psn" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="productCateId" column="product_cate_id" />
<result property="productId" column="product_id" />
<result property="productGoodsId" column="product_goods_id" />
<result property="specInfo" column="spec_info" />
<result property="productName" column="product_name" />
<result property="productSku" column="product_sku" />
<result property="packageGroupsId" column="package_groups_id" />
<result property="mallGroupsId" column="mall_groups_id" />
<result property="giftId" column="gift_id" />
<result property="isGift" column="is_gift" />
<result property="moneyPrice" column="money_price" />
<result property="number" column="number" />
<result property="moneyAmount" column="money_amount" />
<result property="moneyActSingle" column="money_act_single" />
<result property="actSingleId" column="act_single_id" />
<result property="actGroupId" column="act_group_id" />
<result property="actFlashSaleId" column="act_flash_sale_id" />
<result property="actFlashSaleProductId" column="act_flash_sale_product_id" />
<result property="actBiddingId" column="act_bidding_id" />
<result property="actIntegralId" column="act_integral_id" />
<result property="actIntegralNum" column="act_integral_num" />
<result property="actIntegralMoney" column="act_integral_money" />
<result property="systemRemark" column="system_remark" />
<result property="backNumber" column="back_number" />
<result property="exchangeNumber" column="exchange_number" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isEvaluate" column="is_evaluate" />
</resultMap>
<!-- 查询子订单-->
<select id="getOrdersProductList" resultType="java.lang.String" resultMap="ordersProduct">
SELECT product_sku,id,product_name,spec_info,number,money_price,money_act_single FROM orders_product
WHERE orders_sn = #{orderSn}
</select>
<!-- 地址实体类-->
<resultMap id="regionsResult" type="com.sibu.orderHelper.integral.pineapple.model.Regions">
<result property="id" column="id" />
<result property="parentId" column="parentId" />
<result property="regionName" column="regionName" />
<result property="parentPath" column="parentPath" />
<result property="firstLetter" column="firstLetter" />
<result property="regionType" column="regionType" />
<result property="agencyId" column="agencyId" />
<result property="shippingId" column="shippingId" />
<result property="visible" column="visible" />
<result property="rowId" column="rowId" />
</resultMap>
<!-- 根据条件查询省市级信息-->
<select id="getRegionsByMap" parameterType="java.util.Map" resultMap="regionsResult">
SELECT * FROM regions WHERE regionName LIKE concat('%',#{name},'%') AND regionType = #{regionType}
</select>
<!-- 根据id查询省市级信息-->
<select id="getRegionsById" parameterType="java.lang.Integer" resultMap="regionsResult">
select
*
from `regions`
where `id` = #{id}
</select>
<!-- 物流公司实体-->
<resultMap id="courierCompanyResult" type="com.sibu.orderHelper.integral.pineapple.model.CourierCompany">
<result property="id" column="id" />
<result property="createTime" column="create_time" />
<result property="state" column="state" />
<result property="companyMark" column="company_mark" />
<result property="companyName" column="company_name" />
<result property="seq" column="seq" />
<result property="sellerId" column="seller_id" />
<result property="companyType" column="company_type" />
<result property="imagePath" column="image_path" />
<result property="content" column="content" />
</resultMap>
<!-- 根据条件查询物流公司-->
<select id="getCourierCompanyByName" parameterType="java.util.Map" resultMap="courierCompanyResult">
select
*
from `courier_company`
where company_name LIKE concat('%',#{name},'%') AND seller_id =#{sellerId}
</select>
<!--退货表实体-->
<resultMap id="memberProductBackResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductBack">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="contactPhone" column="contact_phone" />
<result property="contactName" column="contact_name" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="stateReturn" column="state_return" />
<result property="stateMoney" column="state_money" />
<result property="number" column="number" />
<result property="backMoney" column="back_money" />
<result property="backIntegral" column="back_integral" />
<result property="backIntegralMoney" column="back_integral_money" />
<result property="backCouponUserId" column="back_coupon_user_id" />
<result property="backMoneyTime" column="back_money_time" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<!--根据订单号查询换货信息-->
<select id="getMemberProductBackByOrderSn" parameterType="java.lang.String" resultMap="memberProductBackResult">
SELECT * FROM member_product_back WHERE order_sn = #{orderSn} AND state_return IN ('1','2','3','4') ORDER BY create_time
</select>
<!--换货实体类-->
<resultMap id="memberProductExchangeResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="changeName" column="change_name" />
<result property="phone" column="phone" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="provinceId2" column="province_id2" />
<result property="cityId2" column="city_id2" />
<result property="areaId2" column="area_id2" />
<result property="addressAll2" column="address_all2" />
<result property="addressInfo2" column="address_info2" />
<result property="zipCode2" column="zip_code2" />
<result property="changeName2" column="change_name2" />
<result property="phone2" column="phone2" />
<result property="logisticsId2" column="logistics_id2" />
<result property="logisticsName2" column="logistics_name2" />
<result property="logisticsMark2" column="logistics_mark2" />
<result property="logisticsNumber2" column="logistics_number2" />
<result property="number" column="number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<!--根据订单号查询换货信息-->
<select id="getMemberProductExchangeByOrderSn" parameterType="java.lang.String" resultMap="memberProductExchangeResult">
SELECT * FROM member_product_exchange WHERE order_sn = #{orderSn} AND state IN ('1','2','3','4') ORDER BY create_time
</select>
<!-- 投诉表实体-->
<resultMap id="sellerComplaintResult" type="com.sibu.orderHelper.integral.pineapple.model.SellerComplaint">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="orderId" column="order_id" />
<result property="orderProductId" column="order_product_id" />
<result property="productBackId" column="product_back_id" />
<result property="productExchangeId" column="product_exchange_id" />
<result property="content" column="content" />
<result property="image" column="image" />
<result property="complaintTime" column="complaint_time" />
<result property="sellerId" column="seller_id" />
<result property="sellerComplaintTime" column="seller_complaint_time" />
<result property="sellerCompContent" column="seller_comp_content" />
<result property="sellerCompImage" column="seller_comp_image" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optContent" column="opt_content" />
<result property="userContent" column="user_content" />
<result property="createTime" column="create_time" />
<result property="optTime" column="opt_time" />
</resultMap>
<!-- 根据条件查询投诉表-->
<select id="getSellerComplaintById" parameterType="java.lang.Integer" resultMap="sellerComplaintResult">
SELECT * FROM seller_complaint WHERE order_id = #{orderId} AND state IN (1,3,4) ORDER BY create_time
</select>
<select id="findByAppIdAndAppType" resultMap="BaseResultMap">
select * from im_supplier_app where app_id=#{appId} and app_type = #{appType} and app_token = #{appToken}
</select>
<resultMap id="BaseResultMap" type="com.sibu.orderHelper.integral.model.IMSupplierApp">
<result column="id" property="id"/>
<result column="supplier_id" property="supplierId"/>
<result column="app_id" property="appId"/>
<result column="app_type" property="appType"/>
<result column="app_token" property="appToken"/>
<result column="app_secret" property="appSecret"/>
</resultMap>
<select id="findByIdIn" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT
*
FROM im_supplier
where id in
<foreach collection="supplierIds" item="supplierId" open="(" close=")" separator=",">
#{supplierId}
</foreach>
</select>
<select id="getSeller" parameterType="java.lang.String" resultType="com.sibu.orderHelper.integral.pineapple.model.Seller">
select * from seller
where `id` = #{id}
</select>
</mapper>