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.RepairInputDetailsMapper;
import com.bonus.material.repair.domain.RepairInputDetails;
import com.bonus.material.repair.service.IRepairInputDetailsService;

/**
 * 修试后入库Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService {
    @Autowired
    private RepairInputDetailsMapper repairInputDetailsMapper;

    /**
     * 查询修试后入库
     * 
     * @param id 修试后入库主键
     * @return 修试后入库
     */
    @Override
    public RepairInputDetails selectRepairInputDetailsById(Long id) {
        return repairInputDetailsMapper.selectRepairInputDetailsById(id);
    }

    /**
     * 查询修试后入库列表
     * 
     * @param repairInputDetails 修试后入库
     * @return 修试后入库
     */
    @Override
    public List<RepairInputDetails> selectRepairInputDetailsList(RepairInputDetails repairInputDetails) {
        return repairInputDetailsMapper.selectRepairInputDetailsList(repairInputDetails);
    }

    /**
     * 新增修试后入库
     * 
     * @param repairInputDetails 修试后入库
     * @return 结果
     */
    @Override
    public int insertRepairInputDetails(RepairInputDetails repairInputDetails) {
        repairInputDetails.setCreateTime(DateUtils.getNowDate());
        try {
            return repairInputDetailsMapper.insertRepairInputDetails(repairInputDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改修试后入库
     * 
     * @param repairInputDetails 修试后入库
     * @return 结果
     */
    @Override
    public int updateRepairInputDetails(RepairInputDetails repairInputDetails) {
        repairInputDetails.setUpdateTime(DateUtils.getNowDate());
        try {
            return repairInputDetailsMapper.updateRepairInputDetails(repairInputDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除修试后入库
     * 
     * @param ids 需要删除的修试后入库主键
     * @return 结果
     */
    @Override
    public int deleteRepairInputDetailsByIds(Long[] ids) {
        return repairInputDetailsMapper.deleteRepairInputDetailsByIds(ids);
    }

    /**
     * 删除修试后入库信息
     * 
     * @param id 修试后入库主键
     * @return 结果
     */
    @Override
    public int deleteRepairInputDetailsById(Long id) {
        return repairInputDetailsMapper.deleteRepairInputDetailsById(id);
    }
}
