wanglizhong
2025-05-03 de26c331fc9febdc11b85ff98ad657fb12cc2b73
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
<?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.VehicleInfoMapper">
    
    <resultMap type="VehicleInfo" id="VehicleInfoResult">
        <result property="vehicleId"    column="vehicle_id"    />
        <result property="deviceId"     column="device_id"     />
        <result property="vehicleNo"    column="vehicle_no"    />
        <result property="vehicleType"  column="vehicle_type"  />
        <result property="vehicleBrand" column="vehicle_brand" />
        <result property="vehicleModel" column="vehicle_model" />
        <result property="status"       column="status"        />
        <result property="createBy"     column="create_by"     />
        <result property="createTime"   column="create_time"   />
        <result property="updateBy"     column="update_by"     />
        <result property="updateTime"   column="update_time"   />
        <result property="remark"       column="remark"        />
    </resultMap>
 
    <sql id="selectVehicleInfoVo">
        select vehicle_id, device_id, vehicle_no, vehicle_type, vehicle_brand, vehicle_model, status, create_by, create_time, update_by, update_time, remark
        from tb_vehicle_info
    </sql>
 
    <select id="selectVehicleInfoList" parameterType="VehicleInfo" resultMap="VehicleInfoResult">
        <include refid="selectVehicleInfoVo"/>
        <where>  
            <if test="vehicleNo != null  and vehicleNo != ''"> and vehicle_no = #{vehicleNo}</if>
            <if test="deviceId != null  and deviceId != ''"> and device_id = #{deviceId}</if>
            <if test="vehicleType != null  and vehicleType != ''"> and vehicle_type = #{vehicleType}</if>
            <if test="vehicleBrand != null  and vehicleBrand != ''"> and vehicle_brand = #{vehicleBrand}</if>
            <if test="vehicleModel != null  and vehicleModel != ''"> and vehicle_model = #{vehicleModel}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectVehicleInfoById" parameterType="Long" resultMap="VehicleInfoResult">
        <include refid="selectVehicleInfoVo"/>
        where vehicle_id = #{vehicleId}
    </select>
 
    <select id="selectVehicleInfoByPlateNumber" parameterType="String" resultMap="VehicleInfoResult">
        <include refid="selectVehicleInfoVo"/>
        where vehicle_no = #{plateNumber}
    </select>
        
    <insert id="insertVehicleInfo" parameterType="VehicleInfo" useGeneratedKeys="true" keyProperty="vehicleId">
        insert into tb_vehicle_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="deviceId != null">device_id,</if>
            <if test="vehicleNo != null">vehicle_no,</if>
            <if test="vehicleType != null">vehicle_type,</if>
            <if test="vehicleBrand != null">vehicle_brand,</if>
            <if test="vehicleModel != null">vehicle_model,</if>
            <if test="status != null">status,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="deviceId != null">#{deviceId},</if>
            <if test="vehicleNo != null">#{vehicleNo},</if>
            <if test="vehicleType != null">#{vehicleType},</if>
            <if test="vehicleBrand != null">#{vehicleBrand},</if>
            <if test="vehicleModel != null">#{vehicleModel},</if>
            <if test="status != null">#{status},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>
 
    <update id="updateVehicleInfo" parameterType="VehicleInfo">
        update tb_vehicle_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="deviceId != null">device_id = #{deviceId},</if>
            <if test="vehicleNo != null">vehicle_no = #{vehicleNo},</if>
            <if test="vehicleType != null">vehicle_type = #{vehicleType},</if>
            <if test="vehicleBrand != null">vehicle_brand = #{vehicleBrand},</if>
            <if test="vehicleModel != null">vehicle_model = #{vehicleModel},</if>
            <if test="status != null">status = #{status},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            update_time = sysdate()
        </trim>
        where vehicle_id = #{vehicleId}
    </update>
 
    <delete id="deleteVehicleInfoById" parameterType="Long">
        delete from tb_vehicle_info where vehicle_id = #{vehicleId}
    </delete>
 
    <delete id="deleteVehicleInfoByIds" parameterType="String">
        delete from tb_vehicle_info where vehicle_id in 
        <foreach item="vehicleId" collection="array" open="(" separator="," close=")">
            #{vehicleId}
        </foreach>
    </delete>
</mapper>