| | |
| | | <select id="selectVehicleGpsList" parameterType="VehicleGps" resultMap="VehicleGpsResult"> |
| | | <include refid="selectVehicleGpsVo"/> |
| | | <where> |
| | | <if test="vehicleNo != null and vehicleNo != ''"> and vehicle_no = #{vehicleNo}</if> |
| | | <if test="vehicleNo != null and vehicleNo != ''"> and v.vehicle_no like concat('%', #{vehicleNo}, '%')</if> |
| | | <if test="longitude != null "> and longitude = #{longitude}</if> |
| | | <if test="latitude != null "> and latitude = #{latitude}</if> |
| | | <if test="speed != null "> and speed = #{speed}</if> |
| | |
| | | order by collect_time |
| | | </select> |
| | | |
| | | <!-- 查询活跃车辆ID(优化:添加LIMIT限制,避免大表扫描) --> |
| | | <select id="selectActiveVehicleIds" resultType="Long"> |
| | | select distinct vehicle_id |
| | | from tb_vehicle_gps |
| | | where collect_time >= DATE_SUB(NOW(), INTERVAL 7 DAY) |
| | | where collect_time >= #{startTime} |
| | | order by vehicle_id |
| | | </select> |
| | | |