package com.ruoyi.weighbridge.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.weighbridge.mapper.DibangCarMapper;
import com.ruoyi.common.core.domain.entity.DibangCar;
import com.ruoyi.weighbridge.service.IDibangCarService;

/**
 * 车辆Service业务层处理
 * 
 * @author liuhj
 * @date 2022-03-10
 */
@Service
public class DibangCarServiceImpl implements IDibangCarService 
{
    @Autowired
    private DibangCarMapper dibangCarMapper;

    /**
     * 查询车辆
     * 
     * @param carId 车辆主键
     * @return 车辆
     */
    @Override
    public DibangCar selectDibangCarByCarId(String carId)
    {
        return dibangCarMapper.selectDibangCarByCarId(carId);
    }

    /**
     * 查询车辆列表
     * 
     * @param dibangCar 车辆
     * @return 车辆
     */
    @Override
    public List<DibangCar> selectDibangCarList(DibangCar dibangCar)
    {
        return dibangCarMapper.selectDibangCarList(dibangCar);
    }

    /**
     * 新增车辆
     * 
     * @param dibangCar 车辆
     * @return 结果
     */
    @Override
    public int insertDibangCar(DibangCar dibangCar)
    {
        dibangCar.setCreateTime(DateUtils.getNowDate());
        dibangCar.setCarId(IdUtils.fastUUID());
        return dibangCarMapper.insertDibangCar(dibangCar);
    }

    /**
     * 修改车辆
     * 
     * @param dibangCar 车辆
     * @return 结果
     */
    @Override
    public int updateDibangCar(DibangCar dibangCar)
    {
        dibangCar.setModifyTime(DateUtils.getNowDate());
        return dibangCarMapper.updateDibangCar(dibangCar);
    }

    /**
     * 批量删除车辆
     * 
     * @param carIds 需要删除的车辆主键
     * @return 结果
     */
    @Override
    public int deleteDibangCarByCarIds(String[] carIds)
    {
        return dibangCarMapper.deleteDibangCarByCarIds(carIds);
    }

    /**
     * 删除车辆信息
     * 
     * @param carId 车辆主键
     * @return 结果
     */
    @Override
    public int deleteDibangCarByCarId(String carId)
    {
        return dibangCarMapper.deleteDibangCarByCarId(carId);
    }

    /**
     * 根据车牌号查询车辆
     *
     * @param plateNo 车牌号
     * @return 结果
     */
    @Override
    public DibangCar selectDibangCarByPlateNo(String plateNo)
    {
        return dibangCarMapper.selectDibangCarByPlateNo(plateNo);
    }
}
