package com.evobms.project.VehicleData.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.evobms.project.VehicleData.mapper.VehicleLocationMapper;
import com.evobms.project.VehicleData.domain.VehicleLocation;
import com.evobms.project.VehicleData.service.IVehicleLocationService;

/**
 * 车辆位置数据Service业务层处理
 *
 * @author ruoyi
 * @date 2025-11-15
 */
@Service
public class VehicleLocationServiceImpl implements IVehicleLocationService
{
    @Autowired
    private VehicleLocationMapper vehicleLocationMapper;

    /**
     * 查询车辆位置数据
     *
     * @param id 车辆位置数据主键
     * @return 车辆位置数据
     */
    @Override
    public VehicleLocation selectVehicleLocationById(Long id)
    {
        return vehicleLocationMapper.selectVehicleLocationById(id);
    }

    /**
     * 查询车辆位置数据列表
     *
     * @param vehicleLocation 车辆位置数据
     * @return 车辆位置数据
     */
    @Override
    public List<VehicleLocation> selectVehicleLocationList(VehicleLocation vehicleLocation)
    {
        return vehicleLocationMapper.selectVehicleLocationList(vehicleLocation);
    }

    /**
     * 新增车辆位置数据
     *
     * @param vehicleLocation 车辆位置数据
     * @return 结果
     */
    @Override
    public int insertVehicleLocation(VehicleLocation vehicleLocation)
    {
        return vehicleLocationMapper.insertVehicleLocation(vehicleLocation);
    }

    /**
     * 修改车辆位置数据
     *
     * @param vehicleLocation 车辆位置数据
     * @return 结果
     */
    @Override
    public int updateVehicleLocation(VehicleLocation vehicleLocation)
    {
        return vehicleLocationMapper.updateVehicleLocation(vehicleLocation);
    }

    /**
     * 批量删除车辆位置数据
     *
     * @param ids 需要删除的车辆位置数据主键
     * @return 结果
     */
    @Override
    public int deleteVehicleLocationByIds(Long[] ids)
    {
        return vehicleLocationMapper.deleteVehicleLocationByIds(ids);
    }

    /**
     * 删除车辆位置数据信息
     *
     * @param id 车辆位置数据主键
     * @return 结果
     */
    @Override
    public int deleteVehicleLocationById(Long id)
    {
        return vehicleLocationMapper.deleteVehicleLocationById(id);
    }

    @Override
    public VehicleLocation selectLatestByDeviceId(String deviceId) {
        return vehicleLocationMapper.selectLatestByDeviceId(deviceId);
    }

    @Override
    public List<VehicleLocation> selectByDeviceAndRange(String deviceId, Date start, Date end, Integer limit) {
        return vehicleLocationMapper.selectByDeviceAndRange(deviceId, start, end, limit);
    }
}
