package com.hw.mes.service.impl;

import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesBaseSupplierInfoMapper;
import com.hw.mes.domain.MesBaseSupplierInfo;
import com.hw.mes.service.IMesBaseSupplierInfoService;

/**
 * 物料供应商信息Service业务层处理
 * 
 * @author Yinq
 * @date 2024-01-24
 */
@Service
public class MesBaseSupplierInfoServiceImpl implements IMesBaseSupplierInfoService 
{
    @Autowired
    private MesBaseSupplierInfoMapper mesBaseSupplierInfoMapper;

    /**
     * 查询物料供应商信息
     * 
     * @param supplierId 物料供应商信息主键
     * @return 物料供应商信息
     */
    @Override
    public MesBaseSupplierInfo selectMesBaseSupplierInfoBySupplierId(Long supplierId)
    {
        return mesBaseSupplierInfoMapper.selectMesBaseSupplierInfoBySupplierId(supplierId);
    }

    /**
     * 查询物料供应商信息列表
     * 
     * @param mesBaseSupplierInfo 物料供应商信息
     * @return 物料供应商信息
     */
    @Override
    public List<MesBaseSupplierInfo> selectMesBaseSupplierInfoList(MesBaseSupplierInfo mesBaseSupplierInfo)
    {
        return mesBaseSupplierInfoMapper.selectMesBaseSupplierInfoList(mesBaseSupplierInfo);
    }

    /**
     * 新增物料供应商信息
     * 
     * @param mesBaseSupplierInfo 物料供应商信息
     * @return 结果
     */
    @Override
    public int insertMesBaseSupplierInfo(MesBaseSupplierInfo mesBaseSupplierInfo)
    {
        mesBaseSupplierInfo.setCreateTime(DateUtils.getNowDate());
        mesBaseSupplierInfo.setCreateBy(SecurityUtils.getUsername());
        return mesBaseSupplierInfoMapper.insertMesBaseSupplierInfo(mesBaseSupplierInfo);
    }

    /**
     * 修改物料供应商信息
     * 
     * @param mesBaseSupplierInfo 物料供应商信息
     * @return 结果
     */
    @Override
    public int updateMesBaseSupplierInfo(MesBaseSupplierInfo mesBaseSupplierInfo)
    {
        mesBaseSupplierInfo.setUpdateTime(DateUtils.getNowDate());
        mesBaseSupplierInfo.setUpdateBy(SecurityUtils.getUsername());
        return mesBaseSupplierInfoMapper.updateMesBaseSupplierInfo(mesBaseSupplierInfo);
    }

    /**
     * 批量删除物料供应商信息
     * 
     * @param supplierIds 需要删除的物料供应商信息主键
     * @return 结果
     */
    @Override
    public int deleteMesBaseSupplierInfoBySupplierIds(Long[] supplierIds)
    {
        return mesBaseSupplierInfoMapper.deleteMesBaseSupplierInfoBySupplierIds(supplierIds);
    }

    /**
     * 删除物料供应商信息信息
     * 
     * @param supplierId 物料供应商信息主键
     * @return 结果
     */
    @Override
    public int deleteMesBaseSupplierInfoBySupplierId(Long supplierId)
    {
        return mesBaseSupplierInfoMapper.deleteMesBaseSupplierInfoBySupplierId(supplierId);
    }
}
