package com.bonus.material.input.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.input.mapper.InputApplyDetailsMapper;
import com.bonus.material.input.domain.InputApplyDetails;
import com.bonus.material.input.service.IInputApplyDetailsService;

/**
 * 入库任务详细Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class InputApplyDetailsServiceImpl implements IInputApplyDetailsService {
    @Autowired
    private InputApplyDetailsMapper inputApplyDetailsMapper;

    /**
     * 查询入库任务详细
     * 
     * @param id 入库任务详细主键
     * @return 入库任务详细
     */
    @Override
    public InputApplyDetails selectInputApplyDetailsById(Long id) {
        return inputApplyDetailsMapper.selectInputApplyDetailsById(id);
    }

    /**
     * 查询入库任务详细列表
     * 
     * @param inputApplyDetails 入库任务详细
     * @return 入库任务详细
     */
    @Override
    public List<InputApplyDetails> selectInputApplyDetailsList(InputApplyDetails inputApplyDetails) {
        return inputApplyDetailsMapper.selectInputApplyDetailsList(inputApplyDetails);
    }

    /**
     * 新增入库任务详细
     * 
     * @param inputApplyDetails 入库任务详细
     * @return 结果
     */
    @Override
    public int insertInputApplyDetails(InputApplyDetails inputApplyDetails) {
        inputApplyDetails.setCreateTime(DateUtils.getNowDate());
        try {
            return inputApplyDetailsMapper.insertInputApplyDetails(inputApplyDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改入库任务详细
     * 
     * @param inputApplyDetails 入库任务详细
     * @return 结果
     */
    @Override
    public int updateInputApplyDetails(InputApplyDetails inputApplyDetails) {
        inputApplyDetails.setUpdateTime(DateUtils.getNowDate());
        try {
            return inputApplyDetailsMapper.updateInputApplyDetails(inputApplyDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

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

    /**
     * 删除入库任务详细信息
     * 
     * @param id 入库任务详细主键
     * @return 结果
     */
    @Override
    public int deleteInputApplyDetailsById(Long id) {
        return inputApplyDetailsMapper.deleteInputApplyDetailsById(id);
    }
}
