GarOrderMatchHandlerMapper.xml
5.01 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
<?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.GarOrderMatchHandlerMapper">
<resultMap id="BaseResultMap" type="com.trash.garbage.pojo.domain.GarOrderMatchHandler">
<id property="garId" column="gar_id" jdbcType="VARCHAR"/>
<result property="garOrderId" column="gar_order_id" jdbcType="VARCHAR"/>
<result property="garOrderHandlerTel" column="gar_order_handler_tel" jdbcType="VARCHAR"/>
<result property="garOrderContainerVolume" column="gar_order_container_volume" jdbcType="VARCHAR"/>
<result property="garOrderHandlerStatus" column="gar_order_handler_status" jdbcType="TINYINT"/>
<result property="garCancelFlag" column="gar_cancel_flag" jdbcType="TINYINT"/>
<result property="garOrderHandlerName" column="gar_order_handler_name" 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="garReason" column="gar_reason" jdbcType="VARCHAR"/>
<result property="garHandlerCarCode" column="gar_handler_car_code" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="DispatchDriverVo" type="com.trash.garbage.pojo.vo.DispatchDriverVo">
<result property="licensePlateNumber" column="car_code" jdbcType="VARCHAR"/>
<result property="containerVolume" column="container_volume" jdbcType="TINYINT"/>
<collection property="personnelInfo" ofType="com.trash.garbage.pojo.vo.DispatchDriverVo$Personnel">
<id property="name" column="name" jdbcType="VARCHAR"/>
<result property="tel" column="phoneNo" jdbcType="VARCHAR"/>
<result property="checked" column="checked"/>
</collection>
</resultMap>
<sql id="Base_Column_List">
gar_id
,gar_order_id,gar_order_handler_tel,gar_order_container_volume,
gar_order_handler_status,gar_cancel_flag,gar_order_handler_name,gar_order_handler_company_id,
gar_order_handler_company_name,gar_create_time,gar_update_time,
gar_craete_by,gar_update_by,gar_reason,gar_handler_car_code
</sql>
<select id="queryDriverListWithDispatchStatus" resultMap="DispatchDriverVo">
SELECT
driver.`name` AS `name`,
driver.phoneNo AS phoneNo,
car.car_code AS car_code,
car.container_volume AS container_volume,
gar.gar_handler_car_code,
gar.gar_order_id,
CASE
WHEN gar.gar_order_id IS NULL THEN 0
ELSE 1
END AS checked
FROM
driver
INNER JOIN car_driver_relation relation ON relation.driver_id = driver.id
INNER JOIN car_info car ON car.id = relation.car_id
LEFT JOIN gar_order_match_handler gar ON gar.gar_order_handler_tel = driver.phoneNo
AND gar.gar_order_id = #{orderId} AND gar.gar_handler_car_code = car.car_code
WHERE
driver.company_id = #{companyId} and container_volume in
<foreach collection="containerVolumees" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="queryGarOrderMatchHandler" resultType="com.trash.garbage.pojo.domain.GarOrderMatchHandler">
select * from gar_order_match_handler where gar_order_id = #{orderId}
</select>
<select id="queryOrderNo" resultType="string">
SELECT
gar_order_id
FROM
gar_order_match_handler
WHERE
gar_handler_car_code = #{carCode}
AND gar_order_handler_status != 3
ORDER BY gar_create_time DESC
limit 1
</select>
<select id="queryCarCountByTel" resultType="string">
select gar_car_count from gar_order_match_handler where gar_order_handler_tel = #{tel}
</select>
<update id="updateCarCount">
update gar_order_match_handler set gar_car_count = gar_car_count + #{carCount} where gar_order_handler_tel = #{tel}
</update>
<select id="queryByOrderNo" resultType="com.trash.garbage.pojo.domain.GarOrderMatchHandler">
select * from gar_order_match_handler where gar_order_id = #{orderNo}
</select>
<select id="queryByOrderNoDriver" resultType="com.trash.garbage.pojo.domain.GarOrderMatchHandler">
select * from gar_order_match_handler where gar_order_id = #{orderNo} and gar_order_handler_tel = #{phone}
</select>
</mapper>