GarOrderMatchAskMapper.xml
19.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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<?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.trash.garbage.mapper.GarOrderMatchAskMapper">
<resultMap id="BaseResultMap" type="com.trash.garbage.pojo.domain.GarOrderMatchAsk">
<id property="garId" column="gar_id" jdbcType="VARCHAR"/>
<result property="garOrderId" column="gar_order_id" jdbcType="VARCHAR"/>
<result property="garCarryingWeight" column="gar_carrying_weight" jdbcType="VARCHAR"/>
<result property="garOrderHandlerTel" column="gar_order_handler_tel" jdbcType="VARCHAR"/>
<result property="garOrderHandlerName" column="gar_order_handler_name" jdbcType="VARCHAR"/>
<result property="garOrderContainerVolume" column="gar_order_container_volume" jdbcType="VARCHAR"/>
<result property="garOrderHandlerCompanyId" column="gar_order_handler_company_id" jdbcType="VARCHAR"/>
<result property="garOrderHandlerCompanyName" column="gar_order_handler_company_name" jdbcType="VARCHAR"/>
<result property="garCreateTime" column="gar_create_time" jdbcType="TIMESTAMP"/>
<result property="garUpdateTime" column="gar_update_time" jdbcType="TIMESTAMP"/>
<result property="garCreateBy" column="gar_create_by" jdbcType="VARCHAR"/>
<result property="garUpdateBy" column="gar_update_by" jdbcType="VARCHAR"/>
<result property="garRemark" column="gar_remark" jdbcType="VARCHAR"/>
<result property="dropPointNo" column="drop_point_no" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
gar_id,gar_order_id,gar_order_handler_tel,gar_order_container_volume,gar_carrying_weight,
gar_order_handler_name,gar_order_handler_company_id,gar_order_handler_company_name,
gar_create_time,gar_update_time,gar_create_by,
gar_update_by,gar_remark
</sql>
<resultMap type="DriverSend" id="driverSendMap">
<result property="orderId" column="order_id" />
<result property="phone" column="phone" />
<result property="state" column="state" />
</resultMap>
<insert id="addDriverSend" parameterType="DriverSend">
insert into driver_send (order_id,phone,state) values (#{orderId},#{phone},#{state})
</insert>
<select id="queryDriverSend" parameterType="DriverSend" resultMap="driverSendMap">
select * from driver_send where phone = #{phone} and state = 0 limit 1
</select>
<update id="updateDriverSendState" parameterType="DriverSend">
update driver_send set state = 1 where phone = #{phone}
</update>
<resultMap type="GarOrderMatchAsk" id="GarOrderMatchAskResult">
<result property="garId" column="gar_id" />
<result property="garOrderId" column="gar_order_id" />
<result property="garOrderHandlerTel" column="gar_order_handler_tel" />
<result property="garOrderHandlerName" column="gar_order_handler_name" />
<result property="garOrderContainerVolume" column="gar_order_container_volume" />
<result property="garOrderHandlerId" column="gar_order_handler_id" />
<result property="garHandlerCarCode" column="gar_handler_car_code" />
<result property="garOrderHandlerCompanyId" column="gar_order_handler_company_id" />
<result property="garOrderHandlerCompanyName" column="gar_order_handler_company_name" />
<result property="garCreateTime" column="gar_create_time" />
<result property="garUpdateTime" column="gar_update_time" />
<result property="garCreateBy" column="gar_create_by" />
<result property="garUpdateBy" column="gar_update_by" />
<result property="garRemark" column="gar_remark" />
<result property="garCarryingWeight" column="gar_carrying_weight" />
<result property="dropPointId" column="drop_point_id" />
<result property="dropPointName" column="drop_point_name" />
<result property="garOrderType" column="gar_order_type" />
<result property="disposalId" column="disposal_id" />
<result property="disposalSiteName" column="disposal_site_name" />
<result property="garOrderNumber" column="gar_order_number" />
<result property="garOrderPhone" column="gar_order_phone" />
<result property="garOrderName" column="gar_order_name" />
<result property="dropCustodianPhone" column="drop_custodian_phone" />
<result property="dropAddress" column="drop_address" />
<result property="dropCarNum" column="drop_car_num" />
<result property="garCarCode" column="gar_car_code" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="garOrderTime" column="gar_order_time" />
<result property="transportDistance" column="transport_distance" />
<result property="unloadingLonLat" column="unloading_lon_lat" />
</resultMap>
<sql id="selectGarOrderMatchAskVo">
select gar_id,gar_order_id,gar_order_handler_tel,gar_order_handler_name,gar_order_container_volume,gar_order_handler_id,gar_handler_car_code,gar_order_handler_company_id,gar_order_handler_company_name,gar_create_time,gar_update_time,gar_create_by,gar_update_by,gar_remark,gar_carrying_weight,drop_point_id,drop_point_name,gar_order_type,disposal_id,disposal_site_name,gar_order_number,gar_order_phone,gar_order_name,drop_custodian_phone,drop_address,drop_car_num,gar_car_code,create_time,create_by,update_time,update_by,gar_order_time,transport_distance from gar_order_match_ask
</sql>
<select id="selectGarOrderMatchAskList" parameterType="GarOrderMatchAsk" resultMap="GarOrderMatchAskResult">
<include refid="selectGarOrderMatchAskVo"/>
<where>
<if test="garOrderId != null and garOrderId != ''"> and gar_order_id = #{garOrderId}</if>
<if test="garOrderHandlerTel != null and garOrderHandlerTel != ''"> and gar_order_handler_tel = #{garOrderHandlerTel}</if>
<if test="garOrderHandlerName != null and garOrderHandlerName != ''"> and gar_order_handler_name like concat('%', #{garOrderHandlerName}, '%')</if>
<if test="garOrderContainerVolume != null and garOrderContainerVolume != ''"> and gar_order_container_volume = #{garOrderContainerVolume}</if>
<if test="garOrderHandlerId != null and garOrderHandlerId != ''"> and gar_order_handler_id = #{garOrderHandlerId}</if>
<if test="garHandlerCarCode != null and garHandlerCarCode != ''"> and gar_handler_car_code like concat('%', #{garHandlerCarCode}, '%')</if>
<if test="garOrderHandlerCompanyId != null and garOrderHandlerCompanyId != ''"> and gar_order_handler_company_id = #{garOrderHandlerCompanyId}</if>
<if test="garOrderHandlerCompanyName != null and garOrderHandlerCompanyName != ''"> and gar_order_handler_company_name like concat('%', #{garOrderHandlerCompanyName}, '%')</if>
<if test="garCreateTime != null "> and gar_create_time = #{garCreateTime}</if>
<if test="garUpdateTime != null "> and gar_update_time = #{garUpdateTime}</if>
<if test="garCreateBy != null and garCreateBy != ''"> and gar_create_by = #{garCreateBy}</if>
<if test="garUpdateBy != null and garUpdateBy != ''"> and gar_update_by = #{garUpdateBy}</if>
<if test="garRemark != null and garRemark != ''"> and gar_remark = #{garRemark}</if>
<if test="garCarryingWeight != null "> and gar_carrying_weight = #{garCarryingWeight}</if>
<if test="dropPointName != null and dropPointName != ''"> and drop_point_name like concat('%', #{dropPointName}, '%')</if>
<if test="garOrderType != null and garOrderType != ''"> and gar_order_type = #{garOrderType}</if>
<if test="disposalId != null and disposalId != ''"> and disposal_id = #{disposalId}</if>
<if test="disposalSiteName != null and disposalSiteName != ''"> and disposal_site_name like concat('%', #{disposalSiteName}, '%')</if>
<if test="garOrderNumber != null and garOrderNumber != ''"> and gar_order_number = #{garOrderNumber}</if>
<if test="garOrderPhone != null and garOrderPhone != ''"> and gar_order_phone = #{garOrderPhone}</if>
<if test="garOrderName != null and garOrderName != ''"> and gar_order_name like concat('%', #{garOrderName}, '%')</if>
</where>
<!-- 添加按创建时间倒序排序 -->
order by gar_create_time desc
</select>
<select id="selectGarOrderMatchAskByOrderId" parameterType="String" resultMap="GarOrderMatchAskResult">
select a.gar_id,a.gar_order_id,a.gar_order_handler_tel,
a.gar_order_handler_name,a.gar_order_container_volume,
a.gar_order_handler_id,a.gar_handler_car_code,a.gar_order_handler_company_id,
a.gar_order_handler_company_name,a.gar_create_time,a.gar_update_time,a.gar_create_by,
a.gar_update_by,a.gar_remark,a.gar_carrying_weight,a.drop_point_id,a.drop_point_name,
a.gar_order_type,a.disposal_id,a.disposal_site_name,a.gar_order_number,a.gar_order_phone,
a.gar_order_name,a.drop_custodian_phone,a.drop_address,a.drop_car_num,a.gar_car_code,a.create_time,
a.create_by,a.update_time,a.update_by,a.gar_order_time,a.transport_distance,b.drop_point_no
from gar_order_match_ask a
left join drop_point_info b
on a.drop_point_id = b.id
where a.gar_order_id = #{gar_order_id}
</select>
<select id="selectGarOrderMatchAskById" parameterType="String" resultMap="GarOrderMatchAskResult">
select gar_id,gar_order_id,gar_order_handler_tel,
gar_order_handler_name,gar_order_container_volume,
gar_order_handler_id,gar_handler_car_code,gar_order_handler_company_id,
gar_order_handler_company_name,gar_create_time,gar_update_time,gar_create_by,
gar_update_by,gar_remark,gar_carrying_weight,drop_point_id,a.drop_point_name,
gar_order_type,disposal_id,disposal_site_name,gar_order_number,gar_order_phone,
gar_order_name,drop_custodian_phone,drop_address,drop_car_num,gar_car_code,a.create_time,
a.create_by,a.update_time,a.update_by,gar_order_time,transport_distance,b.drop_point_no
from gar_order_match_ask a
left join drop_point_info b
on a.drop_point_id = b.id
where gar_id = #{gar_id}
</select>
<insert id="insertGarOrderMatchAsk" parameterType="GarOrderMatchAsk">
insert into gar_order_match_ask
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="garId != null">gar_id,</if>
<if test="garOrderId != null">gar_order_id,</if>
<if test="garOrderHandlerTel != null">gar_order_handler_tel,</if>
<if test="garOrderHandlerName != null">gar_order_handler_name,</if>
<if test="garOrderContainerVolume != null">gar_order_container_volume,</if>
<if test="garOrderHandlerId != null">gar_order_handler_id,</if>
<if test="garHandlerCarCode != null">gar_handler_car_code,</if>
<if test="garOrderHandlerCompanyId != null">gar_order_handler_company_id,</if>
<if test="garOrderHandlerCompanyName != null">gar_order_handler_company_name,</if>
<if test="garCreateTime != null">gar_create_time,</if>
<if test="garUpdateTime != null">gar_update_time,</if>
<if test="garCreateBy != null">gar_create_by,</if>
<if test="garUpdateBy != null">gar_update_by,</if>
<if test="garRemark != null">gar_remark,</if>
<if test="garCarryingWeight != null">gar_carrying_weight,</if>
<if test="dropPointId != null">drop_point_id,</if>
<if test="dropPointName != null">drop_point_name,</if>
<if test="garOrderType != null">gar_order_type,</if>
<if test="disposalId != null">disposal_id,</if>
<if test="disposalSiteName != null">disposal_site_name,</if>
<if test="garOrderNumber != null">gar_order_number,</if>
<if test="garOrderPhone != null">gar_order_phone,</if>
<if test="garOrderName != null">gar_order_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="garId != null">#{garId},</if>
<if test="garOrderId != null">#{garOrderId},</if>
<if test="garOrderHandlerTel != null">#{garOrderHandlerTel},</if>
<if test="garOrderHandlerName != null">#{garOrderHandlerName},</if>
<if test="garOrderContainerVolume != null">#{garOrderContainerVolume},</if>
<if test="garOrderHandlerId != null">#{garOrderHandlerId},</if>
<if test="garHandlerCarCode != null">#{garHandlerCarCode},</if>
<if test="garOrderHandlerCompanyId != null">#{garOrderHandlerCompanyId},</if>
<if test="garOrderHandlerCompanyName != null">#{garOrderHandlerCompanyName},</if>
<if test="garCreateTime != null">#{garCreateTime},</if>
<if test="garUpdateTime != null">#{garUpdateTime},</if>
<if test="garCreateBy != null">#{garCreateBy},</if>
<if test="garUpdateBy != null">#{garUpdateBy},</if>
<if test="garRemark != null">#{garRemark},</if>
<if test="garCarryingWeight != null">#{garCarryingWeight},</if>
<if test="dropPointId != null">#{dropPointId},</if>
<if test="dropPointName != null">#{dropPointName},</if>
<if test="garOrderType != null">#{garOrderType},</if>
<if test="disposalId != null">#{disposalId},</if>
<if test="disposalSiteName != null">#{disposalSiteName},</if>
<if test="garOrderNumber != null">#{garOrderNumber},</if>
<if test="garOrderPhone != null">#{garOrderPhone},</if>
<if test="garOrderName != null">#{garOrderName},</if>
</trim>
</insert>
<update id="updateGarOrderMatchAsk" parameterType="GarOrderMatchAsk">
update gar_order_match_ask
<trim prefix="SET" suffixOverrides=",">
<if test="garOrderId != null">gar_order_id = #{garOrderId},</if>
<if test="garOrderHandlerTel != null">gar_order_handler_tel = #{garOrderHandlerTel},</if>
<if test="garOrderHandlerName != null">gar_order_handler_name = #{garOrderHandlerName},</if>
<if test="garOrderContainerVolume != null">gar_order_container_volume = #{garOrderContainerVolume},</if>
<if test="garOrderHandlerId != null">gar_order_handler_id = #{garOrderHandlerId},</if>
<if test="garHandlerCarCode != null">gar_handler_car_code = #{garHandlerCarCode},</if>
<if test="garOrderHandlerCompanyId != null">gar_order_handler_company_id = #{garOrderHandlerCompanyId},</if>
<if test="garOrderHandlerCompanyName != null">gar_order_handler_company_name = #{garOrderHandlerCompanyName},</if>
<if test="garCreateTime != null">gar_create_time = #{garCreateTime},</if>
<if test="garUpdateTime != null">gar_update_time = #{garUpdateTime},</if>
<if test="garCreateBy != null">gar_create_by = #{garCreateBy},</if>
<if test="garUpdateBy != null">gar_update_by = #{garUpdateBy},</if>
<if test="garRemark != null">gar_remark = #{garRemark},</if>
<if test="garCarryingWeight != null">gar_carrying_weight = #{garCarryingWeight},</if>
<if test="dropPointId != null">drop_point_id = #{dropPointId},</if>
<if test="dropPointName != null">drop_point_name = #{dropPointName},</if>
<if test="garOrderType != null">gar_order_type = #{garOrderType},</if>
<if test="disposalId != null">disposal_id = #{disposalId},</if>
<if test="disposalSiteName != null">disposal_site_name = #{disposalSiteName},</if>
<if test="garOrderNumber != null">gar_order_number = #{garOrderNumber},</if>
<if test="garOrderPhone != null">gar_order_phone = #{garOrderPhone},</if>
<if test="garOrderName != null">gar_order_name = #{garOrderName},</if>
</trim>
where gar_id = #{garId}
</update>
<delete id="deleteGarOrderMatchAskById" parameterType="String">
delete from gar_order_match_ask where gar_id = #{garId}
</delete>
<delete id="deleteGarOrderMatchAskByIds" parameterType="String">
delete from gar_order_match_ask where gar_id in
<foreach item="garId" collection="array" open="(" separator="," close=")">
#{garId}
</foreach>
</delete>
<select id="queryGarOrderMatchAsk" resultType="java.lang.Integer">
select COUNT(*) from gar_order_match_ask where gar_order_id = #{orderId} and transport_distance is not null
</select>
<select id="queryErrType" resultType="java.lang.Integer">
select count(*) from gar_order_match_ask where gar_order_handler_tel = #{phone} and gar_order_type = 1
</select>
<select id="queryCarCode" parameterType="string" resultMap="GarOrderMatchAskResult">
SELECT gar_order_handler_name,gar_handler_car_code
FROM gar_order_match_ask
WHERE gar_order_id = #{garOrderId}
group by gar_handler_car_code
</select>
<select id="queryGarOrderMatchAsks" resultType="java.lang.Integer">
select COUNT(*) from gar_order_match_ask where gar_order_id = #{orderId} and (transport_distance is null or transport_distance = '')
</select>
<select id="selectByGarOrderAskId" parameterType="string" resultMap="GarOrderMatchAskResult">
SELECT gar_id,gar_order_id,gar_create_by,gar_update_by,drop_point_id,drop_point_name,gar_order_type,disposal_id,disposal_site_name,gar_order_number,gar_order_phone,gar_order_name,drop_address,drop_car_num,gar_order_time
FROM gar_order_match_ask
WHERE gar_order_id = #{garOrderId}
ORDER BY gar_order_number DESC
LIMIT 1
</select>
<insert id="insertGarOrderMatchAskBySelect" parameterType="com.trash.garbage.pojo.domain.GarOrderMatchAsk">
INSERT INTO gar_order_match_ask (
gar_id,
gar_order_id,
gar_create_by,
gar_update_by,
drop_point_id,
drop_point_name,
gar_order_type,
disposal_id,
disposal_site_name,
gar_order_number,
gar_order_phone,
gar_order_name,
drop_address,
drop_car_num,
gar_order_time
) VALUES (
#{garId},
#{garOrderId},
#{garCreateBy},
#{garUpdateBy},
#{dropPointId},
#{dropPointName},
#{garOrderType},
#{disposalId},
#{disposalSiteName},
#{garOrderNumber},
#{garOrderPhone},
#{garOrderName},
#{dropAddress},
#{dropCarNum},
#{garOrderTime}
)
</insert>
</mapper>