AppraiseOrderMapper.xml
10.1 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
<?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.yohoufo.dal.order.AppraiseOrderMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.AppraiseOrder">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="uid" jdbcType="INTEGER" property="uid" />
<result column="parent_order_code" jdbcType="BIGINT" property="parentOrderCode" />
<result column="order_code" jdbcType="BIGINT" property="orderCode" />
<result column="client_type" jdbcType="TINYINT" property="clientType" />
<result column="payment" jdbcType="TINYINT" property="payment" />
<result column="amount" jdbcType="DECIMAL" property="amount" />
<result column="ship_fee" jdbcType="DECIMAL" property="shipFee" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="create_time" jdbcType="INTEGER" property="createTime" />
<result column="update_time" jdbcType="INTEGER" property="updateTime" />
<result column="is_del" jdbcType="TINYINT" property="isDel" />
<result column="channel_no" jdbcType="VARCHAR" property="channelNo" />
<result column="attributes" jdbcType="INTEGER" property="attributes" />
<result column="platform_delivery_status" jdbcType="TINYINT" property="platformDeliveryStatus" />
<result column="status_cnt" jdbcType="INTEGER" property="statusCnt"/>
</resultMap>
<sql id="Base_Column_List">
id, uid, parent_order_code, order_code, client_type, payment, amount, ship_fee, status,
create_time, update_time, is_del, channel_no, attributes, platform_delivery_status
</sql>
<select id="selectSubOrderList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order
where parent_order_code = #{parentOrderCode,jdbcType=INTEGER}
order by id
limit #{offset},#{limit}
</select>
<select id="selectSubOrderCntIncludeStatus" resultType="java.lang.Integer">
select count(*) from appraise_order
where parent_order_code = #{parentOrderCode,jdbcType=INTEGER}
and status in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status,jdbcType=TINYINT}
</foreach>
</select>
<select id="selectSubOrderCnt" parameterType="java.lang.Long" resultType="java.lang.Integer">
select count(*) from appraise_order
where parent_order_code = #{parentOrderCode,jdbcType=INTEGER}
</select>
<select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order
where order_code = #{orderCode,jdbcType=INTEGER}
</select>
<select id="selectCntByOrderType" resultType="java.lang.Integer">
select count(*) from appraise_order
where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER}
and is_del = 1
and status in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status,jdbcType=TINYINT}
</foreach>
<if test="parentOnly">
and parent_order_code is null
</if>
</select>
<select id="selectOrderListByOrderType" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order
where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER}
and is_del = 1
and status in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status,jdbcType=TINYINT}
</foreach>
<if test="parentOnly">
and parent_order_code is null
</if>
order by id desc limit #{offset},#{limit}
</select>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrder" useGeneratedKeys="true">
insert into appraise_order (uid, parent_order_code, order_code,
client_type, payment, amount,
ship_fee, status, create_time,
update_time, is_del, channel_no,
attributes, platform_delivery_status)
values (#{uid,jdbcType=INTEGER}, #{parentOrderCode,jdbcType=BIGINT}, #{orderCode,jdbcType=BIGINT},
#{clientType,jdbcType=TINYINT}, #{payment,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL},
#{shipFee,jdbcType=DECIMAL}, #{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER},
#{updateTime,jdbcType=INTEGER}, #{isDel,jdbcType=TINYINT}, #{channelNo,jdbcType=VARCHAR},
#{attributes,jdbcType=INTEGER}, #{platformDeliveryStatus,jdbcType=TINYINT})
</insert>
<insert id="insertBatch" >
insert into appraise_order (uid, parent_order_code, order_code,
client_type, payment, amount,
ship_fee, status, create_time,
update_time, is_del, channel_no,
attributes, platform_delivery_status)
values
<foreach collection="records" item="record" separator=",">
(
#{record.uid,jdbcType=INTEGER},
#{record.parentOrderCode,jdbcType=BIGINT},
#{record.orderCode,jdbcType=BIGINT},
#{record.clientType,jdbcType=TINYINT},
#{record.payment,jdbcType=TINYINT},
#{record.amount,jdbcType=DECIMAL},
#{record.shipFee,jdbcType=DECIMAL},
#{record.status,jdbcType=TINYINT},
#{record.createTime,jdbcType=INTEGER},
#{record.updateTime,jdbcType=INTEGER},
#{record.isDel,jdbcType=TINYINT},
#{record.channelNo,jdbcType=VARCHAR},
#{record.attributes,jdbcType=INTEGER},
#{record.platformDeliveryStatus,jdbcType=TINYINT}
)
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrder" useGeneratedKeys="true">
insert into appraise_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">
uid,
</if>
<if test="parentOrderCode != null">
parent_order_code,
</if>
<if test="orderCode != null">
order_code,
</if>
<if test="clientType != null">
client_type,
</if>
<if test="payment != null">
payment,
</if>
<if test="amount != null">
amount,
</if>
<if test="shipFee != null">
ship_fee,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="isDel != null">
is_del,
</if>
<if test="channelNo != null">
channel_no,
</if>
<if test="attributes != null">
attributes,
</if>
<if test="platformDeliveryStatus != null">
platform_delivery_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">
#{uid,jdbcType=INTEGER},
</if>
<if test="parentOrderCode != null">
#{parentOrderCode,jdbcType=BIGINT},
</if>
<if test="orderCode != null">
#{orderCode,jdbcType=BIGINT},
</if>
<if test="clientType != null">
#{clientType,jdbcType=TINYINT},
</if>
<if test="payment != null">
#{payment,jdbcType=TINYINT},
</if>
<if test="amount != null">
#{amount,jdbcType=DECIMAL},
</if>
<if test="shipFee != null">
#{shipFee,jdbcType=DECIMAL},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=INTEGER},
</if>
<if test="isDel != null">
#{isDel,jdbcType=TINYINT},
</if>
<if test="channelNo != null">
#{channelNo,jdbcType=VARCHAR},
</if>
<if test="attributes != null">
#{attributes,jdbcType=INTEGER},
</if>
<if test="platformDeliveryStatus != null">
#{platformDeliveryStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByOrderCode" parameterType="com.yohoufo.dal.order.model.AppraiseOrder">
update appraise_order
<set>
<if test="payment != null">
payment = #{payment,jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status,jdbcType=TINYINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=INTEGER},
</if>
<if test="isDel != null">
is_del = #{isDel,jdbcType=TINYINT},
</if>
<if test="platformDeliveryStatus != null">
platform_delivery_status = #{platformDeliveryStatus,jdbcType=TINYINT},
</if>
</set>
where order_code =#{orderCode,jdbcType=BIGINT}
</update>
<update id="updatePlatformDeliveryStatusByOrderCode">
update appraise_order set
platform_delivery_status = #{targetPlatformDeliveryStatus,jdbcType=INTEGER}, update_time = #{currentTime,jdbcType=INTEGER}
where uid = #{uid,jdbcType=INTEGER} and order_code = #{orderCode,jdbcType=BIGINT}
</update>
<update id="updateStatusByOrderCode">
update appraise_order
<set>
status = #{targetStatus,jdbcType=TINYINT},
update_time = #{updateTime,jdbcType=INTEGER}
</set>
where order_code =#{orderCode,jdbcType=BIGINT} and status = #{expectedStatus,jdbcType=TINYINT}
</update>
<update id="updateStatusByParentOrderCode">
update appraise_order
<set>
status = #{targetStatus,jdbcType=TINYINT},
update_time = #{updateTime,jdbcType=INTEGER}
</set>
where parent_order_code =#{parentOrderCode,jdbcType=BIGINT} and status = #{expectedStatus,jdbcType=TINYINT}
</update>
<select id="selectByOrderCodeList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order
where order_code in
<foreach collection="orderList" item="orderCode" open="(" close=")" separator=",">
#{orderCode,jdbcType=BIGINT}
</foreach>
</select>
<select id="selectSubOrderStatistic" resultMap="BaseResultMap">
select parent_order_code,status, count(*) status_cnt from ufo_order.appraise_order
where parent_order_code = #{parentOrderCode,jdbcType=BIGINT}
group by status
</select>
</mapper>