package com.bonus.material.repair.service.impl;

import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.repair.mapper.RepairApplyDetailsMapper;
import com.bonus.material.repair.domain.RepairApplyDetails;
import com.bonus.material.repair.service.IRepairApplyDetailsService;

/**
 * 维修详细Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class RepairApplyDetailsServiceImpl implements IRepairApplyDetailsService {
    @Autowired
    private RepairApplyDetailsMapper repairApplyDetailsMapper;

    /**
     * 查询维修详细
     * 
     * @param id 维修详细主键
     * @return 维修详细
     */
    @Override
    public RepairApplyDetails selectRepairApplyDetailsById(Long id) {
        return repairApplyDetailsMapper.selectRepairApplyDetailsById(id);
    }

    /**
     * 查询维修详细列表
     * 
     * @param repairApplyDetails 维修详细
     * @return 维修详细
     */
    @Override
    public List<RepairApplyDetails> selectRepairApplyDetailsList(RepairApplyDetails repairApplyDetails) {
        return repairApplyDetailsMapper.selectRepairApplyDetailsList(repairApplyDetails);
    }

    /**
     * 新增维修详细
     * 
     * @param repairApplyDetails 维修详细
     * @return 结果
     */
    @Override
    public int insertRepairApplyDetails(RepairApplyDetails repairApplyDetails) {
        repairApplyDetails.setCreateTime(DateUtils.getNowDate());
        try {
            return repairApplyDetailsMapper.insertRepairApplyDetails(repairApplyDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改维修详细
     * 
     * @param repairApplyDetails 维修详细
     * @return 结果
     */
    @Override
    public int updateRepairApplyDetails(RepairApplyDetails repairApplyDetails) {
        repairApplyDetails.setUpdateTime(DateUtils.getNowDate());
        try {
            return repairApplyDetailsMapper.updateRepairApplyDetails(repairApplyDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除维修详细
     * 
     * @param ids 需要删除的维修详细主键
     * @return 结果
     */
    @Override
    public int deleteRepairApplyDetailsByIds(Long[] ids) {
        return repairApplyDetailsMapper.deleteRepairApplyDetailsByIds(ids);
    }

    /**
     * 删除维修详细信息
     * 
     * @param id 维修详细主键
     * @return 结果
     */
    @Override
    public int deleteRepairApplyDetailsById(Long id) {
        return repairApplyDetailsMapper.deleteRepairApplyDetailsById(id);
    }
}
