GarOrderMapper.xml
12.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
<?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.GarOrderMapper">
<resultMap id="BaseResultMap" type="com.trash.garbage.pojo.domain.GarOrder">
<id property="garOrderId" column="gar_order_id" jdbcType="VARCHAR"/>
<result property="garOrderUserId" column="gar_order_user_id" jdbcType="VARCHAR"/>
<result property="garOrderAddress" column="gar_order_address" jdbcType="VARCHAR"/>
<result property="garOrderAddressDetails" column="gar_order_address_details" jdbcType="VARCHAR"/>
<result property="garOrderContactName" column="gar_order_contact_name" jdbcType="VARCHAR"/>
<result property="garOrderTrashType" column="gar_order_trash_type" jdbcType="VARCHAR"/>
<result property="garOrderContactTel" column="gar_order_contact_tel" jdbcType="VARCHAR"/>
<result property="garOrderCompanyId" column="gar_order_company_id" jdbcType="VARCHAR"/>
<result property="garOrderCompanyUserId" column="gar_order_company_user_id" jdbcType="VARCHAR"/>
<result property="garOrderCompanyName" column="gar_order_company_name" jdbcType="VARCHAR"/>
<result property="garOrderCompanyTel" column="gar_order_company_tel" jdbcType="VARCHAR"/>
<result property="garOrderHandlerStatus" column="gar_order_handler_status" jdbcType="INTEGER"/>
<result property="garOrderAgreementTime" column="gar_order_agreement_time" 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="garReason" column="gar_reason" jdbcType="VARCHAR"/>
<result property="garCancelFlag" column="gar_cancel_flag" jdbcType="TINYINT"/>
<result property="garEvaluateFlag" column="gar_evaluate_flag" jdbcType="TINYINT"/>
<result property="garHandlerEvaluateFlag" column="gar_handler_evaluate_flag" jdbcType="TINYINT"/>
<result property="garOrderScanHandlerFlag" column="gar_order_scan_handler_flag" jdbcType="TINYINT"/>
<result property="garLatitude" column="gar_latitude" jdbcType="DOUBLE"/>
<result property="garLongitude" column="gar_longitude" jdbcType="DOUBLE"/>
<result property="garCoordinate" column="gar_coordinate" jdbcType="DOUBLE"/>
<result property="garRealCarCount" column="gar_real_car_count" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="TransportDetailVo" type="com.trash.garbage.pojo.vo.OrderDetailTransportVo">
<id property="garOrderId" column="gar_order_id" jdbcType="VARCHAR"/>
<result property="garOrderAddress" column="gar_order_address" jdbcType="VARCHAR"/>
<result property="garOrderAddressDetails" column="gar_order_address_details" jdbcType="VARCHAR"/>
<result property="garOrderTrashType" column="gar_order_trash_type" jdbcType="VARCHAR"/>
<result property="garOrderContactTel" column="gar_order_contact_tel" jdbcType="VARCHAR"/>
<result property="garOrderCompanyId" column="gar_order_company_id" jdbcType="VARCHAR"/>
<result property="garOrderCompanyName" column="gar_order_company_name" jdbcType="VARCHAR"/>
<result property="garOrderCompanyTel" column="gar_order_company_tel" jdbcType="VARCHAR"/>
<result property="garRemark" column="gar_remark" jdbcType="VARCHAR"/>
<result property="garLatitude" column="gar_latitude" jdbcType="DOUBLE"/>
<result property="garLongitude" column="gar_longitude" jdbcType="DOUBLE"/>
<result property="garCoordinate" column="gar_coordinate" jdbcType="DOUBLE"/>
<result property="garRealCarCount" column="gar_real_car_count" jdbcType="INTEGER"/>
<collection property="transportDetails"
ofType="com.trash.garbage.pojo.vo.OrderDetailTransportVo$TransportDetail">
<result property="garHandlerCarCode" column="gar_handler_car_code"/>
<result property="garOrderContainerVolume" column="gar_order_container_volume"/>
<result property="fillImage" column="fill_image"/>
<result property="garCarryingWeight" column="gar_carrying_weight" jdbcType="DOUBLE"/>
<result property="garAskId" column="gar_ask_id"/>
</collection>
</resultMap>
<sql id="Base_Column_List">
gar_order_id
,gar_order_user_id,
gar_order_address,gar_order_address_details,gar_order_contact_name,
gar_order_trash_type,gar_order_contact_tel,gar_order_company_id,
gar_order_company_name,gar_order_company_tel,gar_order_handler_status,
gar_order_agreement_time,gar_create_time,gar_update_time,
gar_create_by,gar_update_by,gar_remark,gar_reason,gar_cancel_flag,
gar_evaluate_flag,gar_handler_evaluate_flag,gar_order_scan_handler_flag,gar_coordinate,gar_longitude,gar_latitude,gar_real_car_count
</sql>
<select id="queryCleanNumberByEnterpriseIds" resultType="com.trash.garbage.pojo.domain.GarOrder">
select gar_order_company_id, count(gar_order_company_id) as count
from gar_order
where gar_order_handler_status = #{status}
<if test="list != null and list.size() > 0">
and gar_order_company_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
group by gar_order_company_id
</if>
<if test="list == null or list.size() == 0">
and 1 = 0
</if>
</select>
<select id="queryDriverOrderListByTelWithType" resultType="com.trash.garbage.pojo.vo.GarOrderDriverVo">
SELECT
`order`.gar_order_id ,`order`.gar_order_user_id,`order`.gar_coordinate,
`order`.gar_order_address,`order`.gar_order_address_details,`order`.gar_order_contact_name,`order`.gar_longitude,
`order`.gar_order_trash_type,`order`.gar_order_contact_tel,`order`.gar_order_company_id,`order`.gar_latitude,
`order`.gar_order_company_name,`order`.gar_order_company_tel,`order`.gar_order_scan_handler_flag,
`order`.gar_order_agreement_time,`order`.gar_remark,`order`.gar_handler_evaluate_flag,
-- `order`.gar_order_handler_status gar_order_status,
`handler`.gar_order_handler_status,`handler`.gar_cancel_flag,`handler`.gar_reason,`order`.gar_real_car_count
FROM gar_order `order`
INNER JOIN gar_order_match_handler `handler` ON `order`.gar_order_id = `handler`.gar_order_id
<where>
`handler`.gar_order_handler_tel = #{garUserTel}
<if test="type != null">
AND `handler`.gar_order_handler_status = #{type}
</if>
<if test="cancelFlag != null">
AND `handler`.gar_cancel_flag = #{cancelFlag}
</if>
</where>
</select>
<select id="queryOrderByTelWithType" resultType="com.trash.garbage.pojo.vo.GarOrderDriverVo">
SELECT
`order`.gar_order_id ,`order`.gar_order_user_id,`order`.gar_latitude,
`order`.gar_order_address,`order`.gar_order_address_details,`order`.gar_order_contact_name,`order`.gar_longitude,
`order`.gar_order_trash_type,`order`.gar_order_contact_tel,`order`.gar_order_company_id,`order`.gar_coordinate,
`order`.gar_order_company_name,`order`.gar_order_company_tel,`order`.gar_order_scan_handler_flag,`order`.gar_real_car_count,
`order`.gar_order_agreement_time,`order`.gar_remark,`order`.gar_handler_evaluate_flag,
`handler`.gar_order_handler_status,`handler`.gar_cancel_flag,`handler`.gar_reason,`handler`.gar_handler_car_code
FROM gar_order `order`
INNER JOIN gar_order_match_handler `handler` ON `order`.gar_order_id = `handler`.gar_order_id AND
`order`.gar_order_id = #{orderId}
<where>
`handler`.gar_order_handler_tel = #{garUserTel}
<if test="cancelFlag != null">
AND `handler`.gar_cancel_flag = #{cancelFlag}
</if>
</where>
</select>
<select id="queryDisposalOrderListByTelWithType" resultType="com.trash.garbage.pojo.vo.GarOrderDisposalVo">
SELECT
`order`.gar_order_id,
`order`.gar_order_user_id,
`order`.gar_coordinate,
`order`.gar_order_address,
`order`.gar_order_address_details,
`order`.gar_order_contact_name,
`order`.gar_longitude,
`order`.gar_order_trash_type,
`order`.gar_order_contact_tel,
`order`.gar_order_company_id,
`order`.gar_order_company_user_id,
`order`.gar_latitude,
`order`.gar_order_company_name,
`order`.gar_order_company_tel,
`order`.gar_order_agreement_time,
`disposal`.gar_create_time,
`disposal`.gar_order_disposal_status,
`order`.gar_real_car_count,
(
CASE
`order`.gar_order_id
WHEN `order`.gar_order_id THEN
( SELECT count(*) FROM gar_order_match_ask ask INNER JOIN gar_order ON `gar_order`.gar_order_id =
`ask`.gar_order_id WHERE `order`.gar_order_id = `gar_order`.gar_order_id )
END
) AS gar_now_car_count
FROM
gar_order `order`
INNER JOIN gar_order_match_disposal `disposal` ON `order`.gar_order_id = `disposal`.gar_order_id
<where>
`disposal`.gar_order_disposal_tel = #{garUserTel}
<if test="type != null">
AND `disposal`.gar_order_disposal_status = #{type}
</if>
</where>
</select>
<select id="queryDriverDetailByTelWithOrderId" resultType="com.trash.garbage.pojo.vo.ScanDriverDetailVo">
SELECT
`order`.gar_order_id ,`order`.gar_order_user_id,`order`.gar_latitude,`order`.gar_order_company_user_id,
`order`.gar_order_address,`order`.gar_order_address_details,`order`.gar_order_contact_name,`order`.gar_longitude,
`order`.gar_order_trash_type,`order`.gar_order_contact_tel,`order`.gar_order_company_id,`order`.gar_coordinate,
`order`.gar_order_company_name,`order`.gar_order_company_tel,`handler`.gar_create_time,
`order`.gar_order_handler_status
gar_order_status,`handler`.gar_handler_car_code,`handler`.gar_order_handler_name,
`handler`.gar_handler_car_code,
`handler`.gar_order_handler_tel,
`handler`.gar_order_handler_id,
`handler`.gar_order_container_volume
FROM gar_order `order`
INNER JOIN gar_order_match_handler `handler` ON `order`.gar_order_id = `handler`.gar_order_id AND
`order`.gar_order_id = #{orderId}
<where>
`handler`.gar_order_handler_id = #{userId}
</where>
</select>
<select id="queryOrderTransportDetail" resultMap="TransportDetailVo">
SELECT `order`.gar_order_id,
`order`.gar_order_user_id,
`order`.gar_coordinate,
`order`.gar_order_address,
`order`.gar_order_address_details,
`order`.gar_order_contact_name,
`order`.gar_longitude,
`order`.gar_order_trash_type,
`order`.gar_order_contact_tel,
`order`.gar_order_company_id,
`order`.gar_order_company_user_id,
`order`.gar_latitude,
`order`.gar_order_company_name,
`order`.gar_order_company_tel,
`order`.gar_order_agreement_time,
`disposal`.gar_create_time,
`disposal`.gar_order_disposal_status,
`order`.gar_real_car_count,
`ask`.gar_id gar_ask_id,
`ask`.gar_carrying_weight,
`ask`.gar_handler_car_code,
`ask`.gar_order_handler_id
FROM gar_order `order`
LEFT JOIN gar_order_match_disposal `disposal` ON `order`.gar_order_id = `disposal`.gar_order_id
LEFT JOIN gar_order_match_ask `ask` ON `ask`.gar_order_id = `order`.gar_order_id
WHERE `order`.gar_order_id = #{orderId}
</select>
</mapper>