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.CompanyMaterialMapper;
import com.fs.company.domain.CompanyMaterial;
import com.fs.company.service.ICompanyMaterialService;

/**
 * 原材料Service业务层处理
 * 
 * @author fs
 * @date 2025-07-01
 */
@Service
public class CompanyMaterialServiceImpl implements ICompanyMaterialService 
{
    @Autowired
    private CompanyMaterialMapper companyMaterialMapper;

    /**
     * 查询原材料
     * 
     * @param id 原材料主键
     * @return 原材料
     */
    @Override
    public CompanyMaterial selectCompanyMaterialById(Long id)
    {
        return companyMaterialMapper.selectCompanyMaterialById(id);
    }

    /**
     * 查询原材料列表
     * 
     * @param companyMaterial 原材料
     * @return 原材料
     */
    @Override
    public List<CompanyMaterial> selectCompanyMaterialList(CompanyMaterial companyMaterial)
    {
        return companyMaterialMapper.selectCompanyMaterialList(companyMaterial);
    }

    /**
     * 新增原材料
     * 
     * @param companyMaterial 原材料
     * @return 结果
     */
    @Override
    public int insertCompanyMaterial(CompanyMaterial companyMaterial)
    {
        companyMaterial.setCreateTime(DateUtils.getNowDate());
        return companyMaterialMapper.insertCompanyMaterial(companyMaterial);
    }

    /**
     * 修改原材料
     * 
     * @param companyMaterial 原材料
     * @return 结果
     */
    @Override
    public int updateCompanyMaterial(CompanyMaterial companyMaterial)
    {
        companyMaterial.setUpdateTime(DateUtils.getNowDate());
        return companyMaterialMapper.updateCompanyMaterial(companyMaterial);
    }

    /**
     * 批量删除原材料
     * 
     * @param ids 需要删除的原材料主键
     * @return 结果
     */
    @Override
    public int deleteCompanyMaterialByIds(Long[] ids)
    {
        return companyMaterialMapper.deleteCompanyMaterialByIds(ids);
    }

    /**
     * 删除原材料信息
     * 
     * @param id 原材料主键
     * @return 结果
     */
    @Override
    public int deleteCompanyMaterialById(Long id)
    {
        return companyMaterialMapper.deleteCompanyMaterialById(id);
    }
}
