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.DibangDriverMapper;
import com.ruoyi.common.core.domain.entity.DibangDriver;
import com.ruoyi.weighbridge.service.IDibangDriverService;

/**
 * 司机管理Service业务层处理
 * 
 * @author liuhj
 * @date 2022-03-10
 */
@Service
public class DibangDriverServiceImpl implements IDibangDriverService 
{
    @Autowired
    private DibangDriverMapper dibangDriverMapper;

    /**
     * 查询司机管理
     * 
     * @param driverId 司机管理主键
     * @return 司机管理
     */
    @Override
    public DibangDriver selectDibangDriverByDriverId(String driverId)
    {
        return dibangDriverMapper.selectDibangDriverByDriverId(driverId);
    }

    /**
     * 查询司机管理列表
     * 
     * @param dibangDriver 司机管理
     * @return 司机管理
     */
    @Override
    public List<DibangDriver> selectDibangDriverList(DibangDriver dibangDriver)
    {
        return dibangDriverMapper.selectDibangDriverList(dibangDriver);
    }

    /**
     * 新增司机管理
     * 
     * @param dibangDriver 司机管理
     * @return 结果
     */
    @Override
    public int insertDibangDriver(DibangDriver dibangDriver)
    {
        dibangDriver.setCreateTime(DateUtils.getNowDate());
        dibangDriver.setDriverId(IdUtils.fastUUID());
        return dibangDriverMapper.insertDibangDriver(dibangDriver);
    }

    /**
     * 修改司机管理
     * 
     * @param dibangDriver 司机管理
     * @return 结果
     */
    @Override
    public int updateDibangDriver(DibangDriver dibangDriver)
    {
        dibangDriver.setUpdateTime(DateUtils.getNowDate());
        return dibangDriverMapper.updateDibangDriver(dibangDriver);
    }

    /**
     * 批量删除司机管理
     * 
     * @param driverIds 需要删除的司机管理主键
     * @return 结果
     */
    @Override
    public int deleteDibangDriverByDriverIds(String[] driverIds)
    {
        return dibangDriverMapper.deleteDibangDriverByDriverIds(driverIds);
    }

    /**
     * 删除司机管理信息
     * 
     * @param driverId 司机管理主键
     * @return 结果
     */
    @Override
    public int deleteDibangDriverByDriverId(String driverId)
    {
        return dibangDriverMapper.deleteDibangDriverByDriverId(driverId);
    }

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