package com.ruoyi.app.service.impl;

import com.ruoyi.app.DTO.PorkSideProduceRecordDTO;
import com.ruoyi.app.model.PorkSideProduceRecord;
import com.ruoyi.app.model.request.ReqGetPorkSideProduceRecord;
import com.ruoyi.app.mapper.PorkSideProduceRecordMapper;
import com.ruoyi.app.service.IPorkSideProduceRecordService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 白条生产记录Service业务层处理
 * 
 * @author coede
 * @date 2025-03-19
 */
@Service
public class PorkSideProduceRecordServiceImpl implements IPorkSideProduceRecordService
{
    @Autowired
    private PorkSideProduceRecordMapper porkSideProduceRecordMapper;

    /**
     * 查询白条生产记录
     * 
     * @param id 白条生产记录主键
     * @return 白条生产记录
     */
    @Override
    public PorkSideProduceRecordDTO selectPorkSideProduceRecordById(Long id)
    {
        return porkSideProduceRecordMapper.selectPorkSideProduceRecordById(id);
    }

    /**
     * 查询白条生产记录列表
     * 
     * @param PorkSideProduceRecord 白条生产记录
     * @return 白条生产记录
     */
    @Override
    public List<PorkSideProduceRecordDTO> selectPorkSideProduceRecordList(ReqGetPorkSideProduceRecord PorkSideProduceRecord)
    {
        return porkSideProduceRecordMapper.selectPorkSideProduceRecordList(PorkSideProduceRecord);
    }

    /**
     * 新增白条生产记录
     * 
     * @param porkSideProduceRecord 白条生产记录
     * @return 结果
     */
    @Override
    public int insertPorkSideProduceRecord(PorkSideProduceRecord porkSideProduceRecord)
    {
        porkSideProduceRecord.setCreateTime(DateUtils.getNowDate());
        return porkSideProduceRecordMapper.insertPorkSideProduceRecord(porkSideProduceRecord);
    }

    /**
     * 修改白条生产记录
     * 
     * @param porkSideProduceRecord 白条生产记录
     * @return 结果
     */
    @Override
    public int updatePorkSideProduceRecord(PorkSideProduceRecord porkSideProduceRecord)
    {
        porkSideProduceRecord.setUpdateTime(DateUtils.getNowDate());
        return porkSideProduceRecordMapper.updatePorkSideProduceRecord(porkSideProduceRecord);
    }

    /**
     * 批量删除白条生产记录
     * 
     * @param ids 需要删除的白条生产记录主键
     * @return 结果
     */
    @Override
    public int deletePorkSideProduceRecordByIds(Long[] ids)
    {
        return porkSideProduceRecordMapper.deletePorkSideProduceRecordByIds(ids);
    }

    /**
     * 删除白条生产记录信息
     * 
     * @param id 白条生产记录主键
     * @return 结果
     */
    @Override
    public int deletePorkSideProduceRecordById(Long id)
    {
        return porkSideProduceRecordMapper.deletePorkSideProduceRecordById(id);
    }
}
