package com.bonus.material.purchase.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.purchase.mapper.PurchaseMacodeInfoMapper;
import com.bonus.material.purchase.domain.PurchaseMacodeInfo;
import com.bonus.material.purchase.service.IPurchaseMacodeInfoService;

/**
 * 新购验收编号管理Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService {
    @Autowired
    private PurchaseMacodeInfoMapper purchaseMacodeInfoMapper;

    /**
     * 查询新购验收编号管理
     * 
     * @param id 新购验收编号管理主键
     * @return 新购验收编号管理
     */
    @Override
    public PurchaseMacodeInfo selectPurchaseMacodeInfoById(Long id) {
        return purchaseMacodeInfoMapper.selectPurchaseMacodeInfoById(id);
    }

    /**
     * 查询新购验收编号管理列表
     * 
     * @param purchaseMacodeInfo 新购验收编号管理
     * @return 新购验收编号管理
     */
    @Override
    public List<PurchaseMacodeInfo> selectPurchaseMacodeInfoList(PurchaseMacodeInfo purchaseMacodeInfo) {
        return purchaseMacodeInfoMapper.selectPurchaseMacodeInfoList(purchaseMacodeInfo);
    }

    /**
     * 新增新购验收编号管理
     * 
     * @param purchaseMacodeInfo 新购验收编号管理
     * @return 结果
     */
    @Override
    public int insertPurchaseMacodeInfo(PurchaseMacodeInfo purchaseMacodeInfo) {
        purchaseMacodeInfo.setCreateTime(DateUtils.getNowDate());
        try {
            return purchaseMacodeInfoMapper.insertPurchaseMacodeInfo(purchaseMacodeInfo);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改新购验收编号管理
     * 
     * @param purchaseMacodeInfo 新购验收编号管理
     * @return 结果
     */
    @Override
    public int updatePurchaseMacodeInfo(PurchaseMacodeInfo purchaseMacodeInfo) {
        purchaseMacodeInfo.setUpdateTime(DateUtils.getNowDate());
        try {
            return purchaseMacodeInfoMapper.updatePurchaseMacodeInfo(purchaseMacodeInfo);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除新购验收编号管理
     * 
     * @param ids 需要删除的新购验收编号管理主键
     * @return 结果
     */
    @Override
    public int deletePurchaseMacodeInfoByIds(Long[] ids) {
        return purchaseMacodeInfoMapper.deletePurchaseMacodeInfoByIds(ids);
    }

    /**
     * 删除新购验收编号管理信息
     * 
     * @param id 新购验收编号管理主键
     * @return 结果
     */
    @Override
    public int deletePurchaseMacodeInfoById(Long id) {
        return purchaseMacodeInfoMapper.deletePurchaseMacodeInfoById(id);
    }
}
