WebShareOrderMapper.xml
4.7 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
<?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.WebShareOrderDao">
<sql id="Base_DoingOrder_column">
order_id,member_id,order_code,order_status,order_from,
order_platform,contact,phone,province,city,
area,address,zipcode,total_integral,total_money,freight,buyer_remark,
erp_download,erp_import,create_dt,main_order_code,delete_flag,buyer_username,buyer_phone,express_name,
user_coupon_id,user_coupon_money,deduction_vb,deduction_money,share_member_id,share_order_money
</sql>
<sql id="Base_DoingOrder1_column">
order1_id,member_id,order_id,sort_index,product_id,
purchase_quantity,shipped_quantity,integral,line_integral,price,line_price
</sql>
<resultMap type="com.sibu.orderHelper.integral.reponse.ShareRewardOrderResponse" id="listIMOrderColumn">
<id column="id" property="id" />
<result column="share_user_id" property="shareUserId" />
<result column="buyer_user_id" property="buyerUserId" />
<result column="order_id" property="orderId" />
<result column="order_code" property="orderCode" />
<result column="profit_money" property="profitMoney" />
<result column="refund_money" property="refundMoney" />
<result column="profit_status" property="profitStatus" />
<result column="product_id" property="productId" />
<result column="product_price" property="productPrice" />
<result column="product_share_percentage" property="productSharePercentage" />
<result column="product_amount" property="productAmount" />
<result column="profit_dt" property="profitDt" />
<result column="order_dt" property="orderDt" />
<result column="refund_dt" property="refundDt" />
<result column="create_dt" property="createDt" />
<result column="update_dt" property="updateDt" />
<result column="settlement_dt" property="settlementDt" />
<result column="phone" property="shareUserPhone" />
<result column="true_name" property="shareUserName" />
<result column="nick_name" property="nickName" />
<result column="line_price" property="linePrice" />
<result column="discount_line_price" property="discountLinePrice" />
<result column="receive_dt" property="receiveDt" />
<result column="create_dt" property="orderCreateDt" />
<result column="order_status" property="orderStatus" />
</resultMap>
<!-- 分页查询分享奖励订单列表 -->
<select id="listShareRewardOrder" parameterType="map" resultMap="listIMOrderColumn">
SELECT spr.*,m.phone,m.true_name,m.nick_name,sop.discount_line_price,sop.line_price,so.receive_dt,so.create_dt,so.order_status
FROM t_share_order_product sop
LEFT JOIN t_share_order so ON sop.order_id=so.order_id
LEFT JOIN t_share_profit_record spr ON so.order_id=spr.`order_id`
LEFT JOIN t_member_info m ON so.member_id=m.member_id
WHERE so.delete_flag=1
<if test="phone != null and phone != ''">
AND m.phone like concat('%',#{phone},'%')
</if>
<if test="orderCode != null and orderCode != ''">
AND spr.order_code = #{orderCode}
</if>
<if test="startOrderDt != null and startOrderDt !=''">
and spr.order_dt >= #{startOrderDt}
</if>
<if test="endOrderDt != null and endOrderDt != ''">
<![CDATA[
and spr.order_dt <= #{endOrderDt}
]]>
</if>
<if test="startReceiveDt != null and startReceiveDt !=''">
and so.receive_dt >= #{startReceiveDt}
</if>
<if test="endReceiveDt != null and endReceiveDt != ''">
<![CDATA[
and so.receive_dt <= #{endReceiveDt}
]]>
</if>
order by spr.create_dt desc
limit ${pageNow}, ${pageSize}
</select>
<select id="countShareRewardOrder" parameterType="map" resultType="java.lang.Integer">
select count(1)
FROM t_share_order_product sop
INNER JOIN t_share_order so ON sop.order_id=so.order_id
INNER JOIN t_share_profit_record spr ON so.order_id=spr.`order_id`
INNER JOIN t_member_info m ON spr.share_user_id=m.member_id
WHERE so.delete_flag=1
<if test="phone != null and phone != ''">
AND m.phone like concat('%',#{phone},'%')
</if>
<if test="orderCode != null and orderCode != ''">
AND spr.order_code = #{orderCode}
</if>
<if test="startOrderDt != null and startOrderDt !=''">
and spr.order_dt >= #{startOrderDt}
</if>
<if test="endOrderDt != null and endOrderDt != ''">
<![CDATA[
and spr.order_dt <= #{endOrderDt}
]]>
</if>
<if test="startReceiveDt != null and startReceiveDt !=''">
and so.receive_dt >= #{startReceiveDt}
</if>
<if test="endReceiveDt != null and endReceiveDt != ''">
<![CDATA[
and so.receive_dt <= #{endReceiveDt}
]]>
</if>
</select>
<update id="updateShareOrderByOrderCode" parameterType="map">
UPDATE t_share_order SET order_status=#{orderStatus} WHERE order_code = #{orderCode}
</update>
</mapper>