package com.ruoyi.app.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.app.mapper.PurchaserMapper;
import com.ruoyi.app.domain.Purchaser;
import com.ruoyi.app.service.IPurchaserService;

/**
 * 肉商Service业务层处理
 * 
 * @author coede
 * @date 2025-03-19
 */
@Service
public class PurchaserServiceImpl implements IPurchaserService 
{
    @Autowired
    private PurchaserMapper purchaserMapper;

    /**
     * 查询肉商
     * 
     * @param id 肉商主键
     * @return 肉商
     */
    @Override
    public Purchaser selectPurchaserById(Long id)
    {
        return purchaserMapper.selectPurchaserById(id);
    }

    /**
     * 查询肉商列表
     * 
     * @param purchaser 肉商
     * @return 肉商
     */
    @Override
    public List<Purchaser> selectPurchaserList(Purchaser purchaser)
    {
        return purchaserMapper.selectPurchaserList(purchaser);
    }

    /**
     * 查询全部肉商
     *
     *
     * @return 肉商
     */
    @Override
    public List<Purchaser> selectAllPurchaserList()
    {
        return purchaserMapper.selectPurchaserAll();
    }

    /**
     * 新增肉商
     * 
     * @param purchaser 肉商
     * @return 结果
     */
    @Override
    public int insertPurchaser(Purchaser purchaser)
    {
        purchaser.setCreateTime(DateUtils.getNowDate());
        return purchaserMapper.insertPurchaser(purchaser);
    }

    /**
     * 修改肉商
     * 
     * @param purchaser 肉商
     * @return 结果
     */
    @Override
    public int updatePurchaser(Purchaser purchaser)
    {
        purchaser.setUpdateTime(DateUtils.getNowDate());
        return purchaserMapper.updatePurchaser(purchaser);
    }

    /**
     * 批量删除肉商
     * 
     * @param ids 需要删除的肉商主键
     * @return 结果
     */
    @Override
    public int deletePurchaserByIds(Long[] ids)
    {
        return purchaserMapper.deletePurchaserByIds(ids);
    }

    /**
     * 删除肉商信息
     * 
     * @param id 肉商主键
     * @return 结果
     */
    @Override
    public int deletePurchaserById(Long id)
    {
        return purchaserMapper.deletePurchaserById(id);
    }
}
