ShareOrderMapper.xml
6.8 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
<?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.ShareOrderDao">
<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>
<insert id="addShareOrder" parameterType="com.sibu.orderHelper.integral.model.IMDoingOrderBean">
insert into t_share_order (
<include refid="Base_DoingOrder_column"/>
) value(
#{orderId},
#{memberId},
#{orderCode},
#{orderStatus},
#{orderFrom},
#{orderPlatform},
#{contact},
#{phone},
#{province},
#{city},
#{area},
#{address},
#{zipcode},
#{totalIntegral},
#{totalMoney},
#{freight},
#{buyerRemark},
#{erpDownload},
#{erpImport},
NOW(),
#{mainOrderCode},
#{deleteFlag},
#{buyerUsername},
#{buyerPhone},
#{expressName},
#{userCouponId},
#{userCouponMoney},
#{deductionVb},
#{deductionMoney},
#{shareMemberId},
#{shareOrderMoney}
)
</insert>
<!-- 添加子订单 -->
<insert id="addShareOrder1" parameterType="java.util.List">
<![CDATA[
insert into t_share_order_product (
order1_id,member_id,order_id,sort_index,product_id,
purchase_quantity,shipped_quantity,integral,line_integral,price,line_price,sku_id,erp_code,spec_detail,name,thumb_img,market_price,
discount_price,discount_line_price,deduction_product_vb,deduction_line_vb,product_share_percentage
) values
]]>
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.order1Id},
#{item.memberId},
#{item.orderId},
#{item.sortIndex},
#{item.productId},
#{item.purchaseQuantity},
#{item.shippedQuantity},
#{item.integral},
#{item.lineIntegral},
#{item.price},
#{item.linePrice},
#{item.skuId},
#{item.erpCode},
#{item.specDetail},
#{item.name},
#{item.thumbImg},
#{item.marketPrice},
#{item.discountPrice},
#{item.discountLinePrice},
#{item.deductionProductVb},
#{item.deductionLineVb},
#{item.productSharePercentage}
)
</foreach>
</insert>
<!--更新分享收益的订单状态-->
<update id="updateShareOrderStatus" parameterType="java.util.Map">
update t_share_order set order_status=#{orderStatus}
<if test="orderStatus == 5">
,receive_dt=now()
</if>
where order_code = #{orderCode} limit 1
</update>
<!--更新分享收益的订单状态-->
<update id="updateOrderStatus" parameterType="java.util.Map">
update t_share_order set order_status=#{orderStatus} where order_code = #{orderCode} limit 1
</update>
<!-- 分页查询订单列表 -->
<select id="listShareOrder" parameterType="map" resultMap="listIMOrderColumn">
select doo.order_id,doo.member_id,doo.order_code,doo.order_status,doo.order_from,
doo.order_platform,doo.contact,doo.phone,doo.total_integral,doo.total_money,doo.freight,doo.create_dt,doo.if_evaluate,doo.share_order_money,doo.receive_dt,
do1.order1_id,do1.product_id,do1.purchase_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price,do1.is_evaluate,do1.spec_detail,
do1.name,do1.thumb_img,do1.market_price,do1.product_share_percentage
from t_share_order_product do1,
(
select do.order_id,do.member_id,do.order_code,do.order_status,do.order_from,
do.order_platform,do.contact,do.phone,do.total_integral,do.total_money-do.freight as total_money,do.freight,do.create_dt,do.if_evaluate,do.share_order_money,do.receive_dt from t_share_order do
where do.share_member_id = #{memberId} AND do.delete_flag=1
<if test="orderStatus == 3">
AND do.order_status = 3
</if>
<if test="orderStatus == 1">
AND do.order_status = 1
</if>
<if test="orderStatus == 5">
AND do.order_status = 5
</if>
<if test="orderStatus == 100">
AND do.order_status = 100
</if>
<if test="orderStatus == 8">
AND do.order_status in (7, 8)
</if>
order by do.create_dt desc
limit ${pageNow}, ${pageSize}
) doo
where doo.order_id=do1.order_id
order by doo.create_dt desc
</select>
<select id="countShareOrder" parameterType="map" resultType="int">
select count(1) from t_share_order where share_member_id = #{memberId} AND delete_flag=1
<if test="orderStatus == 3">
AND order_status = 3
</if>
<if test="orderStatus == 1">
AND order_status = 1
</if>
<if test="orderStatus == 4">
AND order_status = 4
</if>
<if test="orderStatus ==5">
AND order_status = 5
</if>
<if test="orderStatus == 100">
AND order_status =100
</if>
<if test="orderStatus == 8">
AND order_status = 8
</if>
</select>
<resultMap type="com.sibu.orderHelper.integral.reponse.DoingOrderListResponse" id="listIMOrderColumn">
<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="contact" property="contact" />
<result column="phone" property="phone" />
<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="if_evaluate" property="ifEvaluate" />
<result column="receive_dt" property="receiveDt" />
<result column="share_order_money" property="shareOrderMoney" />
<collection property="order1s" column="order_id" ofType="com.sibu.orderHelper.integral.reponse.DoingOrder1DetailResponse">
<id 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="is_evaluate" property="isEvaluate" />
<result column="spec_detail" property="specDetail"/>
<result column="name" property="name" />
<result column="market_price" property="marketPrice" />
<result column="thumb_img" property="thumbImg" />
<result column="product_share_percentage" property="productSharePercentage" />
</collection>
</resultMap>
</mapper>