package com.ruoyi.model.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.model.mapper.ServiceRecordMapper;
import com.ruoyi.model.domain.ServiceRecord;
import com.ruoyi.model.service.IServiceRecordService;

/**
 * 服务记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-06
 */
@Service
public class ServiceRecordServiceImpl implements IServiceRecordService 
{
    @Autowired
    private ServiceRecordMapper serviceRecordMapper;

    /**
     * 查询服务记录
     * 
     * @param id 服务记录主键
     * @return 服务记录
     */
    @Override
    public ServiceRecord selectServiceRecordById(Long id)
    {
        return serviceRecordMapper.selectServiceRecordById(id);
    }

    /**
     * 查询服务记录列表
     * 
     * @param serviceRecord 服务记录
     * @return 服务记录
     */
    @Override
    public List<ServiceRecord> selectServiceRecordList(ServiceRecord serviceRecord)
    {
        return serviceRecordMapper.selectServiceRecordList(serviceRecord);
    }

    /**
     * 新增服务记录
     * 
     * @param serviceRecord 服务记录
     * @return 结果
     */
    @Override
    public int insertServiceRecord(ServiceRecord serviceRecord)
    {
        serviceRecord.setCreateTime(DateUtils.getNowDate());
        return serviceRecordMapper.insertServiceRecord(serviceRecord);
    }

    /**
     * 修改服务记录
     * 
     * @param serviceRecord 服务记录
     * @return 结果
     */
    @Override
    public int updateServiceRecord(ServiceRecord serviceRecord)
    {
        serviceRecord.setUpdateTime(DateUtils.getNowDate());
        return serviceRecordMapper.updateServiceRecord(serviceRecord);
    }

    /**
     * 批量删除服务记录
     * 
     * @param ids 需要删除的服务记录主键
     * @return 结果
     */
    @Override
    public int deleteServiceRecordByIds(Long[] ids)
    {
        return serviceRecordMapper.deleteServiceRecordByIds(ids);
    }

    /**
     * 删除服务记录信息
     * 
     * @param id 服务记录主键
     * @return 结果
     */
    @Override
    public int deleteServiceRecordById(Long id)
    {
        return serviceRecordMapper.deleteServiceRecordById(id);
    }

    /**
     * 查询服务记录列表
     *
     * @return 服务记录集合
     */
    @Override
    public List<ServiceRecord> getServiceRecordList(){
        return serviceRecordMapper.getServiceRecordList();
    }
}
