IMRefundOrderMapper.xml
14.5 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
<?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.IMRefundOrderDao">
<select id="countRefundingOrderByOrderId" resultType="java.lang.Integer">
select count(*) from im_order_refund where
order_id = #{orderId} and refund_status != 7 and refund_status != 100 and refund_status != 101
</select>
<select id="findRefundMoneyAndGoodsAndDisagreeRefundMoneyStatusRefundOrders"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from im_order_refund where
refund_status = 0
and refund_type = 2
and refund_status_last_update_dt is not null
and refund_status_last_update_dt < date_add(now(),interval -7 day);
</select>
<select id="findRefundMoneyAndGoodsAndDisagreeRefundGoodsStatusRefundOrders"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from im_order_refund where
refund_status = 8
and refund_type = 2
and refund_status_last_update_dt is not null
and refund_status_last_update_dt < date_add(now(),interval -7 day);
</select>
<select id="findRefundMoneyAndDisagreeRefundMoneyStatusRefundOrders"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from im_order_refund where
refund_status = 0
and refund_type in (1,3)
and refund_status_last_update_dt is not null
and refund_status_last_update_dt < date_add(now(),interval -3 day);
</select>
<update id="updateStatus">
update im_order_refund set refund_status = #{newStatus} where refund_status= #{oldStatus} and refund_id = #{refundId}
</update>
<resultMap id="BaseResultMap" type="com.sibu.orderHelper.integral.model.IMOrderRefundBean">
<id column="refund_id" jdbcType="VARCHAR" property="refundId"/>
<result column="refund_code" jdbcType="VARCHAR" property="refundCode"/>
<result column="order_id" jdbcType="VARCHAR" property="orderId"/>
<result column="order_code" jdbcType="VARCHAR" property="orderCode"/>
<result column="order_from" jdbcType="TINYINT" property="orderFrom"/>
<result column="member_id" jdbcType="VARCHAR" property="memberId"/>
<result column="refund_type" jdbcType="INTEGER" property="refundType"/>
<result column="refund_goods_status" jdbcType="INTEGER" property="refundGoodsStatus"/>
<result column="refund_reason_id" jdbcType="INTEGER" property="refundReasonId"/>
<result column="refund_reason" jdbcType="VARCHAR" property="refundReason"/>
<result column="refund_money" jdbcType="DECIMAL" property="refundMoney"/>
<result column="order_money" jdbcType="DECIMAL" property="orderMoney"/>
<result column="refund_remark" jdbcType="VARCHAR" property="refundRemark"/>
<result column="refund_status" jdbcType="INTEGER" property="refundStatus"/>
<result column="refund_status_last_update_dt" jdbcType="TIMESTAMP" property="refundStatusLastUpdateDt"/>
<result column="apply_date" jdbcType="TIMESTAMP" property="applyDate"/>
<result column="refund_money_success_flag" jdbcType="BIT" property="refundMoneySuccessFlag"/>
<result column="refund_date" jdbcType="TIMESTAMP" property="refundDate"/>
<result column="buyer_username" jdbcType="VARCHAR" property="buyerUsername"/>
<result column="buyer_phone" jdbcType="VARCHAR" property="buyerPhone"/>
<result column="refund_seller_phone" jdbcType="VARCHAR" property="refundSellerPhone"/>
<result column="refund_seller_address" jdbcType="VARCHAR" property="refundSellerAddress"/>
<result column="refund_seller_name" jdbcType="VARCHAR" property="refundSellerName"/>
<result column="finish_date" jdbcType="TIMESTAMP" property="finishDate"/>
<result column="refund_integral" jdbcType="BIGINT" property="refundIntegral"/>
<result column="refund_goods_deliver_id" jdbcType="TINYINT" property="refundGoodsDeliverId"/>
<result column="refund_goods_deliver_name" jdbcType="VARCHAR" property="refundGoodsDeliverName"/>
<result column="refund_goods_waybill" jdbcType="VARCHAR" property="refundGoodsWaybill"/>
<result column="refund_goods_remark" jdbcType="VARCHAR" property="refundGoodsRemark"/>
<result column="refund_tips" jdbcType="VARCHAR" property="refundTips"/>
<result column="receive_goods_flag" jdbcType="BIT" property="receiveGoodsFlag"/>
<result column="receive_goods_dt" jdbcType="TIMESTAMP" property="receiveGoodsDt"/>
</resultMap>
<sql id="Base_Column_List">
refund_id, refund_code, order_id, order_code, order_from, member_id, refund_type,
refund_goods_status, refund_reason_id, refund_reason, refund_money, order_money,
refund_remark, refund_status, refund_status_last_update_dt, apply_date, refund_money_success_flag,
refund_date, buyer_username, buyer_phone, refund_seller_phone, refund_seller_address,
refund_seller_name, finish_date, refund_integral, refund_goods_deliver_id, refund_goods_deliver_name,
refund_goods_waybill, refund_goods_remark, refund_tips, receive_goods_flag, receive_goods_dt
</sql>
<select id="list" resultMap="BaseResultMap"
parameterType="com.sibu.orderHelper.integral.request.RefundListPagerRequest">
select
<include refid="Base_Column_List"/>
from im_order_refund
where member_id = #{memberId}
order by apply_date desc
limit ${pageNow}, ${pageSize}
</select>
<select id="countList" resultType="java.lang.Integer"
parameterType="com.sibu.orderHelper.integral.request.RefundListPagerRequest">
select count(*) from im_order_refund where member_id = #{memberId}
</select>
<sql id="refund_order_column">
refund_id,refund_code,order_id,order_code,member_id,refund_type,refund_reason,
refund_money,order_money,refund_remark,apply_date,buyer_username,buyer_phone
</sql>
<select id="findOneByRefundIdAndMemberId" resultMap="BaseResultMap">
select * from im_order_refund where refund_id = #{refundId} and member_id = #{memberId}
</select>
<select id="findOneByRefundId" resultMap="BaseResultMap">
select * from im_order_refund where refund_id = #{refundId}
</select>
<insert id="addRefundOrder" parameterType="IMOrderRefundBean">
insert into im_order_refund(<include refid="refund_order_column"/>)
value(
#{refundId},
#{refundCode},
#{orderId},
#{orderCode},
#{memberId},
#{refundType},
#{refundReason},
#{refundMoney},
#{orderMoney},
#{refundRemark},
NOW(),
#{buyerUsername},
${buyerPhone}
)
</insert>
<insert id="insert" parameterType="com.sibu.orderHelper.integral.model.IMOrderRefundBean">
insert into im_order_refund (refund_id, refund_code, order_id,
order_code, order_from, member_id,
refund_type, refund_goods_status, refund_reason_id,
refund_reason, refund_money, order_money,
refund_remark, refund_status, refund_status_last_update_dt,
apply_date, refund_money_success_flag, refund_date,
buyer_username, buyer_phone, refund_seller_phone,
refund_seller_address, refund_seller_name,
finish_date, refund_integral, refund_goods_deliver_id,
refund_goods_deliver_name, refund_goods_waybill,
refund_goods_remark, refund_tips, receive_goods_flag,
receive_goods_dt)
values (#{refundId,jdbcType=VARCHAR}, #{refundCode,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR},
#{orderCode,jdbcType=VARCHAR}, #{orderFrom,jdbcType=TINYINT}, #{memberId,jdbcType=VARCHAR},
#{refundType,jdbcType=INTEGER}, #{refundGoodsStatus,jdbcType=INTEGER}, #{refundReasonId,jdbcType=INTEGER},
#{refundReason,jdbcType=VARCHAR}, #{refundMoney,jdbcType=DECIMAL}, #{orderMoney,jdbcType=DECIMAL},
#{refundRemark,jdbcType=VARCHAR}, #{refundStatus,jdbcType=INTEGER}, #{refundStatusLastUpdateDt,jdbcType=TIMESTAMP},
#{applyDate,jdbcType=TIMESTAMP}, #{refundMoneySuccessFlag,jdbcType=BIT}, #{refundDate,jdbcType=TIMESTAMP},
#{buyerUsername,jdbcType=VARCHAR}, #{buyerPhone,jdbcType=VARCHAR}, #{refundSellerPhone,jdbcType=VARCHAR},
#{refundSellerAddress,jdbcType=VARCHAR}, #{refundSellerName,jdbcType=VARCHAR},
#{finishDate,jdbcType=TIMESTAMP}, #{refundIntegral,jdbcType=BIGINT}, #{refundGoodsDeliverId,jdbcType=TINYINT},
#{refundGoodsDeliverName,jdbcType=VARCHAR}, #{refundGoodsWaybill,jdbcType=VARCHAR},
#{refundGoodsRemark,jdbcType=VARCHAR}, #{refundTips,jdbcType=VARCHAR}, #{receiveGoodsFlag,jdbcType=BIT},
#{receiveGoodsDt,jdbcType=TIMESTAMP})
</insert>
<update id="updateDeliveryInfoByRefundIdAndMemberId"
parameterType="com.sibu.orderHelper.integral.request.UpdateDeliveryInfoRequest">
update im_order_refund set
refund_goods_deliver_id=#{deliverId},
refund_goods_deliver_name=#{deliverName},
refund_goods_waybill=#{waybill},
refund_goods_remark=#{remark}
where refund_id = #{refundId} and member_id = #{memberId}
</update>
<update id="updateRefundStatusByRefundIdAndMemberId">
update im_order_refund set
refund_status=#{refundStatus}
where refund_id = #{refundId} and member_id = #{memberId}
</update>
<update id="updateByPrimaryKey" parameterType="com.sibu.orderHelper.integral.model.IMOrderRefundBean">
update im_order_refund
<set>
<if test="refundCode != null">
refund_code = #{refundCode,jdbcType=VARCHAR},
</if>
<if test="orderId != null">
order_id = #{orderId,jdbcType=VARCHAR},
</if>
<if test="orderCode != null">
order_code = #{orderCode,jdbcType=VARCHAR},
</if>
<if test="orderFrom != null">
order_from = #{orderFrom,jdbcType=TINYINT},
</if>
<if test="memberId != null">
member_id = #{memberId,jdbcType=VARCHAR},
</if>
<if test="refundType != null">
refund_type = #{refundType,jdbcType=INTEGER},
</if>
<if test="refundGoodsStatus != null">
refund_goods_status = #{refundGoodsStatus,jdbcType=INTEGER},
</if>
<if test="refundReasonId != null">
refund_reason_id = #{refundReasonId,jdbcType=INTEGER},
</if>
<if test="refundReason != null">
refund_reason = #{refundReason,jdbcType=VARCHAR},
</if>
<if test="refundMoney != null">
refund_money = #{refundMoney,jdbcType=DECIMAL},
</if>
<if test="orderMoney != null">
order_money = #{orderMoney,jdbcType=DECIMAL},
</if>
<if test="refundRemark != null">
refund_remark = #{refundRemark,jdbcType=VARCHAR},
</if>
<if test="refundStatus != null">
refund_status = #{refundStatus,jdbcType=INTEGER},
</if>
<if test="refundStatusLastUpdateDt != null">
refund_status_last_update_dt = #{refundStatusLastUpdateDt,jdbcType=TIMESTAMP},
</if>
<if test="applyDate != null">
apply_date = #{applyDate,jdbcType=TIMESTAMP},
</if>
<if test="refundMoneySuccessFlag != null">
refund_money_success_flag = #{refundMoneySuccessFlag,jdbcType=BIT},
</if>
<if test="refundDate != null">
refund_date = #{refundDate,jdbcType=TIMESTAMP},
</if>
<if test="buyerUsername != null">
buyer_username = #{buyerUsername,jdbcType=VARCHAR},
</if>
<if test="buyerPhone != null">
buyer_phone = #{buyerPhone,jdbcType=VARCHAR},
</if>
<if test="refundSellerPhone != null">
refund_seller_phone = #{refundSellerPhone,jdbcType=VARCHAR},
</if>
<if test="refundSellerAddress != null">
refund_seller_address = #{refundSellerAddress,jdbcType=VARCHAR},
</if>
<if test="refundSellerName != null">
refund_seller_name = #{refundSellerName,jdbcType=VARCHAR},
</if>
<if test="finishDate != null">
finish_date = #{finishDate,jdbcType=TIMESTAMP},
</if>
<if test="refundIntegral != null">
refund_integral = #{refundIntegral,jdbcType=BIGINT},
</if>
<if test="refundGoodsDeliverId != null">
refund_goods_deliver_id = #{refundGoodsDeliverId,jdbcType=TINYINT},
</if>
<if test="refundGoodsDeliverName != null">
refund_goods_deliver_name = #{refundGoodsDeliverName,jdbcType=VARCHAR},
</if>
<if test="refundGoodsWaybill != null">
refund_goods_waybill = #{refundGoodsWaybill,jdbcType=VARCHAR},
</if>
<if test="refundGoodsRemark != null">
refund_goods_remark = #{refundGoodsRemark,jdbcType=VARCHAR},
</if>
<if test="refundTips != null">
refund_tips = #{refundTips,jdbcType=VARCHAR},
</if>
<if test="receiveGoodsFlag != null">
receive_goods_flag = #{receiveGoodsFlag,jdbcType=BIT},
</if>
<if test="receiveGoodsDt != null">
receive_goods_dt = #{receiveGoodsDt,jdbcType=TIMESTAMP},
</if>
</set>
where refund_id = #{refundId,jdbcType=VARCHAR}
</update>
<select id="getRefundRecodeResult" parameterType="java.util.Map" resultType="String">
select operator_remark from im_refund_procedure_record where refund_id = #{refundId}
</select>
<select id="statisticsRefundingNum" resultType="java.lang.Integer">
select count(*) from im_order_refund where member_id = #{memberId} and refund_status != 7 and refund_status != 100 and refund_status != 101
</select>
<select id="countOrderItemNotFinishHistory" resultType="java.lang.Integer">
select count(*) from im_order_refund of
inner join im_refund_order_item ofitem
on of.order_id=#{orderId}
and of.refund_status != 7 and of.refund_status != 100 and of.refund_status != 101
and ofitem.order1_id=#{order1Id}
and of.refund_id = ofitem.refund_id
</select>
</mapper>