Pu Zhibing
2 天以前 949bf4798368d0fce115993427e03758d4b3c897
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
<?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.stylefeng.guns.modular.crossCity.dao.LineSiteMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.crossCity.model.LineSite">
        <id column="id" property="id"/>
        <result column="lineId" property="lineId"/>
        <result column="startTime" property="startTime"/>
        <result column="endTime" property="endTime"/>
        <result column="carNum" property="carNum"/>
        <result column="state" property="state"/>
        <result column="insertTime" property="insertTime"/>
    </resultMap>
 
 
    <select id="queryDriver" resultType="map">
        select
        a.id as id,
        b.id as lineShiftDriverId,
        b.driverId as driverId,
        a.startTime as startTime,
        c.headImgUrl as headImgUrl,
        CONCAT(left(c.`name`, 1), '师傅') as `name`,
        d.carLicensePlate as carLicensePlate,
        CONCAT(e.`name`, f.`name`) as brand,
        d.carColor as carColor,
        CONCAT((b.totalSeat - b.laveSeat), '/', b.totalSeat) as `number`,
        (select sum(fraction)/count(fraction) from t_order_evaluate where driverId = b.driverId) as evaluate,
        h.type as priceType,
        h.content as content,
        b.driverId as driverId,
        c.carId as carId,
        b.totalSeat as totalSeat,
        g.serverCarModelId as serverCarModelId,
        b.laveSeatNumber as laveSeatNumber,
        b.laveSeat as laveSeat
        from t_line_shift a
        left join t_line_shift_driver b on (b.lineShiftId = a.id)
        left join t_driver c on (b.driverId = c.id)
        left join t_car d on (c.carId = d.id)
        left join t_car_brand e on (d.carBrandId = e.id)
        left join t_car_model f on (d.carModelId = f.id)
        left join t_car_service g on (d.id = g.carId and g.`type` = 3)
        left join t_line_price h on (g.serverCarModelId = h.serverCarModelId and a.lineId = h.lineId)
        where b.driverId in (select driverId from t_driver_work where state = 1 and type like '%3%')
        <if test="null != lineId">
            and a.lineId = #{lineId}
        </if>
        <if test="null != day">
            and DATE_FORMAT(b.day, '%Y-%m-%d') = DATE_FORMAT(#{day}, '%Y-%m-%d')
        </if>
        <if test="null != driverId">
            and b.driverId = #{driverId}
        </if>
        order by a.startTime
    </select>
</mapper>