package com.bonus.material.back.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.back.mapper.BackCheckDetailsMapper;
import com.bonus.material.back.domain.BackCheckDetails;
import com.bonus.material.back.service.IBackCheckDetailsService;

/**
 * 退料核查Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class BackCheckDetailsServiceImpl implements IBackCheckDetailsService {
    @Autowired
    private BackCheckDetailsMapper backCheckDetailsMapper;

    /**
     * 查询退料核查
     * 
     * @param id 退料核查主键
     * @return 退料核查
     */
    @Override
    public BackCheckDetails selectBackCheckDetailsById(Long id) {
        return backCheckDetailsMapper.selectBackCheckDetailsById(id);
    }

    /**
     * 查询退料核查列表
     * 
     * @param backCheckDetails 退料核查
     * @return 退料核查
     */
    @Override
    public List<BackCheckDetails> selectBackCheckDetailsList(BackCheckDetails backCheckDetails) {
        return backCheckDetailsMapper.selectBackCheckDetailsList(backCheckDetails);
    }

    /**
     * 新增退料核查
     * 
     * @param backCheckDetails 退料核查
     * @return 结果
     */
    @Override
    public int insertBackCheckDetails(BackCheckDetails backCheckDetails) {
        backCheckDetails.setCreateTime(DateUtils.getNowDate());
        try {
            return backCheckDetailsMapper.insertBackCheckDetails(backCheckDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改退料核查
     * 
     * @param backCheckDetails 退料核查
     * @return 结果
     */
    @Override
    public int updateBackCheckDetails(BackCheckDetails backCheckDetails) {
        backCheckDetails.setUpdateTime(DateUtils.getNowDate());
        try {
            return backCheckDetailsMapper.updateBackCheckDetails(backCheckDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除退料核查
     * 
     * @param ids 需要删除的退料核查主键
     * @return 结果
     */
    @Override
    public int deleteBackCheckDetailsByIds(Long[] ids) {
        return backCheckDetailsMapper.deleteBackCheckDetailsByIds(ids);
    }

    /**
     * 删除退料核查信息
     * 
     * @param id 退料核查主键
     * @return 结果
     */
    @Override
    public int deleteBackCheckDetailsById(Long id) {
        return backCheckDetailsMapper.deleteBackCheckDetailsById(id);
    }
}
