package com.dcsoft.system.vehicle.service.impl;

import com.dcsoft.common.core.utils.DateUtils;
import com.dcsoft.system.vehicle.domain.CarCharge;
import com.dcsoft.system.vehicle.mapper.CarChargeMapper;
import com.dcsoft.system.vehicle.service.ICarChargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 收费配置Service业务层处理
 *
 * @author nichun
 * @date 2024-01-19
 */
@Service
public class CarChargeServiceImpl implements ICarChargeService
{
    @Autowired
    private CarChargeMapper carChargeMapper;

    /**
     * 查询收费配置
     *
     * @param id 收费配置主键
     * @return 收费配置
     */
    @Override
    public CarCharge selectCarChargeById(Long id)
    {
        return carChargeMapper.selectCarChargeById(id);
    }

    /**
     * 查询收费配置列表
     *
     * @param carCharge 收费配置
     * @return 收费配置
     */
    @Override
    public List<CarCharge> selectCarChargeList(CarCharge carCharge)
    {
        return carChargeMapper.selectCarChargeList(carCharge);
    }

    /**
     * 新增收费配置
     *
     * @param carCharge 收费配置
     * @return 结果
     */
    @Override
    public int insertCarCharge(CarCharge carCharge)
    {
        carCharge.setCreateTime(DateUtils.getNowDate());
        return carChargeMapper.insertCarCharge(carCharge);
    }

    /**
     * 修改收费配置
     *
     * @param carCharge 收费配置
     * @return 结果
     */
    @Override
    public int updateCarCharge(CarCharge carCharge)
    {
        carCharge.setUpdateTime(DateUtils.getNowDate());
        return carChargeMapper.updateCarCharge(carCharge);
    }

    /**
     * 批量删除收费配置
     *
     * @param ids 需要删除的收费配置主键
     * @return 结果
     */
    @Override
    public int deleteCarChargeByIds(Long[] ids)
    {
        return carChargeMapper.deleteCarChargeByIds(ids);
    }

    /**
     * 删除收费配置信息
     *
     * @param id 收费配置主键
     * @return 结果
     */
    @Override
    public int deleteCarChargeById(Long id)
    {
        return carChargeMapper.deleteCarChargeById(id);
    }
}
