package com.qaup.system.service.impl;

import java.util.Collections;
import java.util.List;
import com.qaup.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.qaup.system.mapper.SysVehicleInfoMapper;
import com.qaup.system.domain.SysVehicleInfo;
import com.qaup.system.service.ISysVehicleInfoService;

/**
 * 车辆信息Service业务层处理
 * 
 * @author tellme
 * @date 2025-07-01
 */
@Service
public class SysVehicleInfoServiceImpl implements ISysVehicleInfoService 
{
    @Autowired
    private SysVehicleInfoMapper sysVehicleInfoMapper;

    /**
     * 查询车辆信息
     * 
     * @param vehicleId 车辆信息主键
     * @return 车辆信息
     */
    @Override
    public SysVehicleInfo selectSysVehicleInfoByVehicleId(Long vehicleId)
    {
        return sysVehicleInfoMapper.selectSysVehicleInfoByVehicleId(vehicleId);
    }

    /**
     * 查询车辆信息列表
     * 
     * @param sysVehicleInfo 车辆信息
     * @return 车辆信息
     */
    @Override
    public List<SysVehicleInfo> selectSysVehicleInfoList(SysVehicleInfo sysVehicleInfo)
    {
        return sysVehicleInfoMapper.selectSysVehicleInfoList(sysVehicleInfo);
    }

    /**
     * 新增车辆信息
     * 
     * @param sysVehicleInfo 车辆信息
     * @return 结果
     */
    @Override
    public int insertSysVehicleInfo(SysVehicleInfo sysVehicleInfo)
    {
        sysVehicleInfo.setCreateTime(DateUtils.getNowDate());
        return sysVehicleInfoMapper.insertSysVehicleInfo(sysVehicleInfo);
    }

    /**
     * 修改车辆信息
     * 
     * @param sysVehicleInfo 车辆信息
     * @return 结果
     */
    @Override
    public int updateSysVehicleInfo(SysVehicleInfo sysVehicleInfo)
    {
        sysVehicleInfo.setUpdateTime(DateUtils.getNowDate());
        return sysVehicleInfoMapper.updateSysVehicleInfo(sysVehicleInfo);
    }

    /**
     * 批量删除车辆信息
     * 
     * @param vehicleIds 需要删除的车辆信息主键
     * @return 结果
     */
    @Override
    public int deleteSysVehicleInfoByVehicleIds(Long[] vehicleIds)
    {
        return sysVehicleInfoMapper.deleteSysVehicleInfoByVehicleIds(vehicleIds);
    }

    /**
     * 删除车辆信息信息
     * 
     * @param vehicleId 车辆信息主键
     * @return 结果
     */
    @Override
    public int deleteSysVehicleInfoByVehicleId(Long vehicleId)
    {
        return sysVehicleInfoMapper.deleteSysVehicleInfoByVehicleId(vehicleId);
    }

    /**
     * 批量查询车牌号是否存在
     * 
     * @param plateNumbers 车牌号列表
     * @return 存在的车牌号列表
     */
    @Override
    public List<String> selectExistingLicensePlates(List<String> plateNumbers)
    {
        if (plateNumbers == null || plateNumbers.isEmpty()) {
            return Collections.emptyList();
        }
        return sysVehicleInfoMapper.selectExistingLicensePlates(plateNumbers);
    }
}
