TVehicleLocationInfoMapper.xml 4.14 KB
Newer Older
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
<?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.zehong.system.mapper.TVehicleLocationInfoMapper">
    
    <resultMap type="TVehicleLocationInfo" id="TVehicleLocationInfoResult">
        <result property="vehicleLocationId"    column="vehicle_location_id"    />
        <result property="carNum"    column="car_num"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="reportTime"    column="report_time"    />
        <result property="isDel"    column="is_del"    />
        <result property="remarks"    column="remarks"    />
    </resultMap>

    <sql id="selectTVehicleLocationInfoVo">
        select vehicle_location_id, car_num, longitude, latitude, report_time, is_del, remarks from t_vehicle_location_info
    </sql>

    <select id="selectTVehicleLocationInfoList" parameterType="TVehicleLocationInfo" resultMap="TVehicleLocationInfoResult">
        <include refid="selectTVehicleLocationInfoVo"/>
        <where>  
            <if test="carNum != null  and carNum != ''"> and car_num = #{carNum}</if>
            <if test="longitude != null "> and longitude = #{longitude}</if>
            <if test="latitude != null "> and latitude = #{latitude}</if>
            <if test="beginTime != null and endTime!= null"> and report_time BETWEEN #{ beginTime } AND #{ endTime }</if>
            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
        </where>
        ORDER BY report_time DESC
        <if test="isLast">
            limit 1
        </if>
    </select>
    
    <select id="selectTVehicleLocationInfoById" parameterType="Long" resultMap="TVehicleLocationInfoResult">
        <include refid="selectTVehicleLocationInfoVo"/>
        where vehicle_location_id = #{vehicleLocationId}
    </select>
        
    <insert id="insertTVehicleLocationInfo" parameterType="TVehicleLocationInfo" useGeneratedKeys="true" keyProperty="vehicleLocationId">
        insert into t_vehicle_location_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="carNum != null">car_num,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="reportTime != null">report_time,</if>
            <if test="isDel != null">is_del,</if>
            <if test="remarks != null">remarks,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="carNum != null">#{carNum},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="reportTime != null">#{reportTime},</if>
            <if test="isDel != null">#{isDel},</if>
            <if test="remarks != null">#{remarks},</if>
         </trim>
    </insert>

    <update id="updateTVehicleLocationInfo" parameterType="TVehicleLocationInfo">
        update t_vehicle_location_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="carNum != null">car_num = #{carNum},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="reportTime != null">report_time = #{reportTime},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
        </trim>
        where vehicle_location_id = #{vehicleLocationId}
    </update>

    <delete id="deleteTVehicleLocationInfoById" parameterType="Long">
        delete from t_vehicle_location_info where vehicle_location_id = #{vehicleLocationId}
    </delete>

    <delete id="deleteTVehicleLocationInfoByIds" parameterType="String">
        delete from t_vehicle_location_info where vehicle_location_id in 
        <foreach item="vehicleLocationId" collection="array" open="(" separator="," close=")">
            #{vehicleLocationId}
        </foreach>
    </delete>
</mapper>