package com.ruoyi.baseinfo.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.baseinfo.mapper.BaseMaterialInfoMapper;
import com.ruoyi.baseinfo.domain.BaseMaterialInfo;
import com.ruoyi.baseinfo.service.IBaseMaterialInfoService;
import com.ruoyi.common.core.text.Convert;

/**
 * 物料基础信息Service业务层处理
 * 
 * @author CaesarBao
 * @date 2020-10-22
 */
@Service
public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService 
{
    @Autowired
    private BaseMaterialInfoMapper baseMaterialInfoMapper;

    /**
     * 查询物料基础信息
     * 
     * @param objid 物料基础信息ID
     * @return 物料基础信息
     */
    @Override
    public BaseMaterialInfo selectBaseMaterialInfoById(Long objid)
    {
        return baseMaterialInfoMapper.selectBaseMaterialInfoById(objid);
    }

    /**
     * 查询物料基础信息列表
     * 
     * @param baseMaterialInfo 物料基础信息
     * @return 物料基础信息
     */
    @Override
    public List<BaseMaterialInfo> selectBaseMaterialInfoList(BaseMaterialInfo baseMaterialInfo)
    {
        return baseMaterialInfoMapper.selectBaseMaterialInfoList(baseMaterialInfo);
    }

    /**
     * 新增物料基础信息
     * 
     * @param baseMaterialInfo 物料基础信息
     * @return 结果
     */
    @Override
    public int insertBaseMaterialInfo(BaseMaterialInfo baseMaterialInfo)
    {
        baseMaterialInfo.setCreateTime(DateUtils.getNowDate());
        return baseMaterialInfoMapper.insertBaseMaterialInfo(baseMaterialInfo);
    }

    /**
     * 修改物料基础信息
     * 
     * @param baseMaterialInfo 物料基础信息
     * @return 结果
     */
    @Override
    public int updateBaseMaterialInfo(BaseMaterialInfo baseMaterialInfo)
    {
        baseMaterialInfo.setUpdateTime(DateUtils.getNowDate());
        return baseMaterialInfoMapper.updateBaseMaterialInfo(baseMaterialInfo);
    }

    /**
     * 删除物料基础信息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBaseMaterialInfoByIds(String ids)
    {
        return baseMaterialInfoMapper.deleteBaseMaterialInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除物料基础信息信息
     * 
     * @param objid 物料基础信息ID
     * @return 结果
     */
    @Override
    public int deleteBaseMaterialInfoById(Long objid)
    {
        return baseMaterialInfoMapper.deleteBaseMaterialInfoById(objid);
    }
}
