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.BackApplyDetailsMapper;
import com.bonus.material.back.domain.BackApplyDetails;
import com.bonus.material.back.service.IBackApplyDetailsService;

/**
 * 退料任务详细Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class BackApplyDetailsServiceImpl implements IBackApplyDetailsService {
    @Autowired
    private BackApplyDetailsMapper backApplyDetailsMapper;

    /**
     * 查询退料任务详细
     * 
     * @param id 退料任务详细主键
     * @return 退料任务详细
     */
    @Override
    public BackApplyDetails selectBackApplyDetailsById(Long id) {
        return backApplyDetailsMapper.selectBackApplyDetailsById(id);
    }

    /**
     * 查询退料任务详细列表
     * 
     * @param backApplyDetails 退料任务详细
     * @return 退料任务详细
     */
    @Override
    public List<BackApplyDetails> selectBackApplyDetailsList(BackApplyDetails backApplyDetails) {
        return backApplyDetailsMapper.selectBackApplyDetailsList(backApplyDetails);
    }

    /**
     * 新增退料任务详细
     * 
     * @param backApplyDetails 退料任务详细
     * @return 结果
     */
    @Override
    public int insertBackApplyDetails(BackApplyDetails backApplyDetails) {
        backApplyDetails.setCreateTime(DateUtils.getNowDate());
        try {
            return backApplyDetailsMapper.insertBackApplyDetails(backApplyDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改退料任务详细
     * 
     * @param backApplyDetails 退料任务详细
     * @return 结果
     */
    @Override
    public int updateBackApplyDetails(BackApplyDetails backApplyDetails) {
        backApplyDetails.setUpdateTime(DateUtils.getNowDate());
        try {
            return backApplyDetailsMapper.updateBackApplyDetails(backApplyDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除退料任务详细
     * 
     * @param ids 需要删除的退料任务详细主键
     * @return 结果
     */
    @Override
    public int deleteBackApplyDetailsByIds(Long[] ids) {
        return backApplyDetailsMapper.deleteBackApplyDetailsByIds(ids);
    }

    /**
     * 删除退料任务详细信息
     * 
     * @param id 退料任务详细主键
     * @return 结果
     */
    @Override
    public int deleteBackApplyDetailsById(Long id) {
        return backApplyDetailsMapper.deleteBackApplyDetailsById(id);
    }
}
