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.EntranceBatchMapper;
import com.ruoyi.app.domain.EntranceBatch;
import com.ruoyi.app.service.IEntranceBatchService;

/**
 * 入场批次Service业务层处理
 * 
 * @author coede
 * @date 2025-03-19
 */
@Service
public class EntranceBatchServiceImpl implements IEntranceBatchService 
{
    @Autowired
    private EntranceBatchMapper entranceBatchMapper;

    /**
     * 查询入场批次
     * 
     * @param id 入场批次主键
     * @return 入场批次
     */
    @Override
    public EntranceBatch selectEntranceBatchById(Long id)
    {
        return entranceBatchMapper.selectEntranceBatchById(id);
    }

    /**
     * 查询入场批次列表
     * 
     * @param entranceBatch 入场批次
     * @return 入场批次
     */
    @Override
    public List<EntranceBatch> selectEntranceBatchList(EntranceBatch entranceBatch)
    {
        return entranceBatchMapper.selectEntranceBatchList(entranceBatch);
    }

    /**
     * 新增入场批次
     * 
     * @param entranceBatch 入场批次
     * @return 结果
     */
    @Override
    public int insertEntranceBatch(EntranceBatch entranceBatch)
    {
        return entranceBatchMapper.insertEntranceBatch(entranceBatch);
    }

    /**
     * 修改入场批次
     * 
     * @param entranceBatch 入场批次
     * @return 结果
     */
    @Override
    public int updateEntranceBatch(EntranceBatch entranceBatch)
    {
        entranceBatch.setUpdateTime(DateUtils.getNowDate());
        return entranceBatchMapper.updateEntranceBatch(entranceBatch);
    }

    /**
     * 批量删除入场批次
     * 
     * @param ids 需要删除的入场批次主键
     * @return 结果
     */
    @Override
    public int deleteEntranceBatchByIds(Long[] ids)
    {
        return entranceBatchMapper.deleteEntranceBatchByIds(ids);
    }

    /**
     * 删除入场批次信息
     * 
     * @param id 入场批次主键
     * @return 结果
     */
    @Override
    public int deleteEntranceBatchById(Long id)
    {
        return entranceBatchMapper.deleteEntranceBatchById(id);
    }

    /**
     * 获取最近一条记录
     * @return 结果
     */
    public EntranceBatch selectLatelyEntrance(){
        return entranceBatchMapper.selectLatelyEntrance();
    }
}
