package com.zehong.system.service.impl;

import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.ReceivedNbFailureHistory;
import com.zehong.system.mapper.ReceivedNbFailureHistoryMapper;
import com.zehong.system.service.IReceivedNbFailureHistoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 获取NB码失败记录Service业务层处理
 *
 * @author zehong
 * @date 2026-07-18
 */
@Service
public class ReceivedNbFailureHistoryServiceImpl implements IReceivedNbFailureHistoryService
{
    @Resource
    private ReceivedNbFailureHistoryMapper receivedNbFailureHistoryMapper;

    /**
     * 查询获取NB码失败记录
     *
     * @param id 获取NB码失败记录ID
     * @return 获取NB码失败记录
     */
    @Override
    public ReceivedNbFailureHistory selectReceivedNbFailureHistoryById(Long id)
    {
        return receivedNbFailureHistoryMapper.selectReceivedNbFailureHistoryById(id);
    }

    /**
     * 查询获取NB码失败记录列表
     *
     * @param receivedNbFailureHistory 获取NB码失败记录
     * @return 获取NB码失败记录
     */
    @Override
    public List<ReceivedNbFailureHistory> selectReceivedNbFailureHistoryList(ReceivedNbFailureHistory receivedNbFailureHistory)
    {
        return receivedNbFailureHistoryMapper.selectReceivedNbFailureHistoryList(receivedNbFailureHistory);
    }

    /**
     * 新增获取NB码失败记录
     *
     * @param receivedNbFailureHistory 获取NB码失败记录
     * @return 结果
     */
    @Override
    public int insertReceivedNbFailureHistory(ReceivedNbFailureHistory receivedNbFailureHistory)
    {
        receivedNbFailureHistory.setCreateTime(DateUtils.getNowDate());
        return receivedNbFailureHistoryMapper.insertReceivedNbFailureHistory(receivedNbFailureHistory);
    }

    /**
     * 修改获取NB码失败记录
     *
     * @param receivedNbFailureHistory 获取NB码失败记录
     * @return 结果
     */
    @Override
    public int updateReceivedNbFailureHistory(ReceivedNbFailureHistory receivedNbFailureHistory)
    {
        return receivedNbFailureHistoryMapper.updateReceivedNbFailureHistory(receivedNbFailureHistory);
    }

    /**
     * 批量删除获取NB码失败记录
     *
     * @param ids 需要删除的获取NB码失败记录ID
     * @return 结果
     */
    @Override
    public int deleteReceivedNbFailureHistoryByIds(Long[] ids)
    {
        return receivedNbFailureHistoryMapper.deleteReceivedNbFailureHistoryByIds(ids);
    }

    /**
     * 删除获取NB码失败记录信息
     *
     * @param id 获取NB码失败记录ID
     * @return 结果
     */
    @Override
    public int deleteReceivedNbFailureHistoryById(Long id)
    {
        return receivedNbFailureHistoryMapper.deleteReceivedNbFailureHistoryById(id);
    }
}
