AppraiseOrderMapper.xml
11.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
<?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.yoho.order.dal.AppraiseOrderMapper">
<resultMap id="BaseResultMap" type="com.yoho.order.model.AppraiseOrder">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="parent_order_code" property="parentOrderCode" jdbcType="BIGINT" />
<result column="order_code" property="orderCode" jdbcType="BIGINT" />
<result column="client_type" property="clientType" jdbcType="TINYINT" />
<result column="payment" property="payment" jdbcType="TINYINT" />
<result column="amount" property="amount" jdbcType="DECIMAL" />
<result column="ship_fee" property="shipFee" jdbcType="DECIMAL" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="is_del" property="isDel" jdbcType="TINYINT" />
<result column="channel_no" property="channelNo" jdbcType="VARCHAR" />
<result column="attributes" property="attributes" jdbcType="INTEGER" />
<result column="platform_delivery_status" property="platformDeliveryStatus" jdbcType="TINYINT" />
</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="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order
where id = #{id,jdbcType=INTEGER}
</select>
<update id="updateByPrimaryKey" parameterType="com.yoho.order.model.AppraiseOrder">
update appraise_order
set uid = #{uid,jdbcType=INTEGER},
order_code = #{orderCode,jdbcType=BIGINT},
client_type = #{clientType,jdbcType=TINYINT},
payment = #{payment,jdbcType=TINYINT},
amount = #{amount,jdbcType=DECIMAL},
ship_fee = #{shipFee,jdbcType=DECIMAL},
status = #{status,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=INTEGER},
is_del = #{isDel,jdbcType=TINYINT},
channel_no = #{channelNo,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByOrderCode" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from appraise_order where order_code = #{orderCode}
</select>
<select id="selectByOrderCodeList" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from appraise_order where order_code in
<foreach collection="orderCodeList" item="orderCode" open="(" close=")" separator=",">
#{orderCode}
</foreach>
</select>
<select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.order.model.AppraiseOrderReq">
select distinct a.*
from appraise_order a
<if test="appraiseOrderReq.depotNo != null">
LEFT JOIN appraise_order_goods c
ON(c.order_code=a.order_code)
</if>
<if test="appraiseOrderReq.sellerWaybillCode != null and appraiseOrderReq.sellerWaybillCode != ''">
LEFT JOIN express_record d
ON(a.order_code=d.order_code)
</if>
<if test="appraiseOrderReq.sellerWaybillCode != null and appraiseOrderReq.sellerWaybillCode != ''">
where a.parent_order_code is null
</if>
<if test="appraiseOrderReq.sellerWaybillCode == null or appraiseOrderReq.sellerWaybillCode == ''">
where ((a.attributes=7 and a.parent_order_code is not null) or (a.attributes=8))
</if>
<include refid="Query_Order_Sql" />
<choose>
<when test="appraiseOrderReq.sortRule!=null and appraiseOrderReq.sortRule=='asc'">
order by a.status asc, a.id asc
</when>
<otherwise>
order by a.id desc
</otherwise>
</choose>
<if test="appraiseOrderReq.start!=null and appraiseOrderReq.size != null">
limit #{appraiseOrderReq.start},#{appraiseOrderReq.size}
</if>
</select>
<select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.AppraiseOrderReq">
select count(a.id)
from appraise_order a
<if test="appraiseOrderReq.depotNo != null">
LEFT JOIN appraise_order_goods c
ON(c.order_code=a.order_code)
</if>
<if test="appraiseOrderReq.sellerWaybillCode != null and appraiseOrderReq.sellerWaybillCode != ''">
LEFT JOIN express_record d
ON(a.order_code=d.order_code)
</if>
<if test="appraiseOrderReq.sellerWaybillCode != null and appraiseOrderReq.sellerWaybillCode != ''">
where a.parent_order_code is null
</if>
<if test="appraiseOrderReq.sellerWaybillCode == null or appraiseOrderReq.sellerWaybillCode == ''">
where ((a.attributes=7 and a.parent_order_code is not null) or (a.attributes=8))
</if>
<include refid="Query_Order_Sql" />
</select>
<select id="selectCountByStatusAndDepotNo" resultType="java.lang.Integer">
select count(1)
from appraise_order a
<if test="depotNo != null">
LEFT JOIN appraise_order_goods c
ON(c.order_code=a.order_code)
</if>
where ((a.attributes=7 and a.parent_order_code is not null) or (a.attributes=8))
<if test="list != null and list.size()>0">
and a.status in
<foreach collection="list" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
</if>
<if test="depotNo != null">
and c.depot_no=#{depotNo}
</if>
<!-- 平台物流是否存在 -->
<if test="platformExpressInfoFlag != null and platformExpressInfoFlag != '' ">
<if test="platformExpressInfoFlag == 'haveNotExpress'">
and a.platform_delivery_status = 0
</if>
<if test="platformExpressInfoFlag == 'haveExpress'">
and a.platform_delivery_status in (1,2)
</if>
</if>
</select>
<sql id="Query_Order_Sql" >
<if test="appraiseOrderReq.statusList != null and appraiseOrderReq.statusList.size() >0">
and a.status in
<foreach collection="appraiseOrderReq.statusList" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
</if>
<if test="appraiseOrderReq.orderCode != null and appraiseOrderReq.orderCode != '' ">
and a.order_code = #{appraiseOrderReq.orderCode}
</if>
<if test="appraiseOrderReq.status != null ">
and a.status = #{appraiseOrderReq.status}
</if>
<if test="appraiseOrderReq.depotNo != null">
and c.depot_no = #{appraiseOrderReq.depotNo}
</if>
<if test="appraiseOrderReq.attributes != null">
and a.attributes = #{appraiseOrderReq.attributes}
</if>
<if test="appraiseOrderReq.sellerWaybillCode != null and appraiseOrderReq.sellerWaybillCode != '' ">
and d.waybill_code = #{appraiseOrderReq.sellerWaybillCode} and d.express_type=1
</if>
<!-- 平台物流是否存在 -->
<if test="appraiseOrderReq.platformExpressInfoFlag != null and appraiseOrderReq.platformExpressInfoFlag != '' ">
<if test="appraiseOrderReq.platformExpressInfoFlag == 'haveNotExpress'">
and a.platform_delivery_status = 0
</if>
<if test="appraiseOrderReq.platformExpressInfoFlag == 'haveExpress'">
and a.platform_delivery_status in (1,2)
</if>
</if>
</sql>
<select id="selectCountInfo" resultType="java.util.HashMap">
select status, count(*) as num from appraise_order where parent_order_code = #{orderCode} and attributes = 7 group by status
</select>
<select id="selectParentListCount" resultType="java.lang.Integer">
select count(*) from appraise_order
where <include refid="list_condition"/>
</select>
<select id="selectParentList" resultMap="BaseResultMap">
select * from appraise_order
where <include refid="list_condition"/> order by create_time desc limit #{start}, #{size}
</select>
<select id="selectParentBySubOrderCode" resultMap="BaseResultMap">
select * from appraise_order
where order_code = (select parent_order_code from appraise_order where attributes = 7 and order_code = #{orderCode} limit 1)
</select>
<sql id="list_condition" >
parent_order_code is null and attributes = 7
<if test="statusList != null and statusList.size()>0">
and status in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
</if>
<if test="orderCode != null and orderCode !=''">
and order_code = #{orderCode}
</if>
<if test="uid != null">
and uid = #{uid}
</if>
<if test="buyStartTime != null">
and create_time >= #{buyStartTime}
</if>
<if test="buyEndTime != null">
and create_time <= #{buyEndTime}
</if>
</sql>
<select id="selectSonListCount" resultType="java.lang.Integer">
select count(*) from appraise_order where parent_order_code = #{orderCode}
</select>
<select id="selectSonList" resultMap="BaseResultMap">
select * from appraise_order where parent_order_code = #{orderCode} order by create_time desc limit #{start}, #{size}
</select>
<select id="selectBatchSonList" resultMap="BaseResultMap">
select * from appraise_order where parent_order_code in
<foreach collection="parentOrderCodeList" item="parentOrderCode" open="(" close=")" separator=",">
#{parentOrderCode}
</foreach>
</select>
<select id="selectCountByCondition" resultType="java.lang.Integer">
select count(1)
from appraise_order
where attributes = 8
<if test="appraiseServiceReq.uid != null">
and uid = #{appraiseServiceReq.uid}
</if>
<if test="appraiseServiceReq.orderCode != null and appraiseServiceReq.orderCode != '' ">
and order_code = #{appraiseServiceReq.orderCode}
</if>
</select>
<select id="selectListByCondition" resultMap="BaseResultMap">
select id,uid,order_code,amount,status
from appraise_order
where attributes = 8
<if test="appraiseServiceReq.uid != null">
and uid = #{appraiseServiceReq.uid}
</if>
<if test="appraiseServiceReq.orderCode != null and appraiseServiceReq.orderCode != '' ">
and order_code = #{appraiseServiceReq.orderCode}
</if>
order by id DESC
limit #{appraiseServiceReq.start},#{appraiseServiceReq.size}
</select>
</mapper>