package com.fs.company.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.company.mapper.CompanyPurchaseMapper;
import com.fs.company.domain.CompanyPurchase;
import com.fs.company.service.ICompanyPurchaseService;

/**
 * 采购Service业务层处理
 * 
 * @author fs
 * @date 2025-07-01
 */
@Service
public class CompanyPurchaseServiceImpl implements ICompanyPurchaseService 
{
    @Autowired
    private CompanyPurchaseMapper companyPurchaseMapper;

    /**
     * 查询采购
     * 
     * @param id 采购主键
     * @return 采购
     */
    @Override
    public CompanyPurchase selectCompanyPurchaseById(Long id)
    {
        return companyPurchaseMapper.selectCompanyPurchaseById(id);
    }

    /**
     * 查询采购列表
     * 
     * @param companyPurchase 采购
     * @return 采购
     */
    @Override
    public List<CompanyPurchase> selectCompanyPurchaseList(CompanyPurchase companyPurchase)
    {
        return companyPurchaseMapper.selectCompanyPurchaseList(companyPurchase);
    }

    /**
     * 新增采购
     * 
     * @param companyPurchase 采购
     * @return 结果
     */
    @Override
    public int insertCompanyPurchase(CompanyPurchase companyPurchase)
    {
        companyPurchase.setCreateTime(DateUtils.getNowDate());
        return companyPurchaseMapper.insertCompanyPurchase(companyPurchase);
    }

    /**
     * 修改采购
     * 
     * @param companyPurchase 采购
     * @return 结果
     */
    @Override
    public int updateCompanyPurchase(CompanyPurchase companyPurchase)
    {
        companyPurchase.setUpdateTime(DateUtils.getNowDate());
        return companyPurchaseMapper.updateCompanyPurchase(companyPurchase);
    }

    /**
     * 批量删除采购
     * 
     * @param ids 需要删除的采购主键
     * @return 结果
     */
    @Override
    public int deleteCompanyPurchaseByIds(Long[] ids)
    {
        return companyPurchaseMapper.deleteCompanyPurchaseByIds(ids);
    }

    /**
     * 删除采购信息
     * 
     * @param id 采购主键
     * @return 结果
     */
    @Override
    public int deleteCompanyPurchaseById(Long id)
    {
        return companyPurchaseMapper.deleteCompanyPurchaseById(id);
    }
}
