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.PurchasePartDetailsMapper;
import com.bonus.material.purchase.domain.PurchasePartDetails;
import com.bonus.material.purchase.service.IPurchasePartDetailsService;

/**
 * 新购配件验收任务详细Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class PurchasePartDetailsServiceImpl implements IPurchasePartDetailsService {
    @Autowired
    private PurchasePartDetailsMapper purchasePartDetailsMapper;

    /**
     * 查询新购配件验收任务详细
     * 
     * @param id 新购配件验收任务详细主键
     * @return 新购配件验收任务详细
     */
    @Override
    public PurchasePartDetails selectPurchasePartDetailsById(Long id) {
        return purchasePartDetailsMapper.selectPurchasePartDetailsById(id);
    }

    /**
     * 查询新购配件验收任务详细列表
     * 
     * @param purchasePartDetails 新购配件验收任务详细
     * @return 新购配件验收任务详细
     */
    @Override
    public List<PurchasePartDetails> selectPurchasePartDetailsList(PurchasePartDetails purchasePartDetails) {
        return purchasePartDetailsMapper.selectPurchasePartDetailsList(purchasePartDetails);
    }

    /**
     * 新增新购配件验收任务详细
     * 
     * @param purchasePartDetails 新购配件验收任务详细
     * @return 结果
     */
    @Override
    public int insertPurchasePartDetails(PurchasePartDetails purchasePartDetails) {
        purchasePartDetails.setCreateTime(DateUtils.getNowDate());
        try {
            return purchasePartDetailsMapper.insertPurchasePartDetails(purchasePartDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改新购配件验收任务详细
     * 
     * @param purchasePartDetails 新购配件验收任务详细
     * @return 结果
     */
    @Override
    public int updatePurchasePartDetails(PurchasePartDetails purchasePartDetails) {
        purchasePartDetails.setUpdateTime(DateUtils.getNowDate());
        try {
            return purchasePartDetailsMapper.updatePurchasePartDetails(purchasePartDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除新购配件验收任务详细
     * 
     * @param ids 需要删除的新购配件验收任务详细主键
     * @return 结果
     */
    @Override
    public int deletePurchasePartDetailsByIds(Long[] ids) {
        return purchasePartDetailsMapper.deletePurchasePartDetailsByIds(ids);
    }

    /**
     * 删除新购配件验收任务详细信息
     * 
     * @param id 新购配件验收任务详细主键
     * @return 结果
     */
    @Override
    public int deletePurchasePartDetailsById(Long id) {
        return purchasePartDetailsMapper.deletePurchasePartDetailsById(id);
    }
}
