Pu Zhibing
2025-06-19 a05b419384e148fc950c77553816a2d05144f4ae
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
<?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.ruoyi.system.mapper.CarMapper">
    
    <select id="getCarList" resultType="com.ruoyi.system.query.CarListResp">
        select
            a.id,
            a.vehicle_number      as vehicleNumber,
            a.license_plate_color as licensePlateColor,
            c.name as enterpriseName,
            a.passenger_capacity as passengerCapacity,
            a.brand_model as brandModel,
            a.vehicle_type as vehicleType,
            b.name as driverName,
            a.vehicle_color as vehicleColor,
            a.registration_date as registrationDate,
            a.operating_area as operatingArea,
            a.operate_type as operateType,
            a.status
        from t_car a
        left join t_driver b on (a.vehicle_number = b.vehicle_number and b.status = 1)
        left join t_enterprise c on (a.enterprise_id = c.id)
        <where>
            <if test="null != item.vehicleNumber and '' != item.vehicleNumber">
                and a.vehicle_number like CONCAT('%', #{item.vehicleNumber}, '%')
            </if>
            <if test="null != item.enterpriseName and '' != item.enterpriseName">
                and c.name like CONCAT('%', #{item.enterpriseName}, '%')
            </if>
            <if test="null != item.driverName and '' != item.driverName">
                and b.name like CONCAT('%', #{item.driverName}, '%')
            </if>
            <if test="null != item.carColor and '' != item.carColor">
                and a.vehicle_color like CONCAT('%', #{item.carColor}, '%')
            </if>
            <if test="null != item.area and '' != item.area">
                and a.operating_area like CONCAT('%', #{item.area}, '%')
            </if>
            <if test="null != item.brandModel and '' != item.brandModel">
                and a.brand_model like CONCAT('%', #{item.brandModel}, '%')
            </if>
            <if test="null != item.startNum and null != item.endNum">
                and a.passenger_capacity between #{item.startNum} and #{item.endNum}
            </if>
            <if test="null != item.operateType and '' != item.operateType">
                and a.operate_type like CONCAT('%', #{item.operateType}, '%')
            </if>
            <if test="null != item.status">
                and a.status = #{item.status}
            </if>
        </where>
        order by a.create_time desc
    </select>
 
</mapper>