<?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>