package com.ruoyi.web.v1.service.impl;

import java.util.List;

import com.ruoyi.web.v1.DTO.SlaughterBatchDTO;
import com.ruoyi.web.v1.model.request.ReqSlaughterBatch;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.v1.mapper.SlaughterBatchMapper;
import com.ruoyi.web.v1.model.SlaughterBatch;
import com.ruoyi.web.v1.service.ISlaughterBatchService;

/**
 * 屠宰批次Service业务层处理
 * 
 * @author coede
 * @date 2025-03-19
 */
@Service
public class SlaughterBatchServiceImpl implements ISlaughterBatchService 
{
    @Autowired
    private SlaughterBatchMapper slaughterBatchMapper;

    /**
     * 查询屠宰批次
     * 
     * @param id 屠宰批次主键
     * @return 屠宰批次
     */
    @Override
    public SlaughterBatchDTO selectSlaughterBatchById(Long id)
    {
        return slaughterBatchMapper.selectSlaughterBatchById(id);
    }

    /**
     * 查询屠宰批次列表
     * 
     * @param slaughterBatch 屠宰批次
     * @return 屠宰批次
     */
    @Override
    public List<SlaughterBatchDTO> selectSlaughterBatchList(ReqSlaughterBatch slaughterBatch)
    {
        return slaughterBatchMapper.selectSlaughterBatchList(slaughterBatch);
    }

    /**
     * 新增屠宰批次
     * 
     * @param slaughterBatch 屠宰批次
     * @return 结果
     */
    @Override
    public int insertSlaughterBatch(SlaughterBatch slaughterBatch)
    {
        slaughterBatch.setCreateTime(DateUtils.getNowDate());
        return slaughterBatchMapper.insertSlaughterBatch(slaughterBatch);
    }

    /**
     * 修改屠宰批次
     * 
     * @param slaughterBatch 屠宰批次
     * @return 结果
     */
    @Override
    public int updateSlaughterBatch(SlaughterBatch slaughterBatch)
    {
        slaughterBatch.setUpdateTime(DateUtils.getNowDate());
        return slaughterBatchMapper.updateSlaughterBatch(slaughterBatch);
    }

    /**
     * 批量删除屠宰批次
     * 
     * @param ids 需要删除的屠宰批次主键
     * @return 结果
     */
    @Override
    public int deleteSlaughterBatchByIds(Long[] ids)
    {
        return slaughterBatchMapper.deleteSlaughterBatchByIds(ids);
    }

    /**
     * 删除屠宰批次信息
     * 
     * @param id 屠宰批次主键
     * @return 结果
     */
    @Override
    public int deleteSlaughterBatchById(Long id)
    {
        return slaughterBatchMapper.deleteSlaughterBatchById(id);
    }
}
